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
359d72ba
Commit
359d72ba
authored
Jun 06, 2017
by
Shinya Maeda
Committed by
Shinya Maeda
Jun 28, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix static analysys
parent
e9734c6d
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
13 additions
and
13 deletions
+13
-13
spec/controllers/projects/pipeline_schedules_controller_spec.rb
...ontrollers/projects/pipeline_schedules_controller_spec.rb
+3
-3
spec/support/matchers/access_matchers_for_controller.rb
spec/support/matchers/access_matchers_for_controller.rb
+10
-10
No files found.
spec/controllers/projects/pipeline_schedules_controller_spec.rb
View file @
359d72ba
...
...
@@ -90,7 +90,7 @@ describe Projects::PipelineSchedulesController do
describe
'GET edit'
do
let
(
:action
)
do
Proc
.
new
do
|
user
|
proc
do
|
user
|
get
:edit
,
namespace_id:
project
.
namespace
.
to_param
,
project_id:
project
,
id:
pipeline_schedule
.
id
end
end
...
...
@@ -108,7 +108,7 @@ describe Projects::PipelineSchedulesController do
describe
'GET take_ownership'
do
let
(
:action
)
do
Proc
.
new
do
|
user
|
proc
do
|
user
|
post
:take_ownership
,
namespace_id:
project
.
namespace
.
to_param
,
project_id:
project
,
id:
pipeline_schedule
.
id
end
end
...
...
@@ -126,7 +126,7 @@ describe Projects::PipelineSchedulesController do
describe
'PUT update'
do
let
(
:action
)
do
Proc
.
new
do
|
user
|
proc
do
|
user
|
put
:update
,
namespace_id:
project
.
namespace
.
to_param
,
project_id:
project
,
id:
pipeline_schedule
.
id
end
end
...
...
spec/support/matchers/access_matchers_for_controller.rb
View file @
359d72ba
...
...
@@ -5,14 +5,22 @@ module AccessMatchersForController
extend
RSpec
::
Matchers
::
DSL
include
Warden
::
Test
::
Helpers
EXPECTED_STATUS_CODE_ALLOWED
=
[
200
,
302
]
EXPECTED_STATUS_CODE_DENIED
=
[
404
]
EXPECTED_STATUS_CODE_ALLOWED
=
[
200
,
302
]
.
freeze
EXPECTED_STATUS_CODE_DENIED
=
[
404
]
.
freeze
def
emulate_user
(
role
,
membership
=
nil
)
case
role
when
:admin
user
=
create
(
:admin
)
sign_in
(
user
)
when
:user
user
=
create
(
:user
)
sign_in
(
user
)
when
:external
user
=
create
(
:user
,
external:
true
)
sign_in
(
user
)
when
:visitor
# rubocop:disable Lint/EmptyWhen
# no-op
when
*
Gitlab
::
Access
.
sym_options_with_owner
.
keys
# owner, master, developer, reporter, guest
raise
ArgumentError
,
"cannot emulate
#{
role
}
without membership parent"
unless
membership
...
...
@@ -24,14 +32,6 @@ module AccessMatchersForController
end
sign_in
(
user
)
when
:user
user
=
create
(
:user
)
sign_in
(
user
)
when
:external
user
=
create
(
:user
,
external:
true
)
sign_in
(
user
)
when
:visitor
# no-op
else
raise
ArgumentError
,
"cannot emulate user
#{
role
}
"
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