2014-02-07 11:59:55 -05:00
|
|
|
module SharedGroup
|
|
|
|
include Spinach::DSL
|
|
|
|
|
2015-12-01 16:45:58 -05:00
|
|
|
step 'current user is developer of group "Owned"' do
|
|
|
|
is_member_of(current_user.name, "Owned", Gitlab::Access::DEVELOPER)
|
|
|
|
end
|
|
|
|
|
2014-02-07 11:59:55 -05:00
|
|
|
step '"John Doe" is owner of group "Owned"' do
|
|
|
|
is_member_of("John Doe", "Owned", Gitlab::Access::OWNER)
|
|
|
|
end
|
|
|
|
|
|
|
|
step '"John Doe" is guest of group "Guest"' do
|
|
|
|
is_member_of("John Doe", "Guest", Gitlab::Access::GUEST)
|
|
|
|
end
|
|
|
|
|
|
|
|
step '"Mary Jane" is owner of group "Owned"' do
|
|
|
|
is_member_of("Mary Jane", "Owned", Gitlab::Access::OWNER)
|
|
|
|
end
|
|
|
|
|
|
|
|
step '"Mary Jane" is guest of group "Owned"' do
|
|
|
|
is_member_of("Mary Jane", "Owned", Gitlab::Access::GUEST)
|
|
|
|
end
|
|
|
|
|
|
|
|
step '"Mary Jane" is guest of group "Guest"' do
|
|
|
|
is_member_of("Mary Jane", "Guest", Gitlab::Access::GUEST)
|
|
|
|
end
|
|
|
|
|
2014-07-11 12:29:51 -04:00
|
|
|
step 'I should see group "TestGroup"' do
|
2015-06-12 00:44:13 -04:00
|
|
|
expect(page).to have_content "TestGroup"
|
2014-07-11 12:29:51 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
step 'I should not see group "TestGroup"' do
|
2015-06-12 00:44:13 -04:00
|
|
|
expect(page).not_to have_content "TestGroup"
|
2014-07-11 12:29:51 -04:00
|
|
|
end
|
|
|
|
|
2014-02-07 11:59:55 -05:00
|
|
|
protected
|
|
|
|
|
|
|
|
def is_member_of(username, groupname, role)
|
|
|
|
@project_count ||= 0
|
|
|
|
user = User.find_by(name: username) || create(:user, name: username)
|
|
|
|
group = Group.find_by(name: groupname) || create(:group, name: groupname)
|
|
|
|
group.add_user(user, role)
|
2017-01-16 23:09:57 -05:00
|
|
|
project ||= create(:project, :repository, namespace: group, path: "project#{@project_count}")
|
2015-10-03 20:59:54 -04:00
|
|
|
create(:closed_issue_event, project: project)
|
2014-02-07 11:59:55 -05:00
|
|
|
project.team << [user, :master]
|
|
|
|
@project_count += 1
|
|
|
|
end
|
2015-11-25 05:44:39 -05:00
|
|
|
|
|
|
|
def owned_group
|
|
|
|
@owned_group ||= Group.find_by(name: "Owned")
|
|
|
|
end
|
2014-02-07 11:59:55 -05:00
|
|
|
end
|