Skip to content
This repository was archived by the owner on Mar 15, 2022. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 11 additions & 11 deletions spec/thread_safe/cache_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ module ThreadSafe
late_compute_threads = Array.new(late_compute_threads_count) do
Thread.new do
block_until_compute_started.call('compute_if_absent')
expect(1).to eq @cache.compute_if_absent(:a) { flunk }
expect(1).to eq @cache.compute_if_absent(:a) { fail }
end
end

Expand Down Expand Up @@ -132,7 +132,7 @@ module ThreadSafe
expect_no_size_change do
expect(nil).to eq @cache.compute_if_present(:a) {}
expect(nil).to eq @cache.compute_if_present(:a) { 1 }
expect(nil).to eq @cache.compute_if_present(:a) { flunk }
expect(nil).to eq @cache.compute_if_present(:a) { fail }
expect(false).to eq @cache.key?(:a)
end

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

@cache[:a] = 1
expect_no_size_change do
expect(1).to eq @cache.fetch(:a) { flunk }
expect(1).to eq @cache.fetch(:a) { fail }
end

expect { @cache.fetch(:b) }.to raise_error(ThreadSafe::Cache::KEY_ERROR)
Expand All @@ -515,7 +515,7 @@ def key # assert_collision_resistance expects to be able to call .key to get the
@cache[:a] = nil
expect_no_size_change do
expect(true).to eq @cache.key?(:a)
expect(nil).to eq @cache.fetch(:a) { flunk }
expect(nil).to eq @cache.fetch(:a) { fail }
end
end
end
Expand Down Expand Up @@ -551,7 +551,7 @@ def key # assert_collision_resistance expects to be able to call .key to get the
end

expect_no_size_change do
expect(1).to eq @cache.fetch_or_store(:a) { flunk }
expect(1).to eq @cache.fetch_or_store(:a) { fail }
end

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

@cache[:a] = nil
expect_no_size_change do
expect(nil).to eq @cache.fetch_or_store(:a) { flunk }
expect(nil).to eq @cache.fetch_or_store(:a) { fail }
end
end
end
Expand Down Expand Up @@ -625,7 +625,7 @@ def key # assert_collision_resistance expects to be able to call .key to get the

describe '#each_pair' do
it 'common' do
@cache.each_pair { |k, v| flunk }
@cache.each_pair { |k, v| fail }
expect(@cache).to eq @cache.each_pair {}
@cache[:a] = 1

Expand All @@ -647,7 +647,7 @@ def key # assert_collision_resistance expects to be able to call .key to get the
if i == 0
i += 1
next
flunk
fail
elsif i == 1
break :breaked
end
Expand Down Expand Up @@ -680,7 +680,7 @@ def key # assert_collision_resistance expects to be able to call .key to get the
end

it '#each_key' do
expect(@cache).to eq @cache.each_key { flunk }
expect(@cache).to eq @cache.each_key { fail }

@cache[1] = 1
arr = []
Expand All @@ -694,7 +694,7 @@ def key # assert_collision_resistance expects to be able to call .key to get the
end

it '#each_value' do
expect(@cache).to eq @cache.each_value { flunk }
expect(@cache).to eq @cache.each_value { fail }

@cache[1] = 1
arr = []
Expand Down
2 changes: 1 addition & 1 deletion spec/thread_safe/no_unsafe_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ module ThreadSafe
it 'security_manager_is_used' do
begin
java_import 'sun.misc.Unsafe'
flunk
fail
rescue SecurityError
end
end
Expand Down