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
0
Merge Requests
0
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
Tatuya Kamada
gitlab-ce
Commits
0dff6fd7
Commit
0dff6fd7
authored
Jun 03, 2016
by
Timothy Andrew
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix rubocop spec.
parent
3adf125a
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
6 additions
and
6 deletions
+6
-6
app/controllers/application_controller.rb
app/controllers/application_controller.rb
+1
-1
spec/controllers/application_controller_spec.rb
spec/controllers/application_controller_spec.rb
+4
-4
spec/models/personal_access_token_spec.rb
spec/models/personal_access_token_spec.rb
+1
-1
No files found.
app/controllers/application_controller.rb
View file @
0dff6fd7
...
@@ -368,7 +368,7 @@ class ApplicationController < ActionController::Base
...
@@ -368,7 +368,7 @@ class ApplicationController < ActionController::Base
# From https://github.com/plataformatec/devise/wiki/How-To:-Simple-Token-Authentication-Example
# From https://github.com/plataformatec/devise/wiki/How-To:-Simple-Token-Authentication-Example
# https://gist.github.com/josevalim/fb706b1e933ef01e4fb6
# https://gist.github.com/josevalim/fb706b1e933ef01e4fb6
def
get_user_from_private_token
def
get_user_from_private_token
user_token
=
params
[
:private_token
].
presence
||
request
.
headers
[
'PRIVATE-TOKEN'
].
presence
user_token
=
params
[
:private_token
].
presence
||
request
.
headers
[
'PRIVATE-TOKEN'
].
presence
User
.
find_by_authentication_token
(
user_token
.
to_s
)
if
user_token
User
.
find_by_authentication_token
(
user_token
.
to_s
)
if
user_token
end
end
...
...
spec/controllers/application_controller_spec.rb
View file @
0dff6fd7
...
@@ -62,8 +62,8 @@ describe ApplicationController do
...
@@ -62,8 +62,8 @@ describe ApplicationController do
it
"doesn't log the user in otherwise"
do
it
"doesn't log the user in otherwise"
do
@request
.
headers
[
'PRIVATE-TOKEN'
]
=
"token"
@request
.
headers
[
'PRIVATE-TOKEN'
]
=
"token"
get
:index
,
private_token:
"token"
,
authenticity_token:
"token"
get
:index
,
private_token:
"token"
,
authenticity_token:
"token"
expect
(
response
.
status
).
to_not
eq
(
200
)
expect
(
response
.
status
).
not_to
eq
(
200
)
expect
(
response
.
body
).
to_not
eq
(
"authenticated"
)
expect
(
response
.
body
).
not_to
eq
(
"authenticated"
)
end
end
end
end
...
@@ -96,8 +96,8 @@ describe ApplicationController do
...
@@ -96,8 +96,8 @@ describe ApplicationController do
it
"doesn't log the user in otherwise"
do
it
"doesn't log the user in otherwise"
do
get
:index
,
private_token:
"token"
get
:index
,
private_token:
"token"
expect
(
response
.
status
).
to_not
eq
(
200
)
expect
(
response
.
status
).
not_to
eq
(
200
)
expect
(
response
.
body
).
to_not
eq
(
'authenticated'
)
expect
(
response
.
body
).
not_to
eq
(
'authenticated'
)
end
end
end
end
end
end
...
...
spec/models/personal_access_token_spec.rb
View file @
0dff6fd7
...
@@ -9,7 +9,7 @@ describe PersonalAccessToken, models: true do
...
@@ -9,7 +9,7 @@ describe PersonalAccessToken, models: true do
it
"doesn't save the record"
do
it
"doesn't save the record"
do
personal_access_token
=
PersonalAccessToken
.
generate
({})
personal_access_token
=
PersonalAccessToken
.
generate
({})
expect
(
personal_access_token
).
to_not
be_persisted
expect
(
personal_access_token
).
not_to
be_persisted
end
end
end
end
end
end
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