diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2022-11-17 14:33:21 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2022-11-17 14:33:21 +0300 |
commit | 7021455bd1ed7b125c55eb1b33c5a01f2bc55ee0 (patch) | |
tree | 5bdc2229f5198d516781f8d24eace62fc7e589e9 /spec/serializers/integrations | |
parent | 185b095e93520f96e9cfc31d9c3e69b498cdab7c (diff) |
Add latest changes from gitlab-org/gitlab@15-6-stable-eev15.6.0-rc42
Diffstat (limited to 'spec/serializers/integrations')
-rw-r--r-- | spec/serializers/integrations/event_entity_spec.rb | 1 | ||||
-rw-r--r-- | spec/serializers/integrations/field_entity_spec.rb | 34 |
2 files changed, 33 insertions, 2 deletions
diff --git a/spec/serializers/integrations/event_entity_spec.rb b/spec/serializers/integrations/event_entity_spec.rb index 07281248f5b..1b72b5d290c 100644 --- a/spec/serializers/integrations/event_entity_spec.rb +++ b/spec/serializers/integrations/event_entity_spec.rb @@ -35,6 +35,7 @@ RSpec.describe Integrations::EventEntity do expect(subject[:value]).to eq(false) expect(subject[:field][:name]).to eq('note_channel') expect(subject[:field][:value]).to eq('note-channel') + expect(subject[:field][:placeholder]).to eq('#general, #development') end end end diff --git a/spec/serializers/integrations/field_entity_spec.rb b/spec/serializers/integrations/field_entity_spec.rb index 7af17cf6df6..4212a1ee6a2 100644 --- a/spec/serializers/integrations/field_entity_spec.rb +++ b/spec/serializers/integrations/field_entity_spec.rb @@ -13,7 +13,7 @@ RSpec.describe Integrations::FieldEntity do describe '#as_json' do context 'with Jira integration' do - let(:integration) { create(:jira_integration) } + let(:integration) { build(:jira_integration) } context 'with field with type text' do let(:field) { integration_field('username') } @@ -59,7 +59,7 @@ RSpec.describe Integrations::FieldEntity do end context 'with EmailsOnPush integration' do - let(:integration) { create(:emails_on_push_integration, send_from_committer_email: '1') } + let(:integration) { build(:emails_on_push_integration, send_from_committer_email: '1') } context 'with field with type checkbox' do let(:field) { integration_field('send_from_committer_email') } @@ -111,6 +111,36 @@ RSpec.describe Integrations::FieldEntity do end end end + + context 'with chat integration' do + let(:integration) { build(:mattermost_integration) } + let(:field) { integration_field('webhook') } + + it 'exposes correct attributes but masks webhook' do + expected_hash = { + section: nil, + type: 'text', + name: 'webhook', + title: nil, + placeholder: nil, + help: 'http://mattermost.example.com/hooks/', + required: true, + choices: nil, + value: '************', + checkbox_label: nil + } + + is_expected.to eq(expected_hash) + end + + context 'when webhook was not set' do + let(:integration) { build(:mattermost_integration, webhook: nil) } + + it 'does not show the masked webhook' do + expect(subject[:value]).to be_nil + end + end + end end def integration_field(name) |