Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
C
coopwire-hypothesis
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
孙灵跃 Leon Sun
coopwire-hypothesis
Commits
7e50772b
Commit
7e50772b
authored
May 15, 2015
by
Sean Hammond
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Rename a helper function
parent
a57f3d25
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
10 deletions
+11
-10
account-controller-test.coffee
h/static/scripts/account/test/account-controller-test.coffee
+11
-10
No files found.
h/static/scripts/account/test/account-controller-test.coffee
View file @
7e50772b
...
...
@@ -323,8 +323,8 @@ describe "h:AccountController", ->
session = {profile: -> {$promise: ...}}
{ctrl, $scope} = controller(session: session)
###
c
ontroller
=
({
$scope
,
$filter
,
auth
,
flash
,
formRespond
,
identity
,
session
})
->
c
reateAccountController
=
({
$scope
,
$filter
,
auth
,
flash
,
formRespond
,
identity
,
session
})
->
locals
=
{
$scope
:
$scope
or
getRootScope
().
$new
()
$filter
:
$filter
or
->
->
{}
...
...
@@ -349,7 +349,8 @@ describe "h:AccountController", ->
profilePromise
=
Promise
.
resolve
({
email
:
"test_user@test_email.com"
})
{
$scope
}
=
controller
(
session
:
{
profile
:
->
{
$promise
:
profilePromise
}})
{
$scope
}
=
createAccountController
(
session
:
{
profile
:
->
{
$promise
:
profilePromise
}})
profilePromise
.
then
(
->
assert
$scope
.
email
==
"test_user@test_email.com"
...
...
@@ -365,7 +366,7 @@ describe "h:AccountController", ->
edit_profile
=
sinon
.
stub
()
edit_profile
.
returns
({
$promise
:
Promise
.
resolve
({})})
{
$scope
}
=
controller
(
{
$scope
}
=
c
reateAccountC
ontroller
(
session
:
getStubSession
(
edit_profile
:
edit_profile
)
# Simulate a logged-in user with username "joeuser"
$filter
:
->
->
"joeuser"
)
...
...
@@ -385,7 +386,7 @@ describe "h:AccountController", ->
it
"updates placeholder after successfully changing the email address"
,
->
new_email_addr
=
"new_email_address@test.com"
{
$scope
}
=
controller
(
{
$scope
}
=
c
reateAccountC
ontroller
(
# AccountController expects session.edit_profile() to respond with the
# newly saved email address.
session
:
getStubSession
(
...
...
@@ -411,7 +412,7 @@ describe "h:AccountController", ->
emailAgain
:
"The emails must match."
}
{
$scope
}
=
controller
(
{
$scope
}
=
c
reateAccountC
ontroller
(
formRespond
:
require
(
"../../form-respond"
)()
session
:
getStubSession
(
edit_profile
:
->
{
$promise
:
Promise
.
reject
(
server_response
)}
...
...
@@ -428,7 +429,7 @@ describe "h:AccountController", ->
)
it
"broadcasts 'formState' 'changeEmailForm' 'loading' on submit"
,
->
{
$scope
}
=
controller
({})
{
$scope
}
=
c
reateAccountC
ontroller
({})
$scope
.
$broadcast
=
sinon
.
stub
()
...
...
@@ -441,7 +442,7 @@ describe "h:AccountController", ->
"formState"
,
"changeEmailForm"
,
"loading"
)
it
"broadcasts 'formState' 'changeEmailForm' 'success' on success"
,
->
{
$scope
}
=
controller
({})
{
$scope
}
=
c
reateAccountC
ontroller
({})
$scope
.
$broadcast
=
sinon
.
stub
()
...
...
@@ -455,7 +456,7 @@ describe "h:AccountController", ->
)
it
"broadcasts 'formState' 'changeEmailForm' '' on error"
,
->
{
$scope
}
=
controller
(
{
$scope
}
=
c
reateAccountC
ontroller
(
flash
:
{
error
:
->
}
session
:
getStubSession
(
edit_profile
:
->
{
$promise
:
Promise
.
reject
({
data
:
{}})}
...
...
@@ -483,7 +484,7 @@ describe "h:AccountController", ->
statusText
:
"Unauthorized"
}
{
$scope
}
=
controller
(
{
$scope
}
=
c
reateAccountC
ontroller
(
formRespond
:
require
(
"../../form-respond"
)()
session
:
getStubSession
(
edit_profile
:
->
{
$promise
:
Promise
.
reject
(
server_response
)}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment