summaryrefslogtreecommitdiff
path: root/spec/support/shared_contexts/project_service_shared_context.rb
blob: a72d4901b72a163321eae3d831893cd13ea24fd5 (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
# frozen_string_literal: true

RSpec.shared_context 'project service activation' do
  let(:project) { create(:project) }
  let(:user) { create(:user) }

  before do
    project.add_maintainer(user)
    sign_in(user)
  end

  def visit_project_integrations
    visit project_settings_integrations_path(project)
  end

  def visit_project_integration(name)
    visit_project_integrations
    click_link(name)
  end

  def click_active_toggle
    find('input[name="service[active]"] + button').click
  end

  def click_test_integration
    click_button('Test settings and save changes')
  end

  def click_test_then_save_integration
    click_test_integration

    expect(page).to have_content('Test failed.')

    click_link('Save anyway')
  end
end