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
a513ae4a
Commit
a513ae4a
authored
Jun 28, 2017
by
Shinya Maeda
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
use go instead of let proc
parent
07b0615e
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
43 additions
and
49 deletions
+43
-49
spec/controllers/projects/pipeline_schedules_controller_spec.rb
...ontrollers/projects/pipeline_schedules_controller_spec.rb
+39
-45
spec/support/matchers/access_matchers_for_controller.rb
spec/support/matchers/access_matchers_for_controller.rb
+4
-4
No files found.
spec/controllers/projects/pipeline_schedules_controller_spec.rb
View file @
a513ae4a
...
...
@@ -89,60 +89,54 @@ describe Projects::PipelineSchedulesController do
include
AccessMatchersForController
describe
'GET edit'
do
let
(
:action
)
do
proc
do
|
user
|
get
:edit
,
namespace_id:
project
.
namespace
.
to_param
,
project_id:
project
,
id:
pipeline_schedule
.
id
end
it
{
expect
{
go
}.
to
be_allowed_for
(
:admin
)
}
it
{
expect
{
go
}.
to
be_allowed_for
(
:owner
).
of
(
project
)
}
it
{
expect
{
go
}.
to
be_allowed_for
(
:master
).
of
(
project
)
}
it
{
expect
{
go
}.
to
be_allowed_for
(
:developer
).
of
(
project
)
}
it
{
expect
{
go
}.
to
be_denied_for
(
:reporter
).
of
(
project
)
}
it
{
expect
{
go
}.
to
be_denied_for
(
:guest
).
of
(
project
)
}
it
{
expect
{
go
}.
to
be_denied_for
(
:user
)
}
it
{
expect
{
go
}.
to
be_denied_for
(
:external
)
}
it
{
expect
{
go
}.
to
be_denied_for
(
:visitor
)
}
def
go
get
:edit
,
namespace_id:
project
.
namespace
.
to_param
,
project_id:
project
,
id:
pipeline_schedule
.
id
end
specify
{
expect
(
action
).
to
be_allowed_for
(
:admin
)
}
specify
{
expect
(
action
).
to
be_allowed_for
(
:owner
).
of
(
project
)
}
specify
{
expect
(
action
).
to
be_allowed_for
(
:master
).
of
(
project
)
}
specify
{
expect
(
action
).
to
be_allowed_for
(
:developer
).
of
(
project
)
}
specify
{
expect
(
action
).
to
be_denied_for
(
:reporter
).
of
(
project
)
}
specify
{
expect
(
action
).
to
be_denied_for
(
:guest
).
of
(
project
)
}
specify
{
expect
(
action
).
to
be_denied_for
(
:user
)
}
specify
{
expect
(
action
).
to
be_denied_for
(
:external
)
}
specify
{
expect
(
action
).
to
be_denied_for
(
:visitor
)
}
end
describe
'GET take_ownership'
do
let
(
:action
)
do
proc
do
|
user
|
post
:take_ownership
,
namespace_id:
project
.
namespace
.
to_param
,
project_id:
project
,
id:
pipeline_schedule
.
id
end
it
{
expect
{
go
}.
to
be_allowed_for
(
:admin
)
}
it
{
expect
{
go
}.
to
be_allowed_for
(
:owner
).
of
(
project
)
}
it
{
expect
{
go
}.
to
be_allowed_for
(
:master
).
of
(
project
)
}
it
{
expect
{
go
}.
to
be_allowed_for
(
:developer
).
of
(
project
)
}
it
{
expect
{
go
}.
to
be_denied_for
(
:reporter
).
of
(
project
)
}
it
{
expect
{
go
}.
to
be_denied_for
(
:guest
).
of
(
project
)
}
it
{
expect
{
go
}.
to
be_denied_for
(
:user
)
}
it
{
expect
{
go
}.
to
be_denied_for
(
:external
)
}
it
{
expect
{
go
}.
to
be_denied_for
(
:visitor
)
}
def
go
post
:take_ownership
,
namespace_id:
project
.
namespace
.
to_param
,
project_id:
project
,
id:
pipeline_schedule
.
id
end
specify
{
expect
(
action
).
to
be_allowed_for
(
:admin
)
}
specify
{
expect
(
action
).
to
be_allowed_for
(
:owner
).
of
(
project
)
}
specify
{
expect
(
action
).
to
be_allowed_for
(
:master
).
of
(
project
)
}
specify
{
expect
(
action
).
to
be_allowed_for
(
:developer
).
of
(
project
)
}
specify
{
expect
(
action
).
to
be_denied_for
(
:reporter
).
of
(
project
)
}
specify
{
expect
(
action
).
to
be_denied_for
(
:guest
).
of
(
project
)
}
specify
{
expect
(
action
).
to
be_denied_for
(
:user
)
}
specify
{
expect
(
action
).
to
be_denied_for
(
:external
)
}
specify
{
expect
(
action
).
to
be_denied_for
(
:visitor
)
}
end
describe
'PUT update'
do
let
(
:action
)
do
proc
do
|
user
|
put
:update
,
namespace_id:
project
.
namespace
.
to_param
,
project_id:
project
,
id:
pipeline_schedule
.
id
,
schedule:
{
description:
'a'
}
end
it
{
expect
{
go
}.
to
be_allowed_for
(
:admin
)
}
it
{
expect
{
go
}.
to
be_allowed_for
(
:owner
).
of
(
project
)
}
it
{
expect
{
go
}.
to
be_allowed_for
(
:master
).
of
(
project
)
}
it
{
expect
{
go
}.
to
be_allowed_for
(
:developer
).
of
(
project
)
}
it
{
expect
{
go
}.
to
be_denied_for
(
:reporter
).
of
(
project
)
}
it
{
expect
{
go
}.
to
be_denied_for
(
:guest
).
of
(
project
)
}
it
{
expect
{
go
}.
to
be_denied_for
(
:user
)
}
it
{
expect
{
go
}.
to
be_denied_for
(
:external
)
}
it
{
expect
{
go
}.
to
be_denied_for
(
:visitor
)
}
def
go
put
:update
,
namespace_id:
project
.
namespace
.
to_param
,
project_id:
project
,
id:
pipeline_schedule
.
id
,
schedule:
{
description:
'a'
}
end
specify
{
expect
(
action
).
to
be_allowed_for
(
:admin
)
}
specify
{
expect
(
action
).
to
be_allowed_for
(
:owner
).
of
(
project
)
}
specify
{
expect
(
action
).
to
be_allowed_for
(
:master
).
of
(
project
)
}
specify
{
expect
(
action
).
to
be_allowed_for
(
:developer
).
of
(
project
)
}
specify
{
expect
(
action
).
to
be_denied_for
(
:reporter
).
of
(
project
)
}
specify
{
expect
(
action
).
to
be_denied_for
(
:guest
).
of
(
project
)
}
specify
{
expect
(
action
).
to
be_denied_for
(
:user
)
}
specify
{
expect
(
action
).
to
be_denied_for
(
:external
)
}
specify
{
expect
(
action
).
to
be_denied_for
(
:visitor
)
}
end
end
end
spec/support/matchers/access_matchers_for_controller.rb
View file @
a513ae4a
...
...
@@ -52,8 +52,8 @@ module AccessMatchersForController
matcher
:be_allowed_for
do
|
role
|
match
do
|
action
|
user
=
emulate_user
(
role
,
@membership
)
action
.
call
(
user
)
emulate_user
(
role
,
@membership
)
action
.
call
EXPECTED_STATUS_CODE_ALLOWED
.
include?
(
response
.
status
)
end
...
...
@@ -68,8 +68,8 @@ module AccessMatchersForController
matcher
:be_denied_for
do
|
role
|
match
do
|
action
|
user
=
emulate_user
(
role
,
@membership
)
action
.
call
(
user
)
emulate_user
(
role
,
@membership
)
action
.
call
EXPECTED_STATUS_CODE_DENIED
.
include?
(
response
.
status
)
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