test/test_zache.rb in zache-0.10.0 vs test/test_zache.rb in zache-0.10.1

- old
+ new

@@ -206,24 +206,32 @@ end assert(!cache.locked?) end def test_returns_dirty_result - cache = Zache.new + cache = Zache.new(dirty: true) cache.get(:x, lifetime: 0) { 1 } long = Thread.start do cache.get(:x) do sleep 1000 2 end end sleep 0.1 Timeout.timeout(1) do - assert(cache.exists?(:x, dirty: true)) - assert_equal(1, cache.get(:x, dirty: true)) - assert_equal(1, cache.get(:x, dirty: true) { 2 }) + assert(cache.exists?(:x)) + assert_equal(1, cache.get(:x)) + assert_equal(1, cache.get(:x) { 2 }) end long.kill + end + + def test_returns_dirty_result_when_not_locked + cache = Zache.new(dirty: true) + cache.get(:x, lifetime: 0) { 1 } + assert(cache.exists?(:x)) + assert_equal(1, cache.get(:x)) + assert_equal(2, cache.get(:x) { 2 }) end def test_fetches_multiple_keys_in_many_threads_in_dirty_mode cache = Zache.new(dirty: true) set = Concurrent::Set.new