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
2d1e2da1
Commit
2d1e2da1
authored
May 22, 2018
by
Lin Jen-Shin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Unify spec/features/projects/members/member_leaves_project_spec.rb
parent
c96f4b96
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
30 additions
and
18 deletions
+30
-18
ee/spec/features/projects/members/member_leaves_project_spec.rb
...c/features/projects/members/member_leaves_project_spec.rb
+30
-0
spec/features/projects/members/member_leaves_project_spec.rb
spec/features/projects/members/member_leaves_project_spec.rb
+0
-18
No files found.
ee/spec/features/projects/members/member_leaves_project_spec.rb
0 → 100644
View file @
2d1e2da1
require
'spec_helper'
feature
'Projects > Members > Member leaves project'
do
let
(
:user
)
{
create
(
:user
)
}
let
(
:project
)
{
create
(
:project
,
:repository
)
}
background
do
project
.
add_developer
(
user
)
sign_in
(
user
)
visit
project_path
(
project
)
end
context
'when the user has been specifically allowed to access a protected branch'
do
let
(
:other_user
)
{
create
(
:user
)
}
let!
(
:matching_protected_branch
)
{
create
(
:protected_branch
,
authorize_user_to_push:
user
,
authorize_user_to_merge:
user
,
project:
project
)
}
let!
(
:non_matching_protected_branch
)
{
create
(
:protected_branch
,
authorize_user_to_push:
other_user
,
authorize_user_to_merge:
other_user
,
project:
project
)
}
context
'user leaves project'
do
scenario
"removes the user's branch permissions"
do
click_link
'Leave project'
expect
(
current_path
).
to
eq
(
dashboard_projects_path
)
expect
(
matching_protected_branch
.
push_access_levels
.
where
(
user:
user
)).
not_to
exist
expect
(
matching_protected_branch
.
merge_access_levels
.
where
(
user:
user
)).
not_to
exist
expect
(
non_matching_protected_branch
.
push_access_levels
.
where
(
user:
other_user
)).
to
exist
expect
(
non_matching_protected_branch
.
merge_access_levels
.
where
(
user:
other_user
)).
to
exist
end
end
end
end
spec/features/projects/members/member_leaves_project_spec.rb
View file @
2d1e2da1
...
...
@@ -16,22 +16,4 @@ feature 'Projects > Members > Member leaves project' do
expect
(
current_path
).
to
eq
(
dashboard_projects_path
)
expect
(
project
.
users
.
exists?
(
user
.
id
)).
to
be_falsey
end
context
'when the user has been specifically allowed to access a protected branch'
do
let
(
:other_user
)
{
create
(
:user
)
}
let!
(
:matching_protected_branch
)
{
create
(
:protected_branch
,
authorize_user_to_push:
user
,
authorize_user_to_merge:
user
,
project:
project
)
}
let!
(
:non_matching_protected_branch
)
{
create
(
:protected_branch
,
authorize_user_to_push:
other_user
,
authorize_user_to_merge:
other_user
,
project:
project
)
}
context
'user leaves project'
do
scenario
"removes the user's branch permissions"
do
click_link
'Leave project'
expect
(
current_path
).
to
eq
(
dashboard_projects_path
)
expect
(
matching_protected_branch
.
push_access_levels
.
where
(
user:
user
)).
not_to
exist
expect
(
matching_protected_branch
.
merge_access_levels
.
where
(
user:
user
)).
not_to
exist
expect
(
non_matching_protected_branch
.
push_access_levels
.
where
(
user:
other_user
)).
to
exist
expect
(
non_matching_protected_branch
.
merge_access_levels
.
where
(
user:
other_user
)).
to
exist
end
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