Skip to content

Commit 2e097e8

Browse files
author
Nicholas Stuart
committed
Add test case
1 parent c83e690 commit 2e097e8

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

activesupport/test/cache/behaviors/failure_safety_behavior.rb

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,17 +9,19 @@ def test_fetch_read_failure_returns_nil
99
end
1010
end
1111

12-
##
13-
# Though the `write` part of fetch fails for the same reason
14-
# `read` will, the block result is still executed and returned.
15-
def test_fetch_read_failure_returns_block_result
12+
def test_fetch_read_failure_does_not_attempt_to_write
1613
@cache.write("foo", "bar")
1714

1815
emulating_unavailability do |cache|
19-
val = cache.fetch("foo") { '1' }
16+
val = cache.fetch("foo") { "1" }
2017

21-
assert_equal '1', val
18+
##
19+
# Though the `write` part of fetch fails for the same reason
20+
# `read` will, the block result is still executed and returned.
21+
assert_equal "1", val
2222
end
23+
24+
assert_equal "bar", @cache.read("foo")
2325
end
2426

2527
def test_read_failure_returns_nil

0 commit comments

Comments
 (0)