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
789db2cc
Commit
789db2cc
authored
Dec 20, 2016
by
Markus Koller
Committed by
Alexis Reigel
Mar 07, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Make sure scopes are loaded in admin OAuth application form
parent
6bf7037e
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
66 additions
and
1 deletion
+66
-1
app/controllers/admin/applications_controller.rb
app/controllers/admin/applications_controller.rb
+1
-1
spec/controllers/admin/applications_controller_spec.rb
spec/controllers/admin/applications_controller_spec.rb
+65
-0
No files found.
app/controllers/admin/applications_controller.rb
View file @
789db2cc
...
@@ -2,7 +2,7 @@ class Admin::ApplicationsController < Admin::ApplicationController
...
@@ -2,7 +2,7 @@ class Admin::ApplicationsController < Admin::ApplicationController
include
OauthApplications
include
OauthApplications
before_action
:set_application
,
only:
[
:show
,
:edit
,
:update
,
:destroy
]
before_action
:set_application
,
only:
[
:show
,
:edit
,
:update
,
:destroy
]
before_action
:load_scopes
,
only:
[
:new
,
:
edit
]
before_action
:load_scopes
,
only:
[
:new
,
:
create
,
:edit
,
:update
]
def
index
def
index
@applications
=
Doorkeeper
::
Application
.
where
(
"owner_id IS NULL"
)
@applications
=
Doorkeeper
::
Application
.
where
(
"owner_id IS NULL"
)
...
...
spec/controllers/admin/applications_controller_spec.rb
0 → 100644
View file @
789db2cc
require
'spec_helper'
describe
Admin
::
ApplicationsController
do
let
(
:admin
)
{
create
(
:admin
)
}
let
(
:application
)
{
create
(
:oauth_application
,
owner_id:
nil
,
owner_type:
nil
)
}
before
do
sign_in
(
admin
)
end
describe
'GET #new'
do
it
'renders the application form'
do
get
:new
expect
(
response
).
to
render_template
:new
expect
(
assigns
[
:scopes
]).
to
be_kind_of
(
Doorkeeper
::
OAuth
::
Scopes
)
end
end
describe
'GET #edit'
do
it
'renders the application form'
do
get
:edit
,
id:
application
.
id
expect
(
response
).
to
render_template
:edit
expect
(
assigns
[
:scopes
]).
to
be_kind_of
(
Doorkeeper
::
OAuth
::
Scopes
)
end
end
describe
'POST #create'
do
it
'creates the application'
do
expect
do
post
:create
,
doorkeeper_application:
attributes_for
(
:application
)
end
.
to
change
{
Doorkeeper
::
Application
.
count
}.
by
(
1
)
application
=
Doorkeeper
::
Application
.
last
expect
(
response
).
to
redirect_to
(
admin_application_path
(
application
))
end
it
'renders the application form on errors'
do
expect
do
post
:create
,
doorkeeper_application:
attributes_for
(
:application
).
merge
(
redirect_uri:
nil
)
end
.
not_to
change
{
Doorkeeper
::
Application
.
count
}
expect
(
response
).
to
render_template
:new
expect
(
assigns
[
:scopes
]).
to
be_kind_of
(
Doorkeeper
::
OAuth
::
Scopes
)
end
end
describe
'PATCH #update'
do
it
'updates the application'
do
patch
:update
,
id:
application
.
id
,
doorkeeper_application:
{
redirect_uri:
'http://example.com/'
}
expect
(
response
).
to
redirect_to
(
admin_application_path
(
application
))
expect
(
application
.
reload
.
redirect_uri
).
to
eq
'http://example.com/'
end
it
'renders the application form on errors'
do
patch
:update
,
id:
application
.
id
,
doorkeeper_application:
{
redirect_uri:
nil
}
expect
(
response
).
to
render_template
:edit
expect
(
assigns
[
:scopes
]).
to
be_kind_of
(
Doorkeeper
::
OAuth
::
Scopes
)
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