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
bf412929
Commit
bf412929
authored
Jun 27, 2017
by
Douwe Maan
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'dz-refactor-group-members-tests' into 'master'
Refactor group members tests See merge request !12465
parents
92f87f6d
0aa5f089
Changes
10
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
146 additions
and
139 deletions
+146
-139
features/group/members.feature
features/group/members.feature
+0
-59
spec/features/groups/members/last_owner_cannot_leave_group_spec.rb
...ures/groups/members/last_owner_cannot_leave_group_spec.rb
+0
-16
spec/features/groups/members/leave_group_spec.rb
spec/features/groups/members/leave_group_spec.rb
+62
-0
spec/features/groups/members/list_members_spec.rb
spec/features/groups/members/list_members_spec.rb
+42
-0
spec/features/groups/members/manage_access_requests_spec.rb
spec/features/groups/members/manage_access_requests_spec.rb
+3
-3
spec/features/groups/members/manage_members.rb
spec/features/groups/members/manage_members.rb
+30
-22
spec/features/groups/members/member_cannot_request_access_to_his_project_spec.rb
...mbers/member_cannot_request_access_to_his_project_spec.rb
+0
-16
spec/features/groups/members/member_leaves_group_spec.rb
spec/features/groups/members/member_leaves_group_spec.rb
+0
-21
spec/features/groups/members/request_access_spec.rb
spec/features/groups/members/request_access_spec.rb
+8
-1
spec/features/groups/members/sort_members_spec.rb
spec/features/groups/members/sort_members_spec.rb
+1
-1
No files found.
features/group/members.feature
View file @
bf412929
...
@@ -4,65 +4,6 @@ Feature: Group Members
...
@@ -4,65 +4,6 @@ Feature: Group Members
And
"John Doe"
is owner of group
"Owned"
And
"John Doe"
is owner of group
"Owned"
And
"John Doe"
is guest of group
"Guest"
And
"John Doe"
is guest of group
"Guest"
# Leave
@javascript
Scenario
:
Owner should be able to remove himself from group if he is not the last owner
Given
"Mary Jane"
is owner of group
"Owned"
When
I visit group
"Owned"
members page
Then
I should see user
"John Doe"
in team list
Then
I should see user
"Mary Jane"
in team list
When
I click on the
"Remove User From Group"
button for
"John Doe"
And
I visit group
"Owned"
members page
Then
I should not see user
"John Doe"
in team list
Then
I should see user
"Mary Jane"
in team list
@javascript
Scenario
:
Owner should not be able to remove himself from group if he is the last owner
Given
"Mary Jane"
is guest of group
"Owned"
When
I visit group
"Owned"
members page
Then
I should see user
"John Doe"
in team list
Then
I should see user
"Mary Jane"
in team list
Then
I should not see the
"Remove User From Group"
button for
"John Doe"
@javascript
Scenario
:
Guest should be able to remove himself from group
Given
"Mary Jane"
is guest of group
"Guest"
When
I visit group
"Guest"
members page
Then
I should see user
"John Doe"
in team list
Then
I should see user
"Mary Jane"
in team list
When
I click on the
"Remove User From Group"
button for
"John Doe"
When
I visit group
"Guest"
members page
Then
I should not see user
"John Doe"
in team list
Then
I should see user
"Mary Jane"
in team list
@javascript
Scenario
:
Guest should be able to remove himself from group even if he is the only user in the group
When
I visit group
"Guest"
members page
Then
I should see user
"John Doe"
in team list
When
I click on the
"Remove User From Group"
button for
"John Doe"
When
I visit group
"Guest"
members page
Then
I should not see user
"John Doe"
in team list
# Remove others
Scenario
:
Owner should be able to remove other users from group
Given
"Mary Jane"
is owner of group
"Owned"
When
I visit group
"Owned"
members page
Then
I should see user
"John Doe"
in team list
Then
I should see user
"Mary Jane"
in team list
When
I click on the
"Remove User From Group"
button for
"Mary Jane"
When
I visit group
"Owned"
members page
Then
I should see user
"John Doe"
in team list
Then
I should not see user
"Mary Jane"
in team list
Scenario
:
Guest should not be able to remove other users from group
Given
"Mary Jane"
is guest of group
"Guest"
When
I visit group
"Guest"
members page
Then
I should see user
"John Doe"
in team list
Then
I should see user
"Mary Jane"
in team list
Then
I should not see the
"Remove User From Group"
button for
"Mary Jane"
Scenario
:
Search member by name
Scenario
:
Search member by name
Given
"Mary Jane"
is guest of group
"Guest"
Given
"Mary Jane"
is guest of group
"Guest"
And
I visit group
"Guest"
members page
And
I visit group
"Guest"
members page
...
...
spec/features/groups/members/last_owner_cannot_leave_group_spec.rb
deleted
100644 → 0
View file @
92f87f6d
require
'spec_helper'
feature
'Groups > Members > Last owner cannot leave group'
,
feature:
true
do
let
(
:owner
)
{
create
(
:user
)
}
let
(
:group
)
{
create
(
:group
)
}
background
do
group
.
add_owner
(
owner
)
gitlab_sign_in
(
owner
)
visit
group_path
(
group
)
end
scenario
'user does not see a "Leave group" link'
do
expect
(
page
).
not_to
have_content
'Leave group'
end
end
spec/features/groups/members/leave_group_spec.rb
0 → 100644
View file @
bf412929
require
'spec_helper'
feature
'Groups > Members > Leave group'
,
feature:
true
do
let
(
:user
)
{
create
(
:user
)
}
let
(
:other_user
)
{
create
(
:user
)
}
let
(
:group
)
{
create
(
:group
)
}
background
do
gitlab_sign_in
(
user
)
end
scenario
'guest leaves the group'
do
group
.
add_guest
(
user
)
group
.
add_owner
(
other_user
)
visit
group_path
(
group
)
click_link
'Leave group'
expect
(
current_path
).
to
eq
(
dashboard_groups_path
)
expect
(
page
).
to
have_content
left_group_message
(
group
)
expect
(
group
.
users
).
not_to
include
(
user
)
end
scenario
'guest leaves the group as last member'
do
group
.
add_guest
(
user
)
visit
group_path
(
group
)
click_link
'Leave group'
expect
(
current_path
).
to
eq
(
dashboard_groups_path
)
expect
(
page
).
to
have_content
left_group_message
(
group
)
expect
(
group
.
users
).
not_to
include
(
user
)
end
scenario
'owner leaves the group if they is not the last owner'
do
group
.
add_owner
(
user
)
group
.
add_owner
(
other_user
)
visit
group_path
(
group
)
click_link
'Leave group'
expect
(
current_path
).
to
eq
(
dashboard_groups_path
)
expect
(
page
).
to
have_content
left_group_message
(
group
)
expect
(
group
.
users
).
not_to
include
(
user
)
end
scenario
'owner can not leave the group if they is a last owner'
do
group
.
add_owner
(
user
)
visit
group_path
(
group
)
expect
(
page
).
not_to
have_content
'Leave group'
visit
group_group_members_path
(
group
)
expect
(
find
(
:css
,
'.project-members-page li'
,
text:
user
.
name
)).
not_to
have_selector
(
:css
,
'a.btn-remove'
)
end
def
left_group_message
(
group
)
"You left the
\"
#{
group
.
name
}
\"
"
end
end
spec/features/groups/members/list_members_spec.rb
0 → 100644
View file @
bf412929
require
'spec_helper'
feature
'Groups > Members > List members'
,
feature:
true
do
include
Select2Helper
let
(
:user1
)
{
create
(
:user
,
name:
'John Doe'
)
}
let
(
:user2
)
{
create
(
:user
,
name:
'Mary Jane'
)
}
let
(
:group
)
{
create
(
:group
)
}
let
(
:nested_group
)
{
create
(
:group
,
parent:
group
)
}
background
do
gitlab_sign_in
(
user1
)
end
scenario
'show members from current group and parent'
,
:nested_groups
do
group
.
add_developer
(
user1
)
nested_group
.
add_developer
(
user2
)
visit
group_group_members_path
(
nested_group
)
expect
(
first_row
.
text
).
to
include
(
user1
.
name
)
expect
(
second_row
.
text
).
to
include
(
user2
.
name
)
end
scenario
'show user once if member of both current group and parent'
,
:nested_groups
do
group
.
add_developer
(
user1
)
nested_group
.
add_developer
(
user1
)
visit
group_group_members_path
(
nested_group
)
expect
(
first_row
.
text
).
to
include
(
user1
.
name
)
expect
(
second_row
).
to
be_blank
end
def
first_row
page
.
all
(
'ul.content-list > li'
)[
0
]
end
def
second_row
page
.
all
(
'ul.content-list > li'
)[
1
]
end
end
spec/features/groups/members/
owner_manages
_access_requests_spec.rb
→
spec/features/groups/members/
manage
_access_requests_spec.rb
View file @
bf412929
require
'spec_helper'
require
'spec_helper'
feature
'Groups > Members >
Owner manages
access requests'
,
feature:
true
do
feature
'Groups > Members >
Manage
access requests'
,
feature:
true
do
let
(
:user
)
{
create
(
:user
)
}
let
(
:user
)
{
create
(
:user
)
}
let
(
:owner
)
{
create
(
:user
)
}
let
(
:owner
)
{
create
(
:user
)
}
let
(
:group
)
{
create
(
:group
,
:public
,
:access_requestable
)
}
let
(
:group
)
{
create
(
:group
,
:public
,
:access_requestable
)
}
...
@@ -17,7 +17,7 @@ feature 'Groups > Members > Owner manages access requests', feature: true do
...
@@ -17,7 +17,7 @@ feature 'Groups > Members > Owner manages access requests', feature: true do
expect_visible_access_request
(
group
,
user
)
expect_visible_access_request
(
group
,
user
)
end
end
scenario
'
mast
er can grant access'
do
scenario
'
own
er can grant access'
do
visit
group_group_members_path
(
group
)
visit
group_group_members_path
(
group
)
expect_visible_access_request
(
group
,
user
)
expect_visible_access_request
(
group
,
user
)
...
@@ -28,7 +28,7 @@ feature 'Groups > Members > Owner manages access requests', feature: true do
...
@@ -28,7 +28,7 @@ feature 'Groups > Members > Owner manages access requests', feature: true do
expect
(
ActionMailer
::
Base
.
deliveries
.
last
.
subject
).
to
match
"Access to the
#{
group
.
name
}
group was granted"
expect
(
ActionMailer
::
Base
.
deliveries
.
last
.
subject
).
to
match
"Access to the
#{
group
.
name
}
group was granted"
end
end
scenario
'
mast
er can deny access'
do
scenario
'
own
er can deny access'
do
visit
group_group_members_path
(
group
)
visit
group_group_members_path
(
group
)
expect_visible_access_request
(
group
,
user
)
expect_visible_access_request
(
group
,
user
)
...
...
spec/features/groups/members/
list_spec
.rb
→
spec/features/groups/members/
manage_members
.rb
View file @
bf412929
require
'spec_helper'
require
'spec_helper'
feature
'Groups
members list
'
,
feature:
true
do
feature
'Groups
> Members > Manage members
'
,
feature:
true
do
include
Select2Helper
include
Select2Helper
let
(
:user1
)
{
create
(
:user
,
name:
'John Doe'
)
}
let
(
:user1
)
{
create
(
:user
,
name:
'John Doe'
)
}
let
(
:user2
)
{
create
(
:user
,
name:
'Mary Jane'
)
}
let
(
:user2
)
{
create
(
:user
,
name:
'Mary Jane'
)
}
let
(
:group
)
{
create
(
:group
)
}
let
(
:group
)
{
create
(
:group
)
}
let
(
:nested_group
)
{
create
(
:group
,
parent:
group
)
}
background
do
background
do
gitlab_sign_in
(
user1
)
gitlab_sign_in
(
user1
)
end
end
scenario
'show members from current group and parent'
,
:nested_groups
do
group
.
add_developer
(
user1
)
nested_group
.
add_developer
(
user2
)
visit
group_group_members_path
(
nested_group
)
expect
(
first_row
.
text
).
to
include
(
user1
.
name
)
expect
(
second_row
.
text
).
to
include
(
user2
.
name
)
end
scenario
'show user once if member of both current group and parent'
,
:nested_groups
do
group
.
add_developer
(
user1
)
nested_group
.
add_developer
(
user1
)
visit
group_group_members_path
(
nested_group
)
expect
(
first_row
.
text
).
to
include
(
user1
.
name
)
expect
(
second_row
).
to
be_blank
end
scenario
'update user to owner level'
,
:js
do
scenario
'update user to owner level'
,
:js
do
group
.
add_owner
(
user1
)
group
.
add_owner
(
user1
)
group
.
add_developer
(
user2
)
group
.
add_developer
(
user2
)
...
@@ -59,6 +38,18 @@ feature 'Groups members list', feature: true do
...
@@ -59,6 +38,18 @@ feature 'Groups members list', feature: true do
end
end
end
end
scenario
'remove user from group'
,
:js
do
group
.
add_owner
(
user1
)
group
.
add_developer
(
user2
)
visit
group_group_members_path
(
group
)
find
(
:css
,
'.project-members-page li'
,
text:
user2
.
name
).
find
(
:css
,
'a.btn-remove'
).
click
expect
(
page
).
not_to
have_content
(
user2
.
name
)
expect
(
group
.
users
).
not_to
include
(
user2
)
end
scenario
'add yourself to group when already an owner'
,
:js
do
scenario
'add yourself to group when already an owner'
,
:js
do
group
.
add_owner
(
user1
)
group
.
add_owner
(
user1
)
...
@@ -86,6 +77,23 @@ feature 'Groups members list', feature: true do
...
@@ -86,6 +77,23 @@ feature 'Groups members list', feature: true do
end
end
end
end
scenario
'guest can not manage other users'
do
group
.
add_guest
(
user1
)
group
.
add_developer
(
user2
)
visit
group_group_members_path
(
group
)
expect
(
page
).
not_to
have_button
'Add to group'
page
.
within
(
second_row
)
do
# Can not modify user2 role
expect
(
page
).
not_to
have_button
'Developer'
# Can not remove user2
expect
(
page
).
not_to
have_css
(
'a.btn-remove'
)
end
end
def
first_row
def
first_row
page
.
all
(
'ul.content-list > li'
)[
0
]
page
.
all
(
'ul.content-list > li'
)[
0
]
end
end
...
...
spec/features/groups/members/member_cannot_request_access_to_his_project_spec.rb
deleted
100644 → 0
View file @
92f87f6d
require
'spec_helper'
feature
'Groups > Members > Member cannot request access to his project'
,
feature:
true
do
let
(
:member
)
{
create
(
:user
)
}
let
(
:group
)
{
create
(
:group
)
}
background
do
group
.
add_developer
(
member
)
gitlab_sign_in
(
member
)
visit
group_path
(
group
)
end
scenario
'member does not see the request access button'
do
expect
(
page
).
not_to
have_content
'Request Access'
end
end
spec/features/groups/members/member_leaves_group_spec.rb
deleted
100644 → 0
View file @
92f87f6d
require
'spec_helper'
feature
'Groups > Members > Member leaves group'
,
feature:
true
do
let
(
:user
)
{
create
(
:user
)
}
let
(
:owner
)
{
create
(
:user
)
}
let
(
:group
)
{
create
(
:group
,
:public
)
}
background
do
group
.
add_owner
(
owner
)
group
.
add_developer
(
user
)
gitlab_sign_in
(
user
)
visit
group_path
(
group
)
end
scenario
'user leaves group'
do
click_link
'Leave group'
expect
(
current_path
).
to
eq
(
dashboard_groups_path
)
expect
(
group
.
users
.
exists?
(
user
.
id
)).
to
be_falsey
end
end
spec/features/groups/members/
user_requests
_access_spec.rb
→
spec/features/groups/members/
request
_access_spec.rb
View file @
bf412929
require
'spec_helper'
require
'spec_helper'
feature
'Groups > Members >
User requests
access'
,
feature:
true
do
feature
'Groups > Members >
Request
access'
,
feature:
true
do
let
(
:user
)
{
create
(
:user
)
}
let
(
:user
)
{
create
(
:user
)
}
let
(
:owner
)
{
create
(
:user
)
}
let
(
:owner
)
{
create
(
:user
)
}
let
(
:group
)
{
create
(
:group
,
:public
,
:access_requestable
)
}
let
(
:group
)
{
create
(
:group
,
:public
,
:access_requestable
)
}
...
@@ -68,4 +68,11 @@ feature 'Groups > Members > User requests access', feature: true do
...
@@ -68,4 +68,11 @@ feature 'Groups > Members > User requests access', feature: true do
expect
(
group
.
requesters
.
exists?
(
user_id:
user
)).
to
be_falsey
expect
(
group
.
requesters
.
exists?
(
user_id:
user
)).
to
be_falsey
expect
(
page
).
to
have_content
'Your access request to the group has been withdrawn.'
expect
(
page
).
to
have_content
'Your access request to the group has been withdrawn.'
end
end
scenario
'member does not see the request access button'
do
group
.
add_owner
(
user
)
visit
group_path
(
group
)
expect
(
page
).
not_to
have_content
'Request Access'
end
end
end
spec/features/groups/members/sort
ing
_spec.rb
→
spec/features/groups/members/sort
_members
_spec.rb
View file @
bf412929
require
'spec_helper'
require
'spec_helper'
feature
'Groups > Members > Sort
ing
'
,
feature:
true
do
feature
'Groups > Members > Sort
members
'
,
feature:
true
do
let
(
:owner
)
{
create
(
:user
,
name:
'John Doe'
)
}
let
(
:owner
)
{
create
(
:user
,
name:
'John Doe'
)
}
let
(
:developer
)
{
create
(
:user
,
name:
'Mary Jane'
,
last_sign_in_at:
5
.
days
.
ago
)
}
let
(
:developer
)
{
create
(
:user
,
name:
'Mary Jane'
,
last_sign_in_at:
5
.
days
.
ago
)
}
let
(
:group
)
{
create
(
:group
)
}
let
(
:group
)
{
create
(
:group
)
}
...
...
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