Try to fix tests on travis

This commit is contained in:
Scott Erickson 2016-09-09 15:25:19 -07:00
parent 1383b83d54
commit 0f17ed0c34
2 changed files with 9 additions and 7 deletions

View file

@ -200,6 +200,7 @@ module.exports = class CreateTeacherAccountView extends RootView
jqxhr = me.save() jqxhr = me.save()
if not jqxhr if not jqxhr
throw new Error('Could not save user') throw new Error('Could not save user')
@trigger 'update-settings'
return jqxhr return jqxhr
.then => .then =>
@ -215,6 +216,7 @@ module.exports = class CreateTeacherAccountView extends RootView
else else
{ name, email, password1 } = forms.formToObject(@$el) { name, email, password1 } = forms.formToObject(@$el)
jqxhr = me.signupWithPassword(name, email, password1) jqxhr = me.signupWithPassword(name, email, password1)
@trigger 'signup'
return jqxhr return jqxhr
.then => .then =>

View file

@ -136,7 +136,7 @@ describe 'CreateTeacherAccountView', ->
status: 201 status: 201
responseText: JSON.stringify(_.extend({_id:'fraghlarghl'}, JSON.parse(request.params))) responseText: JSON.stringify(_.extend({_id:'fraghlarghl'}, JSON.parse(request.params)))
}) })
_.defer => view.once 'update-settings', =>
request = jasmine.Ajax.requests.mostRecent() request = jasmine.Ajax.requests.mostRecent()
expect(request.url).toBe("/db/user/1234") expect(request.url).toBe("/db/user/1234")
body = JSON.parse(request.params) body = JSON.parse(request.params)
@ -146,7 +146,7 @@ describe 'CreateTeacherAccountView', ->
status: 200 status: 200
responseText: '{}' responseText: '{}'
}) })
_.defer => view.once 'signup', =>
request = jasmine.Ajax.requests.mostRecent() request = jasmine.Ajax.requests.mostRecent()
expect(request.url).toBe("/db/user/1234/signup-with-facebook") expect(request.url).toBe("/db/user/1234/signup-with-facebook")
expected = {"name":"New Name","email":"some@email.com","facebookID":"abcd","facebookAccessToken":"1234"} expected = {"name":"New Name","email":"some@email.com","facebookID":"abcd","facebookAccessToken":"1234"}
@ -175,7 +175,7 @@ describe 'CreateTeacherAccountView', ->
request = jasmine.Ajax.requests.mostRecent() request = jasmine.Ajax.requests.mostRecent()
expect(request.url).toBe('/auth/login-gplus') expect(request.url).toBe('/auth/login-gplus')
describe 'when the user connects with F+ and there isn\'t already an associated account', -> describe 'when the user connects with G+ and there isn\'t already an associated account', ->
beforeEach -> beforeEach ->
request = jasmine.Ajax.requests.mostRecent() request = jasmine.Ajax.requests.mostRecent()
request.respondWith({ status: 404, responseText: '{}' }) request.respondWith({ status: 404, responseText: '{}' })
@ -202,7 +202,7 @@ describe 'CreateTeacherAccountView', ->
status: 201 status: 201
responseText: JSON.stringify(_.extend({_id:'fraghlarghl'}, JSON.parse(request.params))) responseText: JSON.stringify(_.extend({_id:'fraghlarghl'}, JSON.parse(request.params)))
}) })
_.defer => view.once 'update-settings', =>
request = jasmine.Ajax.requests.mostRecent() request = jasmine.Ajax.requests.mostRecent()
expect(request.url).toBe("/db/user/1234") expect(request.url).toBe("/db/user/1234")
body = JSON.parse(request.params) body = JSON.parse(request.params)
@ -212,7 +212,7 @@ describe 'CreateTeacherAccountView', ->
status: 200 status: 200
responseText: '{}' responseText: '{}'
}) })
_.defer => view.once 'signup', =>
request = jasmine.Ajax.requests.mostRecent() request = jasmine.Ajax.requests.mostRecent()
expect(request.url).toBe("/db/user/1234/signup-with-gplus") expect(request.url).toBe("/db/user/1234/signup-with-gplus")
expected = {"name":"New Name","email":"some@email.com","gplusID":"abcd","gplusAccessToken":"1234"} expected = {"name":"New Name","email":"some@email.com","gplusID":"abcd","gplusAccessToken":"1234"}
@ -260,7 +260,7 @@ describe 'CreateTeacherAccountView', ->
for attr in ['role', 'firstName', 'lastName'] for attr in ['role', 'firstName', 'lastName']
expect(attrs[attr]).toBeDefined() expect(attrs[attr]).toBeDefined()
request.respondWith({ status: 201, responseText: '{}' }) request.respondWith({ status: 201, responseText: '{}' })
_.defer => view.once 'signup', =>
request = jasmine.Ajax.requests.mostRecent() request = jasmine.Ajax.requests.mostRecent()
expect(request.url).toBe('/db/user/1234/signup-with-password') expect(request.url).toBe('/db/user/1234/signup-with-password')
body = JSON.parse(request.params) body = JSON.parse(request.params)
@ -279,7 +279,7 @@ describe 'CreateTeacherAccountView', ->
responseText: JSON.stringify(_.extend({_id:'fraghlarghl'}, JSON.parse(request.params))) responseText: JSON.stringify(_.extend({_id:'fraghlarghl'}, JSON.parse(request.params)))
}) })
expect(request.url).toBe('/db/user/1234') expect(request.url).toBe('/db/user/1234')
_.defer => view.once 'signup', =>
request = jasmine.Ajax.requests.mostRecent() request = jasmine.Ajax.requests.mostRecent()
expect(request.url).toBe('/db/user/1234/signup-with-password') expect(request.url).toBe('/db/user/1234/signup-with-password')
request.respondWith({ status: 201, responseText: '{}' }) request.respondWith({ status: 201, responseText: '{}' })