2014-10-02 12:42:54 -04:00
|
|
|
class Spinach::Features::ExploreGroups < Spinach::FeatureSteps
|
2014-02-13 15:45:51 -05:00
|
|
|
include SharedAuthentication
|
|
|
|
include SharedPaths
|
|
|
|
include SharedGroup
|
|
|
|
include SharedProject
|
|
|
|
|
|
|
|
step 'group "TestGroup" has private project "Enterprise"' do
|
|
|
|
group_has_project("TestGroup", "Enterprise", Gitlab::VisibilityLevel::PRIVATE)
|
|
|
|
end
|
|
|
|
|
|
|
|
step 'group "TestGroup" has internal project "Internal"' do
|
|
|
|
group_has_project("TestGroup", "Internal", Gitlab::VisibilityLevel::INTERNAL)
|
|
|
|
end
|
|
|
|
|
|
|
|
step 'group "TestGroup" has public project "Community"' do
|
|
|
|
group_has_project("TestGroup", "Community", Gitlab::VisibilityLevel::PUBLIC)
|
|
|
|
end
|
2014-07-23 05:18:51 -04:00
|
|
|
|
2014-02-13 15:45:51 -05:00
|
|
|
step '"John Doe" is owner of group "TestGroup"' do
|
|
|
|
group = Group.find_by(name: "TestGroup") || create(:group, name: "TestGroup")
|
|
|
|
user = create(:user, name: "John Doe")
|
2015-08-07 00:20:02 -04:00
|
|
|
group.add_owner(user)
|
2014-02-13 15:45:51 -05:00
|
|
|
end
|
|
|
|
|
|
|
|
step 'I visit group "TestGroup" page' do
|
|
|
|
visit group_path(Group.find_by(name: "TestGroup"))
|
|
|
|
end
|
|
|
|
|
|
|
|
step 'I visit group "TestGroup" issues page' do
|
|
|
|
visit issues_group_path(Group.find_by(name: "TestGroup"))
|
|
|
|
end
|
|
|
|
|
|
|
|
step 'I visit group "TestGroup" merge requests page' do
|
|
|
|
visit merge_requests_group_path(Group.find_by(name: "TestGroup"))
|
|
|
|
end
|
|
|
|
|
|
|
|
step 'I visit group "TestGroup" members page' do
|
2015-03-13 11:27:51 -04:00
|
|
|
visit group_group_members_path(Group.find_by(name: "TestGroup"))
|
2014-02-13 15:45:51 -05:00
|
|
|
end
|
2014-07-23 05:18:51 -04:00
|
|
|
|
2014-02-13 15:45:51 -05:00
|
|
|
step 'I should not see project "Enterprise" items' do
|
2015-06-12 00:44:13 -04:00
|
|
|
expect(page).not_to have_content "Enterprise"
|
2014-02-13 15:45:51 -05:00
|
|
|
end
|
2014-07-23 05:18:51 -04:00
|
|
|
|
2014-02-13 15:45:51 -05:00
|
|
|
step 'I should see project "Internal" items' do
|
2015-06-12 00:44:13 -04:00
|
|
|
expect(page).to have_content "Internal"
|
2014-02-13 15:45:51 -05:00
|
|
|
end
|
2014-07-23 05:18:51 -04:00
|
|
|
|
2014-02-13 15:45:51 -05:00
|
|
|
step 'I should not see project "Internal" items' do
|
2015-06-12 00:44:13 -04:00
|
|
|
expect(page).not_to have_content "Internal"
|
2014-02-13 15:45:51 -05:00
|
|
|
end
|
2014-07-23 05:18:51 -04:00
|
|
|
|
2014-02-13 15:45:51 -05:00
|
|
|
step 'I should see project "Community" items' do
|
2015-06-12 00:44:13 -04:00
|
|
|
expect(page).to have_content "Community"
|
2014-02-13 15:45:51 -05:00
|
|
|
end
|
2014-07-23 05:18:51 -04:00
|
|
|
|
2014-02-13 15:45:51 -05:00
|
|
|
step 'I change filter to Everyone\'s' do
|
|
|
|
click_link "Everyone's"
|
|
|
|
end
|
2014-07-23 05:18:51 -04:00
|
|
|
|
2014-02-13 15:45:51 -05:00
|
|
|
step 'I should see group member "John Doe"' do
|
2015-06-12 00:44:13 -04:00
|
|
|
expect(page).to have_content "John Doe"
|
2014-02-13 15:45:51 -05:00
|
|
|
end
|
2014-07-23 05:18:51 -04:00
|
|
|
|
2014-02-13 15:45:51 -05:00
|
|
|
step 'I should not see member roles' do
|
2015-06-12 00:44:13 -04:00
|
|
|
expect(body).not_to match(%r{owner|developer|reporter|guest}i)
|
2014-02-13 15:45:51 -05:00
|
|
|
end
|
|
|
|
|
|
|
|
protected
|
|
|
|
|
|
|
|
def group_has_project(groupname, projectname, visibility_level)
|
|
|
|
group = Group.find_by(name: groupname) || create(:group, name: groupname)
|
|
|
|
project = create(:project,
|
|
|
|
namespace: group,
|
|
|
|
name: projectname,
|
|
|
|
path: "#{groupname}-#{projectname}",
|
|
|
|
visibility_level: visibility_level
|
2015-12-14 21:53:52 -05:00
|
|
|
)
|
2014-02-13 15:45:51 -05:00
|
|
|
create(:issue,
|
|
|
|
title: "#{projectname} feature",
|
|
|
|
project: project
|
2015-12-14 21:53:52 -05:00
|
|
|
)
|
2014-02-13 15:45:51 -05:00
|
|
|
create(:merge_request,
|
|
|
|
title: "#{projectname} feature implemented",
|
|
|
|
source_project: project,
|
|
|
|
target_project: project
|
2015-12-14 21:53:52 -05:00
|
|
|
)
|
2014-02-13 15:45:51 -05:00
|
|
|
create(:closed_issue_event,
|
|
|
|
project: project
|
2015-12-14 21:53:52 -05:00
|
|
|
)
|
2014-02-13 15:45:51 -05:00
|
|
|
end
|
|
|
|
end
|