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
1
Merge Requests
1
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
nexedi
gitlab-ce
Commits
b56f2850
Commit
b56f2850
authored
Aug 12, 2019
by
Thong Kuah
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Improve cluster policy spec coverage
parent
7daf1f41
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
12 additions
and
0 deletions
+12
-0
spec/policies/clusters/instance_policy_spec.rb
spec/policies/clusters/instance_policy_spec.rb
+4
-0
spec/support/shared_examples/policies/clusterable_shared_examples.rb
...t/shared_examples/policies/clusterable_shared_examples.rb
+8
-0
No files found.
spec/policies/clusters/instance_policy_spec.rb
View file @
b56f2850
...
...
@@ -9,6 +9,8 @@ describe Clusters::InstancePolicy do
describe
'rules'
do
context
'when user'
do
it
{
expect
(
policy
).
to
be_disallowed
:read_cluster
}
it
{
expect
(
policy
).
to
be_disallowed
:add_cluster
}
it
{
expect
(
policy
).
to
be_disallowed
:create_cluster
}
it
{
expect
(
policy
).
to
be_disallowed
:update_cluster
}
it
{
expect
(
policy
).
to
be_disallowed
:admin_cluster
}
end
...
...
@@ -17,6 +19,8 @@ describe Clusters::InstancePolicy do
let
(
:user
)
{
create
(
:admin
)
}
it
{
expect
(
policy
).
to
be_allowed
:read_cluster
}
it
{
expect
(
policy
).
to
be_allowed
:add_cluster
}
it
{
expect
(
policy
).
to
be_allowed
:create_cluster
}
it
{
expect
(
policy
).
to
be_allowed
:update_cluster
}
it
{
expect
(
policy
).
to
be_allowed
:admin_cluster
}
end
...
...
spec/support/shared_examples/policies/clusterable_shared_examples.rb
View file @
b56f2850
...
...
@@ -13,7 +13,11 @@ shared_examples 'clusterable policies' do
clusterable
.
add_developer
(
current_user
)
end
it
{
expect_disallowed
(
:read_cluster
)
}
it
{
expect_disallowed
(
:add_cluster
)
}
it
{
expect_disallowed
(
:create_cluster
)
}
it
{
expect_disallowed
(
:update_cluster
)
}
it
{
expect_disallowed
(
:admin_cluster
)
}
end
context
'with a maintainer'
do
...
...
@@ -22,7 +26,11 @@ shared_examples 'clusterable policies' do
end
context
'with no clusters'
do
it
{
expect_allowed
(
:read_cluster
)
}
it
{
expect_allowed
(
:add_cluster
)
}
it
{
expect_allowed
(
:create_cluster
)
}
it
{
expect_allowed
(
:update_cluster
)
}
it
{
expect_allowed
(
:admin_cluster
)
}
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