Skip to content

Commit

Permalink
Enable settings spec
Browse files Browse the repository at this point in the history
  • Loading branch information
TonyCTHsu committed Jan 8, 2024
1 parent a7405cd commit e0fd192
Show file tree
Hide file tree
Showing 7 changed files with 12 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@
RSpec.describe Datadog::Tracing::Contrib::Excon::Configuration::Settings do
it_behaves_like 'service name setting', 'excon'
it_behaves_like 'with on_error setting'
it_behaves_like 'with error_status_codes setting', env: 'DD_TRACE_EXCON_ERROR_STATUS_CODES'
it_behaves_like 'with error_status_codes setting', env: 'DD_TRACE_EXCON_ERROR_STATUS_CODES', default: 400...600
end
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@
RSpec.describe Datadog::Tracing::Contrib::Faraday::Configuration::Settings do
it_behaves_like 'service name setting', 'faraday'
it_behaves_like 'with on_error setting'
it_behaves_like 'with error_status_codes setting', env: 'DD_TRACE_FARADAY_ERROR_STATUS_CODES'
it_behaves_like 'with error_status_codes setting', env: 'DD_TRACE_FARADAY_ERROR_STATUS_CODES', default: 400...600
end
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@
require 'datadog/tracing/contrib/shared_settings_examples'

RSpec.describe Datadog::Tracing::Contrib::Grape::Configuration::Settings do
# it_behaves_like 'with on_error setting'
# it_behaves_like 'with error_status_codes setting', env: 'DD_TRACE_GRAPE_ERROR_STATUS_CODES'
it_behaves_like 'with on_error setting'
it_behaves_like 'with error_status_codes setting', env: 'DD_TRACE_GRAPE_ERROR_STATUS_CODES', default: 500...600
end
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@

RSpec.describe Datadog::Tracing::Contrib::HTTP::Configuration::Settings do
it_behaves_like 'service name setting', 'net/http'
it_behaves_like 'with error_status_codes setting', env: 'DD_TRACE_HTTP_ERROR_STATUS_CODES'
it_behaves_like 'with error_status_codes setting', env: 'DD_TRACE_HTTP_ERROR_STATUS_CODES', default: 400...600
end
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@

RSpec.describe Datadog::Tracing::Contrib::Httpclient::Configuration::Settings do
it_behaves_like 'service name setting', 'httpclient'
it_behaves_like 'with error_status_codes setting', env: 'DD_TRACE_HTTPCLIENT_ERROR_STATUS_CODES'
it_behaves_like 'with error_status_codes setting', env: 'DD_TRACE_HTTPCLIENT_ERROR_STATUS_CODES', default: 400...600
end
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@

RSpec.describe Datadog::Tracing::Contrib::Httprb::Configuration::Settings do
it_behaves_like 'service name setting', 'httprb'
it_behaves_like 'with error_status_codes setting', env: 'DD_TRACE_HTTPRB_ERROR_STATUS_CODES'
it_behaves_like 'with error_status_codes setting', env: 'DD_TRACE_HTTPRB_ERROR_STATUS_CODES', default: 400...600
end
11 changes: 5 additions & 6 deletions spec/datadog/tracing/contrib/shared_settings_examples.rb
Original file line number Diff line number Diff line change
Expand Up @@ -28,15 +28,14 @@
end
end

RSpec.shared_examples_for 'with error_status_codes setting' do |env:|
RSpec.shared_examples_for 'with error_status_codes setting' do |env:, default:|
context 'default without settings' do
subject { described_class.new }

it { expect(subject.error_status_codes).to include 400 }
it { expect(subject.error_status_codes).to include 499 }
it { expect(subject.error_status_codes).to include 500 }
it { expect(subject.error_status_codes).to include 599 }
it { expect(subject.error_status_codes).not_to include 600 }
it { expect(subject.error_status_codes).not_to include(default.min - 1) }
it { expect(subject.error_status_codes).to include(default.min) }
it { expect(subject.error_status_codes).to include(default.max) }
it { expect(subject.error_status_codes).not_to include(default.max + 1) }
end

context 'when given error_status_codes' do
Expand Down

0 comments on commit e0fd192

Please sign in to comment.