BigW Consortium Gitlab

groups.rb 2.52 KB
Newer Older
1
class Spinach::Features::ExploreGroups < Spinach::FeatureSteps
2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
  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
18

19 20 21
  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")
22
    group.add_owner(user)
23 24 25 26 27 28 29 30 31 32 33 34 35 36 37
  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
38
    visit group_group_members_path(Group.find_by(name: "TestGroup"))
39
  end
40

41
  step 'I should not see project "Enterprise" items' do
42
    expect(page).not_to have_content "Enterprise"
43
  end
44

45
  step 'I should see project "Internal" items' do
46
    expect(page).to have_content "Internal"
47
  end
48

49
  step 'I should not see project "Internal" items' do
50
    expect(page).not_to have_content "Internal"
51
  end
52

53
  step 'I should see project "Community" items' do
54
    expect(page).to have_content "Community"
55
  end
56

57 58 59
  step 'I change filter to Everyone\'s' do
    click_link "Everyone's"
  end
60

61
  step 'I should see group member "John Doe"' do
62
    expect(page).to have_content "John Doe"
63
  end
64

65 66 67 68 69 70 71 72 73
  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
74
                    )
75 76 77
    create(:issue,
      title: "#{projectname} feature",
      project: project
78
          )
79 80 81 82
    create(:merge_request,
      title: "#{projectname} feature implemented",
      source_project: project,
      target_project: project
83
          )
84 85
    create(:closed_issue_event,
      project: project
86
          )
87 88
  end
end