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
Jérome Perrin
gitlab-ce
Commits
af6cf695
Commit
af6cf695
authored
Oct 28, 2016
by
Sean McGivern
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add specs for a user from a group link
parent
db9979bc
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
30 additions
and
0 deletions
+30
-0
spec/policies/issues_policy_spec.rb
spec/policies/issues_policy_spec.rb
+30
-0
No files found.
spec/policies/issues_policy_spec.rb
View file @
af6cf695
...
...
@@ -5,6 +5,8 @@ describe IssuePolicy, models: true do
let
(
:author
)
{
create
(
:user
)
}
let
(
:assignee
)
{
create
(
:user
)
}
let
(
:reporter
)
{
create
(
:user
)
}
let
(
:group
)
{
create
(
:group
,
:public
)
}
let
(
:reporter_from_group_link
)
{
create
(
:user
)
}
def
permissions
(
user
,
issue
)
IssuePolicy
.
abilities
(
user
,
issue
).
to_set
...
...
@@ -21,6 +23,10 @@ describe IssuePolicy, models: true do
project
.
team
<<
[
author
,
:guest
]
project
.
team
<<
[
assignee
,
:guest
]
project
.
team
<<
[
reporter
,
:reporter
]
group
.
add_reporter
(
reporter_from_group_link
)
create
(
:project_group_link
,
group:
group
,
project:
project
)
end
it
'does not allow non-members to read issues'
do
...
...
@@ -41,6 +47,11 @@ describe IssuePolicy, models: true do
expect
(
permissions
(
reporter
,
issue_no_assignee
)).
to
include
(
:read_issue
,
:update_issue
,
:admin_issue
)
end
it
'allows reporters from group links to read, update, and admin issues'
do
expect
(
permissions
(
reporter_from_group_link
,
issue
)).
to
include
(
:read_issue
,
:update_issue
,
:admin_issue
)
expect
(
permissions
(
reporter_from_group_link
,
issue_no_assignee
)).
to
include
(
:read_issue
,
:update_issue
,
:admin_issue
)
end
it
'allows issue authors to read and update their issues'
do
expect
(
permissions
(
author
,
issue
)).
to
include
(
:read_issue
,
:update_issue
)
expect
(
permissions
(
author
,
issue
)).
not_to
include
(
:admin_issue
)
...
...
@@ -76,6 +87,11 @@ describe IssuePolicy, models: true do
expect
(
permissions
(
reporter
,
confidential_issue_no_assignee
)).
to
include
(
:read_issue
,
:update_issue
,
:admin_issue
)
end
it
'allows reporters from group links to read, update, and admin confidential issues'
do
expect
(
permissions
(
reporter_from_group_link
,
confidential_issue
)).
to
include
(
:read_issue
,
:update_issue
,
:admin_issue
)
expect
(
permissions
(
reporter_from_group_link
,
confidential_issue_no_assignee
)).
to
include
(
:read_issue
,
:update_issue
,
:admin_issue
)
end
it
'allows issue authors to read and update their confidential issues'
do
expect
(
permissions
(
author
,
confidential_issue
)).
to
include
(
:read_issue
,
:update_issue
)
expect
(
permissions
(
author
,
confidential_issue
)).
not_to
include
(
:admin_issue
)
...
...
@@ -100,6 +116,10 @@ describe IssuePolicy, models: true do
before
do
project
.
team
<<
[
guest
,
:guest
]
project
.
team
<<
[
reporter
,
:reporter
]
group
.
add_reporter
(
reporter_from_group_link
)
create
(
:project_group_link
,
group:
group
,
project:
project
)
end
it
'allows guests to read issues'
do
...
...
@@ -115,6 +135,11 @@ describe IssuePolicy, models: true do
expect
(
permissions
(
reporter
,
issue_no_assignee
)).
to
include
(
:read_issue
,
:update_issue
,
:admin_issue
)
end
it
'allows reporters from group links to read, update, and admin issues'
do
expect
(
permissions
(
reporter_from_group_link
,
issue
)).
to
include
(
:read_issue
,
:update_issue
,
:admin_issue
)
expect
(
permissions
(
reporter_from_group_link
,
issue_no_assignee
)).
to
include
(
:read_issue
,
:update_issue
,
:admin_issue
)
end
it
'allows issue authors to read and update their issues'
do
expect
(
permissions
(
author
,
issue
)).
to
include
(
:read_issue
,
:update_issue
)
expect
(
permissions
(
author
,
issue
)).
not_to
include
(
:admin_issue
)
...
...
@@ -145,6 +170,11 @@ describe IssuePolicy, models: true do
expect
(
permissions
(
reporter
,
confidential_issue_no_assignee
)).
to
include
(
:read_issue
,
:update_issue
,
:admin_issue
)
end
it
'allows reporter from group links to read, update, and admin confidential issues'
do
expect
(
permissions
(
reporter_from_group_link
,
confidential_issue
)).
to
include
(
:read_issue
,
:update_issue
,
:admin_issue
)
expect
(
permissions
(
reporter_from_group_link
,
confidential_issue_no_assignee
)).
to
include
(
:read_issue
,
:update_issue
,
:admin_issue
)
end
it
'allows issue authors to read and update their confidential issues'
do
expect
(
permissions
(
author
,
confidential_issue
)).
to
include
(
:read_issue
,
:update_issue
)
expect
(
permissions
(
author
,
confidential_issue
)).
not_to
include
(
:admin_issue
)
...
...
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