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
fb26ab12
Commit
fb26ab12
authored
May 15, 2015
by
Sean Hammond
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Shorten a docstring
parent
7e50772b
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
1 addition
and
31 deletions
+1
-31
account-controller-test.coffee
h/static/scripts/account/test/account-controller-test.coffee
+1
-31
No files found.
h/static/scripts/account/test/account-controller-test.coffee
View file @
fb26ab12
...
...
@@ -292,37 +292,7 @@ describe "h:AccountController", ->
$setValidity
:
->
}
###
Return an AccountController instance and stub services.
Returns an object containing:
* an AccountController instance with all the services it depends on
stubbed, and
* each of the stubbed services
The returned object looks like this:
{"ctrl": the AccountController instance
"$scope": the scope attached to ctrl
"$filter": the stub filter injected into ctrl
"auth": the stub auth service injected into ctrl
... (more stubbed services here)
}
Use CoffeeScript's destructuring assignment to pull out just the things
you need from the returned object. For example:
{ctrl, $scope} = controller({})
By default this does the minimum amount of stubbing necessary to create an
AccountController without it crashing. For each of the services that gets
stubbed the caller can optionally pass in their own object to be used
instead of the minimal stub. For example:
session = {profile: -> {$promise: ...}}
{ctrl, $scope} = controller(session: session)
###
# Return an AccountController instance and stub services.
createAccountController
=
({
$scope
,
$filter
,
auth
,
flash
,
formRespond
,
identity
,
session
})
->
locals
=
{
...
...
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