Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions spec/datadog/core/configuration/settings_shared_examples.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
RSpec.shared_examples_for 'a binary setting with' do |env_variable:, default:|
context "when #{env_variable}" do
around { |example| ClimateControl.modify(env_variable => environment) { example.run } }

context 'is not defined' do
let(:environment) { nil }

it { is_expected.to be default }
end

[true, false].each do |value|
context "is defined as #{value}" do
let(:environment) { value.to_s }

it { is_expected.to be value }
end
end
end
end
21 changes: 1 addition & 20 deletions spec/datadog/core/configuration/settings_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,26 +8,7 @@
require 'datadog/core/runtime/ext'
require 'datadog/core/utils/time'
require 'datadog/profiling/ext'

RSpec.shared_examples_for 'a binary setting with' do |env_variable:, default:|
context "when #{env_variable}" do
around { |example| ClimateControl.modify(env_variable => environment) { example.run } }

context 'is not defined' do
let(:environment) { nil }

it { is_expected.to be default }
end

[true, false].each do |value|
context "is defined as #{value}" do
let(:environment) { value.to_s }

it { is_expected.to be value }
end
end
end
end
require_relative 'settings_shared_examples'

RSpec.describe Datadog::Core::Configuration::Settings do
subject(:settings) { described_class.new(options) }
Expand Down
2 changes: 1 addition & 1 deletion spec/datadog/tracing/configuration/settings_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
require 'datadog/tracing/sampling/priority_sampler'
require 'datadog/tracing/tracer'
require 'datadog/tracing/writer'
require 'datadog/core/configuration/settings_spec'
require_relative '../../core/configuration/settings_shared_examples'

RSpec.describe Datadog::Tracing::Configuration::Settings do
# TODO: Core::Configuration::Settings directly extends Tracing::Configuration::Settings
Expand Down
Loading