summaryrefslogtreecommitdiff
path: root/features/steps/project/project_group_links.rb
blob: 739a85e5fa475a6a5556892ac3bbd536467f61e8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
class Spinach::Features::ProjectGroupLinks < Spinach::FeatureSteps
  include SharedAuthentication
  include SharedProject
  include SharedPaths
  include Select2Helper

  step 'I should see project already shared with group "Ops"' do
    page.within '.enabled-groups' do
      expect(page).to have_content "Ops"
    end
  end

  step 'I should see project is not shared with group "Market"' do
    page.within '.enabled-groups' do
      expect(page).not_to have_content "Market"
    end
  end

  step 'I select group "Market" for share' do
    group = Group.find_by(path: 'market')
    select2(group.id, from: "#link_group_id")
    select "Master", from: 'link_group_access'
    click_button "Share"
  end

  step 'I should see project is shared with group "Market"' do
    page.within '.enabled-groups' do
      expect(page).to have_content "Market"
    end
  end

  step 'project "Shop" is shared with group "Ops"' do
    group = create(:group, name: 'Ops')
    share_link = project.project_group_links.new(group_access: Gitlab::Access::MASTER)
    share_link.group_id = group.id
    share_link.save!
  end

  step 'project "Shop" is not shared with group "Market"' do
    create(:group, name: 'Market', path: 'market')
  end

  step 'I visit project group links page' do
    visit namespace_project_group_links_path(project.namespace, project)
  end

  def project
    @project ||= Project.find_by_name "Shop"
  end
end