Module: Resilient::Test::CircuitBreakerRegistryInterface
- Defined in:
- lib/resilient/test/circuit_breaker_registry_interface.rb
Instance Method Summary collapse
- #test_fetch ⇒ Object
- #test_reset ⇒ Object
- #test_reset_empty_registry ⇒ Object
- #test_responds_to_fetch ⇒ Object
- #test_responds_to_reset ⇒ Object
Instance Method Details
#test_fetch ⇒ Object
12 13 14 15 16 17 18 19 20 |
# File 'lib/resilient/test/circuit_breaker_registry_interface.rb', line 12 def test_fetch key = "foo" value = "bar".freeze assert_raises(KeyError) { @object.fetch(key) } assert_equal value, @object.fetch(key) { value } assert_equal value, @object.fetch(key) assert @object.fetch(key).equal?(value) end |
#test_reset ⇒ Object
22 23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/resilient/test/circuit_breaker_registry_interface.rb', line 22 def test_reset original_foo = @object.fetch("foo") { Object.new } = @object.fetch("bar") { Object.new } assert_nil @object.reset foo = @object.fetch("foo") { Object.new } = @object.fetch("bar") { Object.new } # assert that the objects before and after reset are not the same object refute original_foo.equal?(foo) refute .equal?() end |
#test_reset_empty_registry ⇒ Object
36 37 38 |
# File 'lib/resilient/test/circuit_breaker_registry_interface.rb', line 36 def test_reset_empty_registry assert_nil @object.reset end |
#test_responds_to_fetch ⇒ Object
4 5 6 |
# File 'lib/resilient/test/circuit_breaker_registry_interface.rb', line 4 def test_responds_to_fetch assert_respond_to @object, :fetch end |
#test_responds_to_reset ⇒ Object
8 9 10 |
# File 'lib/resilient/test/circuit_breaker_registry_interface.rb', line 8 def test_responds_to_reset assert_respond_to @object, :reset end |