diff options
Diffstat (limited to 'spec/models/integrations/datadog_spec.rb')
-rw-r--r-- | spec/models/integrations/datadog_spec.rb | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/spec/models/integrations/datadog_spec.rb b/spec/models/integrations/datadog_spec.rb index 165b21840e0..e2749ab1bc1 100644 --- a/spec/models/integrations/datadog_spec.rb +++ b/spec/models/integrations/datadog_spec.rb @@ -10,13 +10,13 @@ RSpec.describe Integrations::Datadog do let(:active) { true } let(:dd_site) { 'datadoghq.com' } - let(:default_url) { 'https://webhooks-http-intake.logs.datadoghq.com/v1/input/' } + let(:default_url) { 'https://webhooks-http-intake.logs.datadoghq.com/api/v2/webhook' } let(:api_url) { '' } let(:api_key) { SecureRandom.hex(32) } let(:dd_env) { 'ci' } let(:dd_service) { 'awesome-gitlab' } - let(:expected_hook_url) { default_url + api_key + "?env=#{dd_env}&service=#{dd_service}" } + let(:expected_hook_url) { default_url + "?dd-api-key=#{api_key}&env=#{dd_env}&service=#{dd_service}" } let(:instance) do described_class.new( @@ -38,9 +38,9 @@ RSpec.describe Integrations::Datadog do let(:pipeline_data) { Gitlab::DataBuilder::Pipeline.build(pipeline) } let(:build_data) { Gitlab::DataBuilder::Build.build(build) } - describe 'associations' do - it { is_expected.to belong_to(:project) } - it { is_expected.to have_one(:service_hook) } + it_behaves_like Integrations::HasWebHook do + let(:integration) { instance } + let(:hook_url) { "#{described_class::URL_TEMPLATE % { datadog_domain: dd_site }}?dd-api-key=#{api_key}&env=#{dd_env}&service=#{dd_service}" } end describe 'validations' do @@ -65,7 +65,7 @@ RSpec.describe Integrations::Datadog do context 'with custom api_url' do let(:dd_site) { '' } - let(:api_url) { 'https://webhooks-http-intake.logs.datad0g.com/v1/input/' } + let(:api_url) { 'https://webhooks-http-intake.logs.datad0g.com/api/v2/webhook' } it { is_expected.not_to validate_presence_of(:datadog_site) } it { is_expected.to validate_presence_of(:api_url) } @@ -91,7 +91,7 @@ RSpec.describe Integrations::Datadog do end end - context 'when service is not active' do + context 'when integration is not active' do let(:active) { false } it { is_expected.to be_valid } @@ -107,9 +107,9 @@ RSpec.describe Integrations::Datadog do end context 'with custom URL' do - let(:api_url) { 'https://webhooks-http-intake.logs.datad0g.com/v1/input/' } + let(:api_url) { 'https://webhooks-http-intake.logs.datad0g.com/api/v2/webhook' } - it { is_expected.to eq(api_url + api_key + "?env=#{dd_env}&service=#{dd_service}") } + it { is_expected.to eq(api_url + "?dd-api-key=#{api_key}&env=#{dd_env}&service=#{dd_service}") } context 'blank' do let(:api_url) { '' } @@ -122,7 +122,7 @@ RSpec.describe Integrations::Datadog do let(:dd_service) { '' } let(:dd_env) { '' } - it { is_expected.to eq(default_url + api_key) } + it { is_expected.to eq(default_url + "?dd-api-key=#{api_key}") } end end |