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
Boxiang Sun
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
Hide 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
...
@@ -21,6 +21,11 @@ Feature: Admin Groups
When
I select user
"John Doe"
from user list as
"Reporter"
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"
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
@javascript
Scenario
:
Remove user from group
Scenario
:
Remove user from group
Given
we have user
"John Doe"
in 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
...
@@ -39,3 +39,8 @@ Feature: Project Team Management
And
I click link
"Import team from another project"
And
I click link
"Import team from another project"
And
I submit
"Website"
project for import team
And
I submit
"Website"
project for import team
Then
I should see
"Mike"
in team list as
"Reporter"
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
...
@@ -73,6 +73,21 @@ class Spinach::Features::AdminGroups < Spinach::FeatureSteps
end
end
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
step
'we have user "John Doe" in group'
do
current_group
.
add_reporter
(
user_john
)
current_group
.
add_reporter
(
user_john
)
end
end
...
@@ -123,6 +138,10 @@ class Spinach::Features::AdminGroups < Spinach::FeatureSteps
...
@@ -123,6 +138,10 @@ class Spinach::Features::AdminGroups < Spinach::FeatureSteps
@group
||=
Group
.
first
@group
||=
Group
.
first
end
end
def
shared_project
@shared_project
||=
create
(
:empty_project
)
end
def
user_john
def
user_john
@user_john
||=
User
.
find_by
(
name:
"John Doe"
)
@user_john
||=
User
.
find_by
(
name:
"John Doe"
)
end
end
...
...
features/steps/project/team_management.rb
View file @
55ceda12
...
@@ -123,4 +123,23 @@ class Spinach::Features::ProjectTeamManagement < Spinach::FeatureSteps
...
@@ -123,4 +123,23 @@ class Spinach::Features::ProjectTeamManagement < Spinach::FeatureSteps
click_link
(
'Remove user from team'
)
click_link
(
'Remove user from team'
)
end
end
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
end
spec/finders/projects_finder_spec.rb
View file @
55ceda12
...
@@ -17,6 +17,10 @@ describe ProjectsFinder do
...
@@ -17,6 +17,10 @@ describe ProjectsFinder do
create
(
:project
,
:public
,
group:
group
,
name:
'C'
,
path:
'C'
)
create
(
:project
,
:public
,
group:
group
,
name:
'C'
,
path:
'C'
)
end
end
let!
(
:shared_project
)
do
create
(
:project
,
:private
,
name:
'D'
,
path:
'D'
)
end
let
(
:finder
)
{
described_class
.
new
}
let
(
:finder
)
{
described_class
.
new
}
describe
'without a group'
do
describe
'without a group'
do
...
@@ -56,7 +60,35 @@ describe ProjectsFinder do
...
@@ -56,7 +60,35 @@ describe ProjectsFinder do
describe
'with a user'
do
describe
'with a user'
do
subject
{
finder
.
execute
(
user
,
group:
group
)
}
subject
{
finder
.
execute
(
user
,
group:
group
)
}
it
{
is_expected
.
to
eq
([
public_project
,
internal_project
])
}
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
end
end
...
...
spec/models/project_team_spec.rb
View file @
55ceda12
...
@@ -67,6 +67,50 @@ describe ProjectTeam, models: true do
...
@@ -67,6 +67,50 @@ describe ProjectTeam, models: true do
end
end
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
describe
"#human_max_access"
do
it
'returns Master role'
do
it
'returns Master role'
do
user
=
create
(
:user
)
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