Skip to content

Commit

Permalink
Fixed: Option not resolving default again after reset.
Browse files Browse the repository at this point in the history
  • Loading branch information
delner committed Mar 14, 2019
1 parent 4907261 commit c28ce31
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 2 deletions.
3 changes: 2 additions & 1 deletion lib/ddtrace/configuration/option.rb
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@ def get
end

def reset
set(definition.default_value)
@is_set = false
@value = nil
end
end
end
Expand Down
6 changes: 5 additions & 1 deletion spec/ddtrace/configuration/option_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,11 @@
option.set(value)
end

it { is_expected.to be(default_value) }
context 'causes #get' do
subject(:get) { option.get }
before(:each) { reset }
it { is_expected.to be(default_value) }
end
end
end
end
7 changes: 7 additions & 0 deletions spec/ddtrace/contrib/analytics_examples.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,13 @@
require 'ddtrace/ext/analytics'

RSpec.shared_examples_for 'analytics for integration' do |options = { ignore_global_flag: true }|
around do |example|
# Reset before and after each example; don't allow global state to linger.
Datadog.configuration.reset_options!
example.run
Datadog.configuration.reset_options!
end

context 'when not configured' do
context 'and the global flag is not set' do
it 'is not included in the tags' do
Expand Down

0 comments on commit c28ce31

Please sign in to comment.