diff --git a/app/assets/javascripts/integrations/edit/components/trigger_fields.vue b/app/assets/javascripts/integrations/edit/components/trigger_fields.vue
index 433fe21ad76..92042a5c981 100644
--- a/app/assets/javascripts/integrations/edit/components/trigger_fields.vue
+++ b/app/assets/javascripts/integrations/edit/components/trigger_fields.vue
@@ -1,6 +1,5 @@
@@ -58,10 +56,10 @@ export default {
data-testid="trigger-fields-group"
>
-
+
- {{ startCase(event.title) }}
+ {{ event.title }}
{
describe('events without field property', () => {
const events = [
{
- title: 'push',
+ title: 'Push',
name: 'push_event',
description: 'Event on push',
value: true,
},
{
- title: 'merge_request',
+ title: 'Merge request',
name: 'merge_requests_event',
description: 'Event on merge_request',
value: false,
@@ -81,7 +81,7 @@ describe('TriggerFields', () => {
const checkboxes = findAllGlFormGroups();
const expectedResults = [
{ labelText: 'Push', inputName: 'service[push_event]' },
- { labelText: 'Merge Request', inputName: 'service[merge_requests_event]' },
+ { labelText: 'Merge request', inputName: 'service[merge_requests_event]' },
];
expect(checkboxes).toHaveLength(2);
diff --git a/spec/helpers/integrations_helper_spec.rb b/spec/helpers/integrations_helper_spec.rb
index 38ce17e34ba..ab51e8d0f8c 100644
--- a/spec/helpers/integrations_helper_spec.rb
+++ b/spec/helpers/integrations_helper_spec.rb
@@ -3,17 +3,41 @@
require 'spec_helper'
RSpec.describe IntegrationsHelper do
+ shared_examples 'is defined for each integration event' do
+ Integration.available_integration_names.each do |integration|
+ events = Integration.integration_name_to_model(integration).new.configurable_events
+ events.each do |event|
+ context "when integration is #{integration}, event is #{event}" do
+ let(:integration) { integration }
+ let(:event) { event }
+
+ it { is_expected.not_to be_nil }
+ end
+ end
+ end
+ end
+
+ describe '#integration_event_title' do
+ subject { helper.integration_event_title(event) }
+
+ it_behaves_like 'is defined for each integration event'
+ end
+
describe '#integration_event_description' do
- subject(:description) { helper.integration_event_description(integration, 'merge_request_events') }
+ subject { helper.integration_event_description(integration, event) }
+
+ it_behaves_like 'is defined for each integration event'
context 'when integration is Jira' do
let(:integration) { Integrations::Jira.new }
+ let(:event) { 'merge_request_events' }
it { is_expected.to include('Jira') }
end
context 'when integration is Team City' do
let(:integration) { Integrations::Teamcity.new }
+ let(:event) { 'merge_request_events' }
it { is_expected.to include('TeamCity') }
end
diff --git a/spec/serializers/service_event_entity_spec.rb b/spec/serializers/service_event_entity_spec.rb
index f610c8f1488..db82e84fcf8 100644
--- a/spec/serializers/service_event_entity_spec.rb
+++ b/spec/serializers/service_event_entity_spec.rb
@@ -19,7 +19,7 @@ RSpec.describe ServiceEventEntity do
it 'exposes correct attributes' do
expect(subject[:description]).to eq('Trigger event for pushes to the repository.')
expect(subject[:name]).to eq('push_events')
- expect(subject[:title]).to eq('push')
+ expect(subject[:title]).to eq('Push')
expect(subject[:value]).to be(true)
end
end
@@ -31,7 +31,7 @@ RSpec.describe ServiceEventEntity do
it 'exposes correct attributes' do
expect(subject[:description]).to eq('Trigger event for new comments.')
expect(subject[:name]).to eq('note_events')
- expect(subject[:title]).to eq('note')
+ expect(subject[:title]).to eq('Note')
expect(subject[:value]).to eq(false)
expect(subject[:field][:name]).to eq('note_channel')
expect(subject[:field][:value]).to eq('note-channel')
diff --git a/spec/support/shared_examples/integrations/integration_settings_form.rb b/spec/support/shared_examples/integrations/integration_settings_form.rb
index d0bb40e43ee..d8a46180796 100644
--- a/spec/support/shared_examples/integrations/integration_settings_form.rb
+++ b/spec/support/shared_examples/integrations/integration_settings_form.rb
@@ -22,10 +22,7 @@ RSpec.shared_examples 'integration settings form' do
events = parse_json(trigger_events_for_integration(integration))
events.each do |trigger|
- # normalizing the title because capybara location is case sensitive
- title = normalize_title trigger[:title], integration
-
- expect(page).to have_field(title, type: 'checkbox', wait: 0),
+ expect(page).to have_field(trigger[:title], type: 'checkbox', wait: 0),
"#{integration.title} field #{title} checkbox not present"
end
end
@@ -35,12 +32,6 @@ RSpec.shared_examples 'integration settings form' do
private
- def normalize_title(title, integration)
- return 'Merge request' if integration.is_a?(Integrations::Jira) && title == 'merge_request'
-
- title.titlecase
- end
-
def parse_json(json)
Gitlab::Json.parse(json, symbolize_names: true)
end