mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-02-11 23:17:48 +00:00
Make sure userSelect directive uses our Admin::UserSerializer instead of base Spree api view
This commit is contained in:
committed by
Rob Harrington
parent
ec5ce45850
commit
b893dea810
@@ -35,29 +35,29 @@ describe "enterpriseCtrl", ->
|
||||
describe "adding managers", ->
|
||||
u1 = u2 = u3 = null
|
||||
beforeEach ->
|
||||
u1 = { id: 1, email: 'name1@email.com' }
|
||||
u2 = { id: 2, email: 'name2@email.com' }
|
||||
u3 = { id: 3, email: 'name3@email.com' }
|
||||
u1 = { id: 1, email: 'name1@email.com', confirmed: true }
|
||||
u2 = { id: 2, email: 'name2@email.com', confirmed: true }
|
||||
u3 = { id: 3, email: 'name3@email.com', confirmed: true }
|
||||
enterprise.users = [u1, u2 ,u3]
|
||||
|
||||
it "adds a user to the list", ->
|
||||
u4 = { id: 4, email: "name4@email.com" }
|
||||
u4 = { id: 4, email: "name4@email.com", confirmed: true }
|
||||
scope.addManager u4
|
||||
expect(enterprise.users).toContain u4
|
||||
|
||||
it "ignores object without an id", ->
|
||||
u4 = { not_id: 4, email: "name4@email.com" }
|
||||
u4 = { not_id: 4, email: "name4@email.com", confirmed: true }
|
||||
scope.addManager u4
|
||||
expect(enterprise.users).not.toContain u4
|
||||
|
||||
it "it ignores objects without an email", ->
|
||||
u4 = { id: 4, not_email: "name4@email.com" }
|
||||
u4 = { id: 4, not_email: "name4@email.com", confirmed: true }
|
||||
scope.addManager u4
|
||||
expect(enterprise.users).not.toContain u4
|
||||
|
||||
it "ignores objects that are already in the list, and alerts the user", ->
|
||||
spyOn(window, "alert").and.callThrough()
|
||||
u4 = { id: 3, email: "email-doesn't-matter.com" }
|
||||
u4 = { id: 3, email: "email-doesn't-matter.com", confirmed: true }
|
||||
scope.addManager u4
|
||||
expect(enterprise.users).not.toContain u4
|
||||
expect(window.alert).toHaveBeenCalledWith "email-doesn't-matter.com is already a manager!"
|
||||
@@ -66,9 +66,9 @@ describe "enterpriseCtrl", ->
|
||||
describe "removing managers", ->
|
||||
u1 = u2 = u3 = null
|
||||
beforeEach ->
|
||||
u1 = { id: 1, email: 'name1@email.com' }
|
||||
u2 = { id: 2, email: 'name2@email.com' }
|
||||
u3 = { id: 3, email: 'name3@email.com' }
|
||||
u1 = { id: 1, email: 'name1@email.com', confirmed: true }
|
||||
u2 = { id: 2, email: 'name2@email.com', confirmed: true }
|
||||
u3 = { id: 3, email: 'name3@email.com', confirmed: true }
|
||||
enterprise.users = [u1, u2 ,u3]
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user