diff --git a/test/helper.rb b/test/helper.rb index e4065cfa..7567f0ff 100644 --- a/test/helper.rb +++ b/test/helper.rb @@ -24,7 +24,7 @@ # Generate self-signed certs for SSL once per suite run. CertificateGenerator.generate -module MiniTest +module Minitest class Spec include Memcached::Helper diff --git a/test/integration/test_quiet.rb b/test/integration/test_quiet.rb index 9139ee68..0c980ca3 100644 --- a/test/integration/test_quiet.rb +++ b/test/integration/test_quiet.rb @@ -12,15 +12,15 @@ key = SecureRandom.hex(3) value = SecureRandom.hex(3) - refute Thread.current[Dalli::QUIET] + refute_operator Thread.current, :[], Dalli::QUIET dc.quiet do - assert Thread.current[Dalli::QUIET] + assert_operator Thread.current, :[], Dalli::QUIET # Response should be nil assert_nil dc.set(key, value) end - refute Thread.current[Dalli::QUIET] + refute_operator Thread.current, :[], Dalli::QUIET assert_equal value, dc.get(key) end @@ -36,9 +36,9 @@ value = SecureRandom.hex(3) dc.set(existing, oldvalue) - refute Thread.current[Dalli::QUIET] + refute_operator Thread.current, :[], Dalli::QUIET dc.quiet do - assert Thread.current[Dalli::QUIET] + assert_operator Thread.current, :[], Dalli::QUIET # Response should be nil assert_nil dc.add(key, value) @@ -47,7 +47,7 @@ assert_nil dc.add(existing, value) end - refute Thread.current[Dalli::QUIET] + refute_operator Thread.current, :[], Dalli::QUIET assert_equal value, dc.get(key) assert_equal oldvalue, dc.get(existing) @@ -64,9 +64,9 @@ value = SecureRandom.hex(3) dc.set(key, oldvalue) - refute Thread.current[Dalli::QUIET] + refute_operator Thread.current, :[], Dalli::QUIET dc.quiet do - assert Thread.current[Dalli::QUIET] + assert_operator Thread.current, :[], Dalli::QUIET # Response should be nil assert_nil dc.replace(key, value) @@ -75,7 +75,7 @@ assert_nil dc.replace(nonexistent, value) end - refute Thread.current[Dalli::QUIET] + refute_operator Thread.current, :[], Dalli::QUIET assert_equal value, dc.get(key) assert_nil dc.get(nonexistent) @@ -91,9 +91,9 @@ value = SecureRandom.hex(3) dc.set(existing, value) - refute Thread.current[Dalli::QUIET] + refute_operator Thread.current, :[], Dalli::QUIET dc.quiet do - assert Thread.current[Dalli::QUIET] + assert_operator Thread.current, :[], Dalli::QUIET # Response should be nil assert_nil dc.delete(existing) @@ -102,7 +102,7 @@ assert_nil dc.delete(key) end - refute Thread.current[Dalli::QUIET] + refute_operator Thread.current, :[], Dalli::QUIET assert_nil dc.get(existing) assert_nil dc.get(key) @@ -117,15 +117,15 @@ value = SecureRandom.hex(3) dc.set(key, value, 90, raw: true) - refute Thread.current[Dalli::QUIET] + refute_operator Thread.current, :[], Dalli::QUIET dc.quiet do - assert Thread.current[Dalli::QUIET] + assert_operator Thread.current, :[], Dalli::QUIET # Response should be nil assert_nil dc.append(key, 'abc') end - refute Thread.current[Dalli::QUIET] + refute_operator Thread.current, :[], Dalli::QUIET assert_equal "#{value}abc", dc.get(key) end @@ -139,15 +139,15 @@ value = SecureRandom.hex(3) dc.set(key, value, 90, raw: true) - refute Thread.current[Dalli::QUIET] + refute_operator Thread.current, :[], Dalli::QUIET dc.quiet do - assert Thread.current[Dalli::QUIET] + assert_operator Thread.current, :[], Dalli::QUIET # Response should be nil assert_nil dc.prepend(key, 'abc') end - refute Thread.current[Dalli::QUIET] + refute_operator Thread.current, :[], Dalli::QUIET assert_equal "abc#{value}", dc.get(key) end @@ -162,15 +162,15 @@ incr = 134 dc.set(key, value, 90, raw: true) - refute Thread.current[Dalli::QUIET] + refute_operator Thread.current, :[], Dalli::QUIET dc.quiet do - assert Thread.current[Dalli::QUIET] + assert_operator Thread.current, :[], Dalli::QUIET # Response should be nil assert_nil dc.incr(key, incr) end - refute Thread.current[Dalli::QUIET] + refute_operator Thread.current, :[], Dalli::QUIET assert_equal 680, dc.get(key).to_i end @@ -185,9 +185,9 @@ incr = 134 dc.set(key, value, 90, raw: true) - refute Thread.current[Dalli::QUIET] + refute_operator Thread.current, :[], Dalli::QUIET dc.quiet do - assert Thread.current[Dalli::QUIET] + assert_operator Thread.current, :[], Dalli::QUIET # Response should be nil assert_nil dc.decr(key, incr) @@ -202,9 +202,9 @@ dc.close dc.flush - refute Thread.current[Dalli::QUIET] + refute_operator Thread.current, :[], Dalli::QUIET dc.quiet do - assert Thread.current[Dalli::QUIET] + assert_operator Thread.current, :[], Dalli::QUIET # Response should be a non-empty array of nils arr = dc.flush(90) @@ -213,7 +213,7 @@ assert arr.all?(&:nil?) end - refute Thread.current[Dalli::QUIET] + refute_operator Thread.current, :[], Dalli::QUIET end end @@ -227,13 +227,13 @@ assert_equal 'av', dc.get('a') assert_equal 'bv', dc.get('b') - refute Thread.current[Dalli::QUIET] + refute_operator Thread.current, :[], Dalli::QUIET dc.multi do - assert Thread.current[Dalli::QUIET] + assert_operator Thread.current, :[], Dalli::QUIET dc.delete('non_existent_key') end - refute Thread.current[Dalli::QUIET] + refute_operator Thread.current, :[], Dalli::QUIET assert_equal 'av', dc.get('a') assert_equal 'bv', dc.get('b') end @@ -249,15 +249,15 @@ assert_equal 'av', dc.get('a') assert_equal 'bv', dc.get('b') - refute Thread.current[Dalli::QUIET] + refute_operator Thread.current, :[], Dalli::QUIET dc.multi do - assert Thread.current[Dalli::QUIET] + assert_operator Thread.current, :[], Dalli::QUIET assert_raises Dalli::NotPermittedMultiOpError do dc.get('a') end end - refute Thread.current[Dalli::QUIET] + refute_operator Thread.current, :[], Dalli::QUIET end end diff --git a/test/test_client_options.rb b/test/test_client_options.rb index 2b7f0391..43a6a8e7 100644 --- a/test/test_client_options.rb +++ b/test/test_client_options.rb @@ -6,7 +6,7 @@ it 'not warn about valid options' do dc = Dalli::Client.new('foo', compress: true) # Rails.logger.expects :warn - assert dc.instance_variable_get(:@options)[:compress] + assert_operator dc.instance_variable_get(:@options), :[], :compress end describe 'servers configuration' do diff --git a/test/test_ring.rb b/test/test_ring.rb index 765df099..41264fe6 100644 --- a/test/test_ring.rb +++ b/test/test_ring.rb @@ -21,7 +21,7 @@ def weight ring = Dalli::Ring.new(servers, TestServer, {}) previous_value = 0 ring.continuum.each do |entry| - assert entry.value > previous_value + assert_operator entry.value, :>, previous_value previous_value = entry.value end end