gitlab-org--gitlab-foss/features/steps/shared/group.rb
dreis 1da2262efd Added public groups area to enhance searching and exploring of projects
fixed whitespaces and quotes

fixed whitespaces

fixed devise.html.haml

fixed method parenthesis in app/models/group.rb

removed links from header

removed links from devise.html

added tests
2014-07-15 08:19:27 +02:00

44 lines
1.3 KiB
Ruby

module SharedGroup
include Spinach::DSL
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
step 'I should see group "TestGroup"' do
page.should have_content "TestGroup"
end
step 'I should not see group "TestGroup"' do
page.should_not have_content "TestGroup"
end
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)
project ||= create(:project, namespace: group, path: "project#{@project_count}")
event ||= create(:closed_issue_event, project: project)
project.team << [user, :master]
@project_count += 1
end
end