Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
b4b02485
Commit
b4b02485
authored
Jun 03, 2016
by
Timothy Andrew
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Parts of spec names with "when" should be contexts.
parent
a1295d8e
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
27 additions
and
18 deletions
+27
-18
spec/controllers/application_controller_spec.rb
spec/controllers/application_controller_spec.rb
+27
-18
No files found.
spec/controllers/application_controller_spec.rb
View file @
b4b02485
...
...
@@ -41,17 +41,22 @@ describe ApplicationController do
let
(
:user
)
{
create
(
:user
)
}
it
"logs the user in when the 'private_token' param is populated with the private token"
do
get
:index
,
private_token:
user
.
private_token
expect
(
response
.
status
).
to
eq
(
200
)
expect
(
response
.
body
).
to
eq
(
"authenticated"
)
context
"when the 'private_token' param is populated with the private token"
do
it
"logs the user in"
do
get
:index
,
private_token:
user
.
private_token
expect
(
response
.
status
).
to
eq
(
200
)
expect
(
response
.
body
).
to
eq
(
"authenticated"
)
end
end
it
"logs the user in when the 'PRIVATE-TOKEN' header is populated with the private token"
do
@request
.
headers
[
'PRIVATE-TOKEN'
]
=
user
.
private_token
get
:index
expect
(
response
.
status
).
to
eq
(
200
)
expect
(
response
.
body
).
to
eq
(
"authenticated"
)
context
"when the 'PRIVATE-TOKEN' header is populated with the private token"
do
it
"logs the user in"
do
@request
.
headers
[
'PRIVATE-TOKEN'
]
=
user
.
private_token
get
:index
expect
(
response
.
status
).
to
eq
(
200
)
expect
(
response
.
body
).
to
eq
(
"authenticated"
)
end
end
it
"doesn't log the user in otherwise"
do
...
...
@@ -72,17 +77,21 @@ describe ApplicationController do
let
(
:user
)
{
create
(
:user
)
}
let
(
:personal_access_token
)
{
create
(
:personal_access_token
,
user:
user
)
}
it
"logs the user in when the 'personal_access_token' param is populated with the personal access token"
do
get
:index
,
private_token:
personal_access_token
.
token
expect
(
response
.
status
).
to
eq
(
200
)
expect
(
response
.
body
).
to
eq
(
'authenticated'
)
context
"when the 'personal_access_token' param is populated with the personal access token"
do
it
"logs the user in"
do
get
:index
,
private_token:
personal_access_token
.
token
expect
(
response
.
status
).
to
eq
(
200
)
expect
(
response
.
body
).
to
eq
(
'authenticated'
)
end
end
it
"logs the user in when the 'PERSONAL_ACCESS_TOKEN' header is populated with the personal access token"
do
@request
.
headers
[
"PRIVATE-TOKEN"
]
=
personal_access_token
.
token
get
:index
expect
(
response
.
status
).
to
eq
(
200
)
expect
(
response
.
body
).
to
eq
(
'authenticated'
)
context
"when the 'PERSONAL_ACCESS_TOKEN' header is populated with the personal access token"
do
it
"logs the user in"
do
@request
.
headers
[
"PRIVATE-TOKEN"
]
=
personal_access_token
.
token
get
:index
expect
(
response
.
status
).
to
eq
(
200
)
expect
(
response
.
body
).
to
eq
(
'authenticated'
)
end
end
it
"doesn't log the user in otherwise"
do
...
...
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