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
a1a4754b
Commit
a1a4754b
authored
Aug 31, 2017
by
Michael Kozono
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add pre-nested group share lock tests
parent
5e1b7e4f
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
102 additions
and
40 deletions
+102
-40
spec/features/projects/members/share_with_group_spec.rb
spec/features/projects/members/share_with_group_spec.rb
+102
-40
No files found.
spec/features/projects/members/share_with_group_spec.rb
View file @
a1a4754b
...
@@ -2,61 +2,95 @@ require 'spec_helper'
...
@@ -2,61 +2,95 @@ require 'spec_helper'
feature
'Project > Members > Share with Group'
,
:js
do
feature
'Project > Members > Share with Group'
,
:js
do
include
Select2Helper
include
Select2Helper
include
ActionView
::
Helpers
::
DateHelper
describe
'Share Lock'
do
let
(
:master
)
{
create
(
:user
)
}
let
(
:master
)
{
create
(
:user
)
}
let
(
:project
)
{
create
(
:project
)
}
let
(
:group
)
{
create
(
:group
)
}
let!
(
:group
)
{
create
(
:group
)
}
let!
(
:other_group
)
{
create
(
:group
)
}
let
(
:project
)
{
create
(
:project
,
namespace:
group
)
}
background
do
background
do
project
.
add_master
(
master
)
project
.
add_master
(
master
)
sign_in
(
master
)
sign_in
(
master
)
end
end
context
'after setting an expiration date for a group link
'
do
context
'when the group does not have "Share lock" enabled
'
do
before
do
before
do
visit
project_settings_members_path
(
project
)
visit
project_settings_members_path
(
project
)
click_on
'share-with-group-tab'
click_on
'share-with-group-tab'
select2
group
.
id
,
from:
'#link_group_id'
select2
other_group
.
id
,
from:
'#link_group_id'
fill_in
'expires_at_groups'
,
with:
(
Time
.
current
+
4.5
.
days
).
strftime
(
'%Y-%m-%d'
)
page
.
find
(
'body'
).
click
page
.
find
(
'body'
).
click
find
(
'.btn-create'
).
trigger
(
'click'
)
find
(
'.btn-create'
).
trigger
(
'click'
)
end
end
scenario
'the group link shows the expiration time with a warning class
'
do
scenario
'the group link appears in the existing groups list
'
do
page
.
within
(
'.project-members-groups'
)
do
page
.
within
(
'.project-members-groups'
)
do
expect
(
page
).
to
have_content
(
'Expires in 4 days'
)
expect
(
page
).
to
have_content
(
other_group
.
name
)
expect
(
page
).
to
have_selector
(
'.text-warning'
)
end
end
end
end
end
end
context
'for a project in a nested group'
do
context
'when the group has "Share lock" enabled'
do
let!
(
:nested_group
)
{
create
(
:group
,
parent:
group
)
}
before
do
let!
(
:another_group
)
{
create
(
:group
)
}
group
.
update_column
(
:share_with_group_lock
,
true
)
let!
(
:project
)
{
create
(
:project
,
namespace:
nested_group
)
}
visit
project_settings_members_path
(
project
)
end
background
do
scenario
'the "Share with group" tab does not exist'
do
group
.
add_master
(
master
)
expect
(
page
).
to
have_selector
(
'#add-member-tab'
)
another_group
.
add_master
(
master
)
expect
(
page
).
not_to
have_selector
(
'#share-with-group-tab'
)
end
end
end
end
scenario
'the groups dropdown does not show ancestors'
,
:nested_groups
do
describe
'setting an expiration date for a group link'
do
let
(
:master
)
{
create
(
:user
)
}
let
(
:project
)
{
create
(
:project
)
}
let!
(
:group
)
{
create
(
:group
)
}
around
do
|
example
|
Timecop
.
freeze
{
example
.
run
}
end
before
do
project
.
add_master
(
master
)
sign_in
(
master
)
visit
project_settings_members_path
(
project
)
visit
project_settings_members_path
(
project
)
click_on
'share-with-group-tab'
click_on
'share-with-group-tab'
click_link
'Search for a group'
page
.
within
'.select2-drop'
do
select2
group
.
id
,
from:
'#link_group_id'
expect
(
page
).
to
have_content
(
another_group
.
name
)
expect
(
page
).
not_to
have_content
(
group
.
name
)
fill_in
'expires_at_groups'
,
with:
(
Time
.
now
+
4.5
.
days
).
strftime
(
'%Y-%m-%d'
)
page
.
find
(
'body'
).
click
find
(
'.btn-create'
).
trigger
(
'click'
)
end
scenario
'the group link shows the expiration time with a warning class'
do
page
.
within
(
'.project-members-groups'
)
do
# Using distance_of_time_in_words_to_now because it is not the same as
# subtraction, and this way avoids time zone issues as well
expires_in_text
=
distance_of_time_in_words_to_now
(
project
.
project_group_links
.
first
.
expires_at
)
expect
(
page
).
to
have_content
(
expires_in_text
)
expect
(
page
).
to
have_selector
(
'.text-warning'
)
end
end
end
end
end
end
describe
'the groups dropdown'
do
describe
'the groups dropdown'
do
before
do
context
'with multiple groups to choose from'
do
let
(
:master
)
{
create
(
:user
)
}
let
(
:project
)
{
create
(
:project
)
}
let
(
:group
)
{
create
(
:group
)
}
background
do
project
.
add_master
(
master
)
sign_in
(
master
)
group_two
=
create
(
:group
)
group_two
=
create
(
:group
)
group
.
add_owner
(
master
)
group
.
add_owner
(
master
)
group_two
.
add_owner
(
master
)
group_two
.
add_owner
(
master
)
...
@@ -74,4 +108,32 @@ feature 'Project > Members > Share with Group', :js do
...
@@ -74,4 +108,32 @@ feature 'Project > Members > Share with Group', :js do
expect
(
find
(
'.select2-drop .select2-results'
)).
to
have_selector
(
'.select2-result'
,
count:
2
)
expect
(
find
(
'.select2-drop .select2-results'
)).
to
have_selector
(
'.select2-result'
,
count:
2
)
end
end
end
end
context
'for a project in a nested group'
do
let
(
:master
)
{
create
(
:user
)
}
let
(
:group
)
{
create
(
:group
)
}
let!
(
:nested_group
)
{
create
(
:group
,
parent:
group
)
}
let!
(
:another_group
)
{
create
(
:group
)
}
let!
(
:project
)
{
create
(
:project
,
namespace:
nested_group
)
}
background
do
project
.
add_master
(
master
)
sign_in
(
master
)
group
.
add_master
(
master
)
another_group
.
add_master
(
master
)
end
scenario
'the groups dropdown does not show ancestors'
,
:nested_groups
do
visit
project_settings_members_path
(
project
)
click_on
'share-with-group-tab'
click_link
'Search for a group'
page
.
within
'.select2-drop'
do
expect
(
page
).
to
have_content
(
another_group
.
name
)
expect
(
page
).
not_to
have_content
(
group
.
name
)
end
end
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