2019-07-25 05:24:42 +00:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2018-03-06 23:20:01 +00:00
|
|
|
require 'spec_helper'
|
|
|
|
|
2020-06-05 18:08:19 +00:00
|
|
|
RSpec.describe 'Disable individual triggers', :js do
|
2022-02-09 09:13:26 +00:00
|
|
|
include_context 'project integration activation'
|
2020-04-22 09:09:36 +00:00
|
|
|
|
2020-07-17 03:09:14 +00:00
|
|
|
let(:checkbox_selector) { 'input[name$="_events]"]' }
|
2018-03-06 23:20:01 +00:00
|
|
|
|
|
|
|
before do
|
2022-02-09 09:13:26 +00:00
|
|
|
visit_project_integration(integration_name)
|
2018-03-06 23:20:01 +00:00
|
|
|
end
|
|
|
|
|
2022-02-09 09:13:26 +00:00
|
|
|
context 'integration has multiple supported events' do
|
|
|
|
let(:integration_name) { 'Jenkins' }
|
2018-03-06 23:20:01 +00:00
|
|
|
|
|
|
|
it 'shows trigger checkboxes' do
|
2021-05-25 18:10:42 +00:00
|
|
|
event_count = Integrations::Jenkins.supported_events.count
|
2018-03-06 23:20:01 +00:00
|
|
|
|
|
|
|
expect(page).to have_content "Trigger"
|
2020-07-17 03:09:14 +00:00
|
|
|
expect(page).to have_css(checkbox_selector, visible: :all, count: event_count)
|
2018-03-06 23:20:01 +00:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2022-02-09 09:13:26 +00:00
|
|
|
context 'integrations only has one supported event' do
|
|
|
|
let(:integration_name) { 'Asana' }
|
2018-03-06 23:20:01 +00:00
|
|
|
|
|
|
|
it "doesn't show unnecessary Trigger checkboxes" do
|
|
|
|
expect(page).not_to have_content "Trigger"
|
2020-07-17 03:09:14 +00:00
|
|
|
expect(page).not_to have_css(checkbox_selector, visible: :all)
|
2018-03-06 23:20:01 +00:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|