Class: Datadog::CI::TestVisibility::Store::Local
- Inherits:
-
Object
- Object
- Datadog::CI::TestVisibility::Store::Local
- Defined in:
- lib/datadog/ci/test_visibility/store/local.rb
Instance Method Summary collapse
- #activate_test(test) ⇒ Object
- #active_test ⇒ Object
- #deactivate_test ⇒ Object
-
#initialize ⇒ Local
constructor
A new instance of Local.
Constructor Details
#initialize ⇒ Local
Returns a new instance of Local.
8 9 10 11 12 |
# File 'lib/datadog/ci/test_visibility/store/local.rb', line 8 def initialize @key = :datadog_ci_active_test self.active_test = nil end |
Instance Method Details
#activate_test(test) ⇒ Object
14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/datadog/ci/test_visibility/store/local.rb', line 14 def activate_test(test) raise "Nested tests are not supported. Currently active test: #{active_test}" unless active_test.nil? if block_given? begin self.active_test = test yield ensure self.active_test = nil end else self.active_test = test end end |
#active_test ⇒ Object
33 34 35 |
# File 'lib/datadog/ci/test_visibility/store/local.rb', line 33 def active_test Thread.current[@key] end |
#deactivate_test ⇒ Object
29 30 31 |
# File 'lib/datadog/ci/test_visibility/store/local.rb', line 29 def deactivate_test self.active_test = nil end |