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
Tatuya Kamada
gitlab-ce
Commits
55ceda12
Commit
55ceda12
authored
Mar 12, 2016
by
Dmitriy Zaporozhets
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Bring shared project feature tests from EE
Signed-off-by:
Dmitriy Zaporozhets
<
dmitriy.zaporozhets@gmail.com
>
parent
9a95b155
Changes
6
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
125 additions
and
1 deletion
+125
-1
features/admin/groups.feature
features/admin/groups.feature
+5
-0
features/project/team_management.feature
features/project/team_management.feature
+5
-0
features/steps/admin/groups.rb
features/steps/admin/groups.rb
+19
-0
features/steps/project/team_management.rb
features/steps/project/team_management.rb
+19
-0
spec/finders/projects_finder_spec.rb
spec/finders/projects_finder_spec.rb
+33
-1
spec/models/project_team_spec.rb
spec/models/project_team_spec.rb
+44
-0
No files found.
features/admin/groups.feature
View file @
55ceda12
...
...
@@ -21,6 +21,11 @@ Feature: Admin Groups
When
I select user
"John Doe"
from user list as
"Reporter"
Then
I should see
"John Doe"
in team list in every project as
"Reporter"
Scenario
:
Shared projects
Given
group has shared projects
When
I visit group page
Then
I should see project shared with group
@javascript
Scenario
:
Remove user from group
Given
we have user
"John Doe"
in group
...
...
features/project/team_management.feature
View file @
55ceda12
...
...
@@ -39,3 +39,8 @@ Feature: Project Team Management
And
I click link
"Import team from another project"
And
I submit
"Website"
project for import team
Then
I should see
"Mike"
in team list as
"Reporter"
Scenario
:
See all members of projects shared group
Given
I share project with group
"OpenSource"
And
I visit project
"Shop"
team page
Then
I should see
"Opensource"
group user listing
features/steps/admin/groups.rb
View file @
55ceda12
...
...
@@ -73,6 +73,21 @@ class Spinach::Features::AdminGroups < Spinach::FeatureSteps
end
end
step
'group has shared projects'
do
share_link
=
shared_project
.
project_group_links
.
new
(
group_access:
Gitlab
::
Access
::
MASTER
)
share_link
.
group_id
=
current_group
.
id
share_link
.
save!
end
step
'I visit group page'
do
visit
admin_group_path
(
current_group
)
end
step
'I should see project shared with group'
do
expect
(
page
).
to
have_content
(
shared_project
.
name_with_namespace
)
expect
(
page
).
to
have_content
"Projects shared with"
end
step
'we have user "John Doe" in group'
do
current_group
.
add_reporter
(
user_john
)
end
...
...
@@ -123,6 +138,10 @@ class Spinach::Features::AdminGroups < Spinach::FeatureSteps
@group
||=
Group
.
first
end
def
shared_project
@shared_project
||=
create
(
:empty_project
)
end
def
user_john
@user_john
||=
User
.
find_by
(
name:
"John Doe"
)
end
...
...
features/steps/project/team_management.rb
View file @
55ceda12
...
...
@@ -123,4 +123,23 @@ class Spinach::Features::ProjectTeamManagement < Spinach::FeatureSteps
click_link
(
'Remove user from team'
)
end
end
step
'I share project with group "OpenSource"'
do
project
=
Project
.
find_by
(
name:
'Shop'
)
os_group
=
create
(
:group
,
name:
'OpenSource'
)
create
(
:project
,
group:
os_group
)
@os_user1
=
create
(
:user
)
@os_user2
=
create
(
:user
)
os_group
.
add_owner
(
@os_user1
)
os_group
.
add_user
(
@os_user2
,
Gitlab
::
Access
::
DEVELOPER
)
share_link
=
project
.
project_group_links
.
new
(
group_access:
Gitlab
::
Access
::
MASTER
)
share_link
.
group_id
=
os_group
.
id
share_link
.
save!
end
step
'I should see "Opensource" group user listing'
do
expect
(
page
).
to
have_content
(
"Shared with OpenSource group, members with Master role (2)"
)
expect
(
page
).
to
have_content
(
@os_user1
.
name
)
expect
(
page
).
to
have_content
(
@os_user2
.
name
)
end
end
spec/finders/projects_finder_spec.rb
View file @
55ceda12
...
...
@@ -17,6 +17,10 @@ describe ProjectsFinder do
create
(
:project
,
:public
,
group:
group
,
name:
'C'
,
path:
'C'
)
end
let!
(
:shared_project
)
do
create
(
:project
,
:private
,
name:
'D'
,
path:
'D'
)
end
let
(
:finder
)
{
described_class
.
new
}
describe
'without a group'
do
...
...
@@ -56,8 +60,36 @@ describe ProjectsFinder do
describe
'with a user'
do
subject
{
finder
.
execute
(
user
,
group:
group
)
}
describe
'without shared projects'
do
it
{
is_expected
.
to
eq
([
public_project
,
internal_project
])
}
end
describe
'with shared projects and group membership'
do
before
do
group
.
add_user
(
user
,
Gitlab
::
Access
::
DEVELOPER
)
shared_project
.
project_group_links
.
create
(
group_access:
Gitlab
::
Access
::
MASTER
,
group:
group
)
end
it
do
is_expected
.
to
eq
([
shared_project
,
public_project
,
internal_project
])
end
end
describe
'with shared projects and project membership'
do
before
do
shared_project
.
team
.
add_user
(
user
,
Gitlab
::
Access
::
DEVELOPER
)
shared_project
.
project_group_links
.
create
(
group_access:
Gitlab
::
Access
::
MASTER
,
group:
group
)
end
it
do
is_expected
.
to
eq
([
shared_project
,
public_project
,
internal_project
])
end
end
end
end
end
end
spec/models/project_team_spec.rb
View file @
55ceda12
...
...
@@ -67,6 +67,50 @@ describe ProjectTeam, models: true do
end
end
describe
:max_invited_level
do
let
(
:group
)
{
create
(
:group
)
}
let
(
:project
)
{
create
(
:empty_project
)
}
before
do
project
.
project_group_links
.
create
(
group:
group
,
group_access:
Gitlab
::
Access
::
DEVELOPER
)
group
.
add_user
(
master
,
Gitlab
::
Access
::
MASTER
)
group
.
add_user
(
reporter
,
Gitlab
::
Access
::
REPORTER
)
end
it
{
expect
(
project
.
team
.
max_invited_level
(
master
.
id
)).
to
eq
(
Gitlab
::
Access
::
DEVELOPER
)
}
it
{
expect
(
project
.
team
.
max_invited_level
(
reporter
.
id
)).
to
eq
(
Gitlab
::
Access
::
REPORTER
)
}
it
{
expect
(
project
.
team
.
max_invited_level
(
nonmember
.
id
)).
to
be_nil
}
end
describe
:max_member_access
do
let
(
:group
)
{
create
(
:group
)
}
let
(
:project
)
{
create
(
:empty_project
)
}
before
do
project
.
project_group_links
.
create
(
group:
group
,
group_access:
Gitlab
::
Access
::
DEVELOPER
)
group
.
add_user
(
master
,
Gitlab
::
Access
::
MASTER
)
group
.
add_user
(
reporter
,
Gitlab
::
Access
::
REPORTER
)
end
it
{
expect
(
project
.
team
.
max_member_access
(
master
.
id
)).
to
eq
(
Gitlab
::
Access
::
DEVELOPER
)
}
it
{
expect
(
project
.
team
.
max_member_access
(
reporter
.
id
)).
to
eq
(
Gitlab
::
Access
::
REPORTER
)
}
it
{
expect
(
project
.
team
.
max_member_access
(
nonmember
.
id
)).
to
be_nil
}
it
"does not have an access"
do
project
.
namespace
.
update
(
share_with_group_lock:
true
)
expect
(
project
.
team
.
max_member_access
(
master
.
id
)).
to
be_nil
expect
(
project
.
team
.
max_member_access
(
reporter
.
id
)).
to
be_nil
end
end
describe
"#human_max_access"
do
it
'returns Master role'
do
user
=
create
(
:user
)
...
...
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