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
6b2a3fd2
Commit
6b2a3fd2
authored
Sep 07, 2018
by
Dennis Tang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Move "Invite group and members" spec to ee/spec
parent
466009c5
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
13 additions
and
104 deletions
+13
-104
app/views/projects/project_members/index.html.haml
app/views/projects/project_members/index.html.haml
+3
-3
ee/spec/features/projects/members/invite_group_and_members_spec.rb
...eatures/projects/members/invite_group_and_members_spec.rb
+2
-93
spec/features/projects/members/invite_group_spec.rb
spec/features/projects/members/invite_group_spec.rb
+8
-8
No files found.
app/views/projects/project_members/index.html.haml
View file @
6b2a3fd2
...
...
@@ -20,17 +20,17 @@
-
if
!
membership_locked?
&&
@project
.
allowed_to_share_with_group?
%ul
.nav-links.nav.nav-tabs.gitlab-tabs
{
role:
'tablist'
}
%li
.nav-tab
{
role:
'presentation'
}
%a
.nav-link.active
{
href:
'#invite-member-pane'
,
id:
'invite-member-tab'
,
data:
{
toggle:
'tab'
},
role:
'tab'
}
Add
member
%a
.nav-link.active
{
href:
'#invite-member-pane'
,
id:
'invite-member-tab'
,
data:
{
toggle:
'tab'
},
role:
'tab'
}
Invite
member
%li
.nav-tab
{
role:
'presentation'
,
class:
(
'active'
if
membership_locked?
)
}
%a
.nav-link
{
href:
'#invite-group-pane'
,
id:
'invite-group-tab'
,
data:
{
toggle:
'tab'
},
role:
'tab'
}
Invite group
.tab-content.gitlab-tab-content
.tab-pane.active
{
id:
'invite-member-pane'
,
role:
'tabpanel'
}
=
render
'projects/project_members/new_project_member'
,
tab_title:
'
Add
member'
=
render
'projects/project_members/new_project_member'
,
tab_title:
'
Invite
member'
.tab-pane
{
id:
'invite-group-pane'
,
role:
'tabpanel'
,
class:
(
'active'
if
membership_locked?
)
}
=
render
'projects/project_members/new_project_group'
,
tab_title:
'Invite group'
-
elsif
!
membership_locked?
.invite-member
=
render
'projects/project_members/new_project_member'
,
tab_title:
'
Add
member'
.invite-member
=
render
'projects/project_members/new_project_member'
,
tab_title:
'
Invite
member'
-
elsif
@project
.
allowed_to_share_with_group?
.invite-group
=
render
'projects/project_members/new_project_group'
,
tab_title:
'Invite group'
...
...
spec/features/projects/members/invite_group_and_members_spec.rb
→
ee/
spec/features/projects/members/invite_group_and_members_spec.rb
View file @
6b2a3fd2
require
'spec_helper'
describe
'Project > Members > Invite
Group
'
,
:js
do
describe
'Project > Members > Invite
group and members
'
,
:js
do
include
Select2Helper
include
ActionView
::
Helpers
::
DateHelper
let
(
:maintainer
)
{
create
(
:user
)
}
describe
'
Invit
e group lock'
do
describe
'
Shar
e group lock'
do
shared_examples
'the project cannot be shared with groups'
do
it
'user is only able to share with members'
do
visit
project_settings_members_path
(
project
)
...
...
@@ -189,95 +189,4 @@ describe 'Project > Members > Invite Group', :js do
end
end
end
describe
'setting an expiration date for a group link'
do
let
(
:project
)
{
create
(
:project
)
}
let!
(
:group
)
{
create
(
:group
)
}
around
do
|
example
|
Timecop
.
freeze
{
example
.
run
}
end
before
do
project
.
add_maintainer
(
maintainer
)
sign_in
(
maintainer
)
visit
project_settings_members_path
(
project
)
click_on
'invite-group-tab'
select2
group
.
id
,
from:
'#link_group_id'
fill_in
'expires_at_groups'
,
with:
(
Time
.
now
+
4.5
.
days
).
strftime
(
'%Y-%m-%d'
)
click_on
'invite-group-tab'
find
(
'.btn-create'
).
click
end
it
'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
describe
'the groups dropdown'
do
context
'with multiple groups to choose from'
do
let
(
:project
)
{
create
(
:project
)
}
before
do
project
.
add_maintainer
(
maintainer
)
sign_in
(
maintainer
)
create
(
:group
).
add_owner
(
maintainer
)
create
(
:group
).
add_owner
(
maintainer
)
visit
project_settings_members_path
(
project
)
click_link
'Invite group'
find
(
'.ajax-groups-select.select2-container'
)
execute_script
'GROUP_SELECT_PER_PAGE = 1;'
open_select2
'#link_group_id'
end
it
'should infinitely scroll'
do
expect
(
find
(
'.select2-drop .select2-results'
)).
to
have_selector
(
'.select2-result'
,
count:
1
)
scroll_select2_to_bottom
(
'.select2-drop .select2-results:visible'
)
expect
(
find
(
'.select2-drop .select2-results'
)).
to
have_selector
(
'.select2-result'
,
count:
2
)
end
end
context
'for a project in a nested group'
do
let
(
:group
)
{
create
(
:group
)
}
let!
(
:nested_group
)
{
create
(
:group
,
parent:
group
)
}
let!
(
:group_to_share_with
)
{
create
(
:group
)
}
let!
(
:project
)
{
create
(
:project
,
namespace:
nested_group
)
}
before
do
project
.
add_maintainer
(
maintainer
)
sign_in
(
maintainer
)
group
.
add_maintainer
(
maintainer
)
group_to_share_with
.
add_maintainer
(
maintainer
)
end
it
'the groups dropdown does not show ancestors'
,
:nested_groups
do
visit
project_settings_members_path
(
project
)
click_on
'invite-group-tab'
click_link
'Search for a group'
page
.
within
'.select2-drop'
do
expect
(
page
).
to
have_content
(
group_to_share_with
.
name
)
expect
(
page
).
not_to
have_content
(
group
.
name
)
end
end
end
end
end
spec/features/projects/members/invite_group_spec.rb
View file @
6b2a3fd2
...
...
@@ -30,7 +30,7 @@ describe 'Project > Members > Invite group', :js do
sign_in
(
maintainer
)
end
context
'when the group has "
Invit
e group lock" disabled'
do
context
'when the group has "
Shar
e group lock" disabled'
do
it_behaves_like
'the project can be shared with groups'
it
'the project can be shared with another group'
do
...
...
@@ -48,7 +48,7 @@ describe 'Project > Members > Invite group', :js do
end
end
context
'when the group has "
Invit
e group lock" enabled'
do
context
'when the group has "
Shar
e group lock" enabled'
do
before
do
project
.
namespace
.
update_column
(
:share_with_group_lock
,
true
)
end
...
...
@@ -68,12 +68,12 @@ describe 'Project > Members > Invite group', :js do
sign_in
(
maintainer
)
end
context
'when the root_group has "
Invit
e group lock" disabled'
do
context
'when the subgroup has "
Invit
e group lock" disabled'
do
context
'when the root_group has "
Shar
e group lock" disabled'
do
context
'when the subgroup has "
Shar
e group lock" disabled'
do
it_behaves_like
'the project can be shared with groups'
end
context
'when the subgroup has "
Invit
e group lock" enabled'
do
context
'when the subgroup has "
Shar
e group lock" enabled'
do
before
do
subgroup
.
update_column
(
:share_with_group_lock
,
true
)
end
...
...
@@ -82,16 +82,16 @@ describe 'Project > Members > Invite group', :js do
end
end
context
'when the root_group has "
Invit
e group lock" enabled'
do
context
'when the root_group has "
Shar
e group lock" enabled'
do
before
do
root_group
.
update_column
(
:share_with_group_lock
,
true
)
end
context
'when the subgroup has "
Invit
e group lock" disabled (parent overridden)'
do
context
'when the subgroup has "
Shar
e group lock" disabled (parent overridden)'
do
it_behaves_like
'the project can be shared with groups'
end
context
'when the subgroup has "
Invit
e group lock" enabled'
do
context
'when the subgroup has "
Shar
e group lock" enabled'
do
before
do
subgroup
.
update_column
(
:share_with_group_lock
,
true
)
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