2019-07-25 01:24:42 -04:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2018-03-06 18:20:01 -05:00
|
|
|
require 'spec_helper'
|
|
|
|
|
2020-06-05 14:08:19 -04:00
|
|
|
RSpec.describe 'Disable individual triggers', :js do
|
2020-04-22 05:09:36 -04:00
|
|
|
include_context 'project service activation'
|
|
|
|
|
2020-06-05 14:08:19 -04:00
|
|
|
let(:checkbox_selector) { 'input[type=checkbox][name$="_events]"]' }
|
2018-03-06 18:20:01 -05:00
|
|
|
|
|
|
|
before do
|
2020-04-22 05:09:36 -04:00
|
|
|
visit_project_integration(service_name)
|
2018-03-06 18:20:01 -05:00
|
|
|
end
|
|
|
|
|
|
|
|
context 'service has multiple supported events' do
|
2019-04-09 09:06:36 -04:00
|
|
|
let(:service_name) { 'HipChat' }
|
2018-03-06 18:20:01 -05:00
|
|
|
|
|
|
|
it 'shows trigger checkboxes' do
|
2019-04-09 09:06:36 -04:00
|
|
|
event_count = HipchatService.supported_events.count
|
2018-03-06 18:20:01 -05:00
|
|
|
|
|
|
|
expect(page).to have_content "Trigger"
|
|
|
|
expect(page).to have_css(checkbox_selector, count: event_count)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
context 'services only has one supported event' do
|
|
|
|
let(:service_name) { 'Asana' }
|
|
|
|
|
|
|
|
it "doesn't show unnecessary Trigger checkboxes" do
|
|
|
|
expect(page).not_to have_content "Trigger"
|
|
|
|
expect(page).not_to have_css(checkbox_selector)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|