2020-04-06 09:09:17 +00:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2020-06-24 15:08:50 +00:00
|
|
|
RSpec.shared_context 'project service activation' do
|
2020-04-06 09:09:17 +00:00
|
|
|
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
|
|
|
|
|
2020-04-22 09:09:36 +00:00
|
|
|
def click_active_toggle
|
|
|
|
find('input[name="service[active]"] + button').click
|
|
|
|
end
|
|
|
|
|
2020-04-06 09:09:17 +00:00
|
|
|
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
|