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
Boxiang Sun
gitlab-ce
Commits
c277b2c3
Commit
c277b2c3
authored
Apr 28, 2017
by
Dmitriy Zaporozhets
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add tests for Oauth::AuthorizationsController
Signed-off-by:
Dmitriy Zaporozhets
<
dmitriy.zaporozhets@gmail.com
>
parent
00e4ec55
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
55 additions
and
0 deletions
+55
-0
spec/controllers/oauth/authorizations_controller_spec.rb
spec/controllers/oauth/authorizations_controller_spec.rb
+55
-0
No files found.
spec/controllers/oauth/authorizations_controller_spec.rb
0 → 100644
View file @
c277b2c3
require
'spec_helper'
describe
Oauth
::
AuthorizationsController
do
let
(
:user
)
{
create
(
:user
)
}
let
(
:doorkeeper
)
do
Doorkeeper
::
Application
.
create
(
name:
"MyApp"
,
redirect_uri:
'http://example.com'
,
scopes:
""
)
end
let
(
:params
)
do
{
response_type:
"code"
,
client_id:
doorkeeper
.
uid
,
redirect_uri:
doorkeeper
.
redirect_uri
,
state:
'state'
}
end
before
do
sign_in
(
user
)
end
describe
'GET #new'
do
context
'without valid params'
do
it
'returns 200 code and renders error view'
do
get
:new
expect
(
response
).
to
have_http_status
(
200
)
expect
(
response
).
to
render_template
(
'doorkeeper/authorizations/error'
)
end
end
context
'with valid params'
do
it
'returns 200 code and renders view'
do
get
:new
,
params
expect
(
response
).
to
have_http_status
(
200
)
expect
(
response
).
to
render_template
(
'doorkeeper/authorizations/new'
)
end
it
'deletes session.user_return_to and redirects when skip authorization'
do
request
.
session
[
'user_return_to'
]
=
'http://example.com'
allow
(
controller
).
to
receive
(
:skip_authorization?
).
and_return
(
true
)
get
:new
,
params
expect
(
request
.
session
[
'user_return_to'
]).
to
be_nil
expect
(
response
).
to
have_http_status
(
302
)
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