Skip to content
This repository was archived by the owner on Mar 15, 2022. It is now read-only.

Commit c096fdf

Browse files
committed
Merge pull request #18 from dzjuck/flunk_to_fail
Call fail instead of flunk
2 parents bd43a62 + 43f824c commit c096fdf

File tree

2 files changed

+12
-12
lines changed

2 files changed

+12
-12
lines changed

spec/thread_safe/cache_spec.rb

+11-11
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ module ThreadSafe
9292
late_compute_threads = Array.new(late_compute_threads_count) do
9393
Thread.new do
9494
block_until_compute_started.call('compute_if_absent')
95-
expect(1).to eq @cache.compute_if_absent(:a) { flunk }
95+
expect(1).to eq @cache.compute_if_absent(:a) { fail }
9696
end
9797
end
9898

@@ -132,7 +132,7 @@ module ThreadSafe
132132
expect_no_size_change do
133133
expect(nil).to eq @cache.compute_if_present(:a) {}
134134
expect(nil).to eq @cache.compute_if_present(:a) { 1 }
135-
expect(nil).to eq @cache.compute_if_present(:a) { flunk }
135+
expect(nil).to eq @cache.compute_if_present(:a) { fail }
136136
expect(false).to eq @cache.key?(:a)
137137
end
138138

@@ -220,7 +220,7 @@ module ThreadSafe
220220
it 'common' do
221221
with_or_without_default_proc do
222222
expect_size_change(1) do
223-
expect(nil).to eq @cache.merge_pair(:a, nil) { flunk }
223+
expect(nil).to eq @cache.merge_pair(:a, nil) { fail }
224224
expect(true).to eq @cache.key?(:a)
225225
expect(nil).to eq @cache[:a]
226226
end
@@ -489,7 +489,7 @@ def key # assert_collision_resistance expects to be able to call .key to get the
489489

490490
@cache[:a] = 1
491491
expect_no_size_change do
492-
expect(1).to eq @cache.fetch(:a) { flunk }
492+
expect(1).to eq @cache.fetch(:a) { fail }
493493
end
494494

495495
expect { @cache.fetch(:b) }.to raise_error(ThreadSafe::Cache::KEY_ERROR)
@@ -515,7 +515,7 @@ def key # assert_collision_resistance expects to be able to call .key to get the
515515
@cache[:a] = nil
516516
expect_no_size_change do
517517
expect(true).to eq @cache.key?(:a)
518-
expect(nil).to eq @cache.fetch(:a) { flunk }
518+
expect(nil).to eq @cache.fetch(:a) { fail }
519519
end
520520
end
521521
end
@@ -551,7 +551,7 @@ def key # assert_collision_resistance expects to be able to call .key to get the
551551
end
552552

553553
expect_no_size_change do
554-
expect(1).to eq @cache.fetch_or_store(:a) { flunk }
554+
expect(1).to eq @cache.fetch_or_store(:a) { fail }
555555
end
556556

557557
expect { @cache.fetch_or_store(:b) }.
@@ -597,7 +597,7 @@ def key # assert_collision_resistance expects to be able to call .key to get the
597597

598598
@cache[:a] = nil
599599
expect_no_size_change do
600-
expect(nil).to eq @cache.fetch_or_store(:a) { flunk }
600+
expect(nil).to eq @cache.fetch_or_store(:a) { fail }
601601
end
602602
end
603603
end
@@ -625,7 +625,7 @@ def key # assert_collision_resistance expects to be able to call .key to get the
625625

626626
describe '#each_pair' do
627627
it 'common' do
628-
@cache.each_pair { |k, v| flunk }
628+
@cache.each_pair { |k, v| fail }
629629
expect(@cache).to eq @cache.each_pair {}
630630
@cache[:a] = 1
631631

@@ -647,7 +647,7 @@ def key # assert_collision_resistance expects to be able to call .key to get the
647647
if i == 0
648648
i += 1
649649
next
650-
flunk
650+
fail
651651
elsif i == 1
652652
break :breaked
653653
end
@@ -690,7 +690,7 @@ def key # assert_collision_resistance expects to be able to call .key to get the
690690
end
691691

692692
it '#each_key' do
693-
expect(@cache).to eq @cache.each_key { flunk }
693+
expect(@cache).to eq @cache.each_key { fail }
694694

695695
@cache[1] = 1
696696
arr = []
@@ -704,7 +704,7 @@ def key # assert_collision_resistance expects to be able to call .key to get the
704704
end
705705

706706
it '#each_value' do
707-
expect(@cache).to eq @cache.each_value { flunk }
707+
expect(@cache).to eq @cache.each_value { fail }
708708

709709
@cache[1] = 1
710710
arr = []

spec/thread_safe/no_unsafe_spec.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ module ThreadSafe
1313
it 'security_manager_is_used' do
1414
begin
1515
java_import 'sun.misc.Unsafe'
16-
flunk
16+
fail
1717
rescue SecurityError
1818
end
1919
end

0 commit comments

Comments
 (0)