summaryrefslogtreecommitdiff
path: root/spec
diff options
context:
space:
mode:
authorJames Edwards-Jones <jedwardsjones@gitlab.com>2018-03-06 23:20:01 +0000
committerJames Edwards-Jones <jedwardsjones@gitlab.com>2018-03-08 00:09:26 +0000
commit93af1af67fc6af2805f3342aed1fc15a4360870d (patch)
tree5064b0355d44be4ad9d166b876e1176752f4af2b /spec
parentef15668d8214e8cce5732525c872d5b8f57e337a (diff)
downloadgitlab-ce-93af1af67fc6af2805f3342aed1fc15a4360870d.tar.gz
Hides Triggers if integration only has one event
Removes confusing/unnecessary checkboxes when trying to configure an integration. If there is only one supported event we don't need to allow these to be individually disabled since the integration can be disabled instead. E.g. Project Integrations for GitHub, Bugzilla, Asana, Pipeline emails and Gemnasium Allows integrations to override which triggers are configurable
Diffstat (limited to 'spec')
-rw-r--r--spec/features/projects/services/disable_triggers_spec.rb35
1 files changed, 35 insertions, 0 deletions
diff --git a/spec/features/projects/services/disable_triggers_spec.rb b/spec/features/projects/services/disable_triggers_spec.rb
new file mode 100644
index 00000000000..1a13fe03a67
--- /dev/null
+++ b/spec/features/projects/services/disable_triggers_spec.rb
@@ -0,0 +1,35 @@
+require 'spec_helper'
+
+describe 'Disable individual triggers' do
+ let(:project) { create(:project) }
+ let(:user) { project.owner }
+ let(:checkbox_selector) { 'input[type=checkbox][id$=_events]' }
+
+ before do
+ sign_in(user)
+
+ visit(project_settings_integrations_path(project))
+
+ click_link(service_name)
+ end
+
+ context 'service has multiple supported events' do
+ let(:service_name) { 'HipChat' }
+
+ it 'shows trigger checkboxes' do
+ event_count = HipchatService.supported_events.count
+
+ 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