test/redis/store/ttl_test.rb in redis-store-1.9.1 vs test/redis/store/ttl_test.rb in redis-store-1.9.2
- old
+ new
@@ -64,26 +64,26 @@
describe '#set' do
describe 'without options' do
it 'must call super with key and value' do
redis.set(key, mock_value)
- redis.has_set?(key, mock_value, nil).must_equal true
+ _(redis.has_set?(key, mock_value, nil)).must_equal true
end
end
describe 'with options' do
it 'must call setex with proper expiry and set raw to true' do
redis.set(key, mock_value, options)
- redis.has_setex?(key, options[:expire_after], mock_value, :raw => true).must_equal true
+ _(redis.has_setex?(key, options[:expire_after], mock_value, :raw => true)).must_equal true
end
end
describe 'with nx and ex option' do
it 'must call super with key and value and options' do
set_options = { nx: true, ex: 3600 }
redis.set(key, mock_value, set_options)
- redis.has_set?(key, mock_value, set_options).must_equal true
+ _(redis.has_set?(key, mock_value, set_options)).must_equal true
end
end
end
describe '#setnx' do
@@ -103,36 +103,26 @@
it 'uses the mutli command to chain commands' do
redis.expects(:multi)
redis.setnx(key, mock_value, options)
end
- it 'must call setnx with key and value and set raw to true' do
- redis.setnx(key, mock_value, options)
- redis.has_setnx?(key, mock_value, :raw => true).must_equal true
- end
-
it 'must call expire' do
redis.setnx(key, mock_value, options)
- redis.has_expire?(key, options[:expire_after]).must_equal true
+ _(redis.has_expire?(key, options[:expire_after])).must_equal true
end
describe 'avoiding multi commands' do
let(:options) { { :expire_after => 3600, :avoid_multi_commands => true } }
it 'uses the redis pipelined feature to chain commands' do
redis.expects(:pipelined)
redis.setnx(key, mock_value, options)
end
- it 'must call setnx with key and value and set raw to true' do
- redis.setnx(key, mock_value, options)
- redis.has_setnx?(key, mock_value, :raw => true).must_equal true
- end
-
it 'must call expire' do
redis.setnx(key, mock_value, options)
- redis.has_expire?(key, options[:expire_after]).must_equal true
+ _(redis.has_expire?(key, options[:expire_after])).must_equal true
end
end
describe 'using a redis cluster' do
let(:options) { { :expire_after => 3600, :cluster => %w[redis://127.0.0.1:6379/0] } }
@@ -140,17 +130,12 @@
it 'uses the redis pipelined feature to chain commands' do
redis.expects(:pipelined)
redis.setnx(key, mock_value, options)
end
- it 'must call setnx with key and value and set raw to true' do
- redis.setnx(key, mock_value, options)
- redis.has_setnx?(key, mock_value, :raw => true).must_equal true
- end
-
it 'must call expire' do
redis.setnx(key, mock_value, options)
- redis.has_expire?(key, options[:expire_after]).must_equal true
+ _(redis.has_expire?(key, options[:expire_after])).must_equal true
end
end
end
end
end