diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2021-03-16 21:18:33 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2021-03-16 21:18:33 +0300 |
commit | f64a639bcfa1fc2bc89ca7db268f594306edfd7c (patch) | |
tree | a2c3c2ebcc3b45e596949db485d6ed18ffaacfa1 /spec/models/alert_management/http_integration_spec.rb | |
parent | bfbc3e0d6583ea1a91f627528bedc3d65ba4b10f (diff) |
Add latest changes from gitlab-org/gitlab@13-10-stable-eev13.10.0-rc40
Diffstat (limited to 'spec/models/alert_management/http_integration_spec.rb')
-rw-r--r-- | spec/models/alert_management/http_integration_spec.rb | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/spec/models/alert_management/http_integration_spec.rb b/spec/models/alert_management/http_integration_spec.rb index ddd65e723eb..f88a66a7c27 100644 --- a/spec/models/alert_management/http_integration_spec.rb +++ b/spec/models/alert_management/http_integration_spec.rb @@ -81,6 +81,32 @@ RSpec.describe AlertManagement::HttpIntegration do end end + describe 'before validation' do + describe '#ensure_payload_example_not_nil' do + subject(:integration) { build(:alert_management_http_integration, payload_example: payload_example) } + + context 'when the payload_example is nil' do + let(:payload_example) { nil } + + it 'sets the payload_example to empty JSON' do + integration.valid? + + expect(integration.payload_example).to eq({}) + end + end + + context 'when the payload_example is not nil' do + let(:payload_example) { { 'key' => 'value' } } + + it 'sets the payload_example to specified value' do + integration.valid? + + expect(integration.payload_example).to eq(payload_example) + end + end + end + end + describe '#token' do subject { integration.token } |