mock_redis 0.14.1 → 0.15.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
 - data/.gitignore +1 -0
 - data/.overcommit.yml +1 -1
 - data/.rubocop.yml +91 -0
 - data/.simplecov +4 -0
 - data/.travis.yml +14 -2
 - data/CHANGELOG.md +4 -0
 - data/Gemfile +4 -2
 - data/README.md +1 -0
 - data/Rakefile +2 -2
 - data/lib/mock_redis.rb +25 -26
 - data/lib/mock_redis/assertions.rb +0 -1
 - data/lib/mock_redis/database.rb +35 -28
 - data/lib/mock_redis/expire_wrapper.rb +1 -1
 - data/lib/mock_redis/future.rb +1 -1
 - data/lib/mock_redis/hash_methods.rb +18 -17
 - data/lib/mock_redis/indifferent_hash.rb +4 -0
 - data/lib/mock_redis/info_method.rb +109 -108
 - data/lib/mock_redis/list_methods.rb +17 -16
 - data/lib/mock_redis/multi_db_wrapper.rb +5 -4
 - data/lib/mock_redis/pipelined_wrapper.rb +3 -3
 - data/lib/mock_redis/set_methods.rb +10 -9
 - data/lib/mock_redis/sort_method.rb +11 -12
 - data/lib/mock_redis/string_methods.rb +26 -29
 - data/lib/mock_redis/transaction_wrapper.rb +7 -8
 - data/lib/mock_redis/utility_methods.rb +9 -12
 - data/lib/mock_redis/version.rb +1 -1
 - data/lib/mock_redis/zset.rb +22 -23
 - data/lib/mock_redis/zset_methods.rb +25 -25
 - data/spec/cloning_spec.rb +17 -18
 - data/spec/commands/append_spec.rb +4 -4
 - data/spec/commands/auth_spec.rb +1 -1
 - data/spec/commands/bgrewriteaof_spec.rb +2 -2
 - data/spec/commands/bgsave_spec.rb +2 -2
 - data/spec/commands/bitcount_spec.rb +3 -3
 - data/spec/commands/blpop_spec.rb +10 -10
 - data/spec/commands/brpop_spec.rb +10 -10
 - data/spec/commands/brpoplpush_spec.rb +9 -9
 - data/spec/commands/connected_spec.rb +2 -2
 - data/spec/commands/dbsize_spec.rb +3 -3
 - data/spec/commands/decr_spec.rb +7 -7
 - data/spec/commands/decrby_spec.rb +7 -7
 - data/spec/commands/del_spec.rb +4 -4
 - data/spec/commands/disconnect_spec.rb +2 -2
 - data/spec/commands/echo_spec.rb +4 -4
 - data/spec/commands/exists_spec.rb +3 -3
 - data/spec/commands/expire_spec.rb +13 -13
 - data/spec/commands/expireat_spec.rb +6 -7
 - data/spec/commands/flushall_spec.rb +5 -5
 - data/spec/commands/flushdb_spec.rb +5 -5
 - data/spec/commands/future_spec.rb +2 -2
 - data/spec/commands/get_spec.rb +7 -7
 - data/spec/commands/getbit_spec.rb +6 -6
 - data/spec/commands/getrange_spec.rb +9 -9
 - data/spec/commands/getset_spec.rb +7 -7
 - data/spec/commands/hash_operator_spec.rb +5 -5
 - data/spec/commands/hdel_spec.rb +12 -12
 - data/spec/commands/hexists_spec.rb +7 -7
 - data/spec/commands/hget_spec.rb +7 -7
 - data/spec/commands/hgetall_spec.rb +6 -6
 - data/spec/commands/hincrby_spec.rb +14 -14
 - data/spec/commands/hincrbyfloat_spec.rb +14 -14
 - data/spec/commands/hkeys_spec.rb +5 -5
 - data/spec/commands/hlen_spec.rb +5 -5
 - data/spec/commands/hmget_spec.rb +8 -8
 - data/spec/commands/hmset_spec.rb +10 -10
 - data/spec/commands/hset_spec.rb +11 -11
 - data/spec/commands/hsetnx_spec.rb +14 -14
 - data/spec/commands/hvals_spec.rb +5 -5
 - data/spec/commands/incr_spec.rb +7 -7
 - data/spec/commands/incrby_spec.rb +11 -11
 - data/spec/commands/incrbyfloat_spec.rb +11 -11
 - data/spec/commands/info_spec.rb +30 -30
 - data/spec/commands/keys_spec.rb +42 -43
 - data/spec/commands/lastsave_spec.rb +2 -2
 - data/spec/commands/lindex_spec.rb +15 -15
 - data/spec/commands/linsert_spec.rb +13 -13
 - data/spec/commands/llen_spec.rb +4 -4
 - data/spec/commands/lpop_spec.rb +6 -6
 - data/spec/commands/lpush_spec.rb +16 -16
 - data/spec/commands/lpushx_spec.rb +13 -13
 - data/spec/commands/lrange_spec.rb +12 -12
 - data/spec/commands/lrem_spec.rb +15 -15
 - data/spec/commands/lset_spec.rb +12 -12
 - data/spec/commands/ltrim_spec.rb +9 -9
 - data/spec/commands/mapped_hmget_spec.rb +8 -8
 - data/spec/commands/mapped_hmset_spec.rb +12 -12
 - data/spec/commands/mapped_mget_spec.rb +4 -4
 - data/spec/commands/mapped_mset_spec.rb +1 -1
 - data/spec/commands/mget_spec.rb +11 -11
 - data/spec/commands/move_spec.rb +29 -29
 - data/spec/commands/mset_spec.rb +4 -4
 - data/spec/commands/msetnx_spec.rb +10 -10
 - data/spec/commands/persist_spec.rb +9 -10
 - data/spec/commands/pexpire_spec.rb +12 -13
 - data/spec/commands/pexpireat_spec.rb +6 -6
 - data/spec/commands/ping_spec.rb +1 -1
 - data/spec/commands/pipelined_spec.rb +5 -5
 - data/spec/commands/pttl_spec.rb +5 -5
 - data/spec/commands/randomkey_spec.rb +3 -3
 - data/spec/commands/rename_spec.rb +9 -9
 - data/spec/commands/renamenx_spec.rb +10 -10
 - data/spec/commands/rpop_spec.rb +6 -6
 - data/spec/commands/rpoplpush_spec.rb +7 -7
 - data/spec/commands/rpush_spec.rb +16 -16
 - data/spec/commands/rpushx_spec.rb +13 -13
 - data/spec/commands/sadd_spec.rb +8 -9
 - data/spec/commands/scan_spec.rb +6 -7
 - data/spec/commands/scard_spec.rb +3 -3
 - data/spec/commands/sdiff_spec.rb +10 -10
 - data/spec/commands/sdiffstore_spec.rb +10 -10
 - data/spec/commands/select_spec.rb +7 -7
 - data/spec/commands/setbit_spec.rb +13 -13
 - data/spec/commands/setex_spec.rb +4 -4
 - data/spec/commands/setnx_spec.rb +4 -4
 - data/spec/commands/setrange_spec.rb +12 -12
 - data/spec/commands/sinter_spec.rb +8 -10
 - data/spec/commands/sinterstore_spec.rb +9 -9
 - data/spec/commands/sismember_spec.rb +5 -5
 - data/spec/commands/smembers_spec.rb +5 -5
 - data/spec/commands/smove_spec.rb +7 -7
 - data/spec/commands/sort_list_spec.rb +3 -3
 - data/spec/commands/sort_set_spec.rb +3 -3
 - data/spec/commands/sort_zset_spec.rb +3 -3
 - data/spec/commands/spop_spec.rb +4 -4
 - data/spec/commands/srandmember_spec.rb +8 -8
 - data/spec/commands/srem_spec.rb +9 -9
 - data/spec/commands/strlen_spec.rb +4 -4
 - data/spec/commands/sunion_spec.rb +7 -9
 - data/spec/commands/sunionstore_spec.rb +9 -9
 - data/spec/commands/ttl_spec.rb +5 -5
 - data/spec/commands/type_spec.rb +1 -1
 - data/spec/commands/zadd_spec.rb +10 -10
 - data/spec/commands/zcard_spec.rb +4 -4
 - data/spec/commands/zcount_spec.rb +14 -14
 - data/spec/commands/zincrby_spec.rb +6 -6
 - data/spec/commands/zinterstore_spec.rb +17 -17
 - data/spec/commands/zrange_spec.rb +12 -12
 - data/spec/commands/zrangebyscore_spec.rb +26 -26
 - data/spec/commands/zrank_spec.rb +4 -4
 - data/spec/commands/zrem_spec.rb +9 -9
 - data/spec/commands/zremrangebyrank_spec.rb +5 -5
 - data/spec/commands/zremrangebyscore_spec.rb +9 -7
 - data/spec/commands/zrevrange_spec.rb +10 -10
 - data/spec/commands/zrevrangebyscore_spec.rb +14 -14
 - data/spec/commands/zrevrank_spec.rb +4 -4
 - data/spec/commands/zscore_spec.rb +5 -5
 - data/spec/commands/zunionstore_spec.rb +18 -18
 - data/spec/mock_redis_spec.rb +11 -1
 - data/spec/spec_helper.rb +13 -4
 - data/spec/support/redis_multiplexer.rb +39 -31
 - data/spec/support/shared_examples/only_operates_on_hashes.rb +2 -2
 - data/spec/support/shared_examples/only_operates_on_lists.rb +2 -2
 - data/spec/support/shared_examples/only_operates_on_sets.rb +2 -2
 - data/spec/support/shared_examples/only_operates_on_strings.rb +3 -3
 - data/spec/support/shared_examples/only_operates_on_zsets.rb +12 -12
 - data/spec/support/shared_examples/sorts_enumerables.rb +12 -12
 - data/spec/transactions_spec.rb +18 -18
 - metadata +5 -3
 
| 
         @@ -7,23 +7,23 @@ describe '#sismember(key, member)' do 
     | 
|
| 
       7 
7 
     | 
    
         
             
                @redises.sadd(@key, 'beer')
         
     | 
| 
       8 
8 
     | 
    
         
             
              end
         
     | 
| 
       9 
9 
     | 
    
         | 
| 
       10 
     | 
    
         
            -
              it  
     | 
| 
      
 10 
     | 
    
         
            +
              it 'returns true if member is in set' do
         
     | 
| 
       11 
11 
     | 
    
         
             
                @redises.sismember(@key, 'whiskey').should == true
         
     | 
| 
       12 
12 
     | 
    
         
             
                @redises.sismember(@key, 'beer').should == true
         
     | 
| 
       13 
13 
     | 
    
         
             
              end
         
     | 
| 
       14 
14 
     | 
    
         | 
| 
       15 
     | 
    
         
            -
              it  
     | 
| 
      
 15 
     | 
    
         
            +
              it 'returns false if member is not in set' do
         
     | 
| 
       16 
16 
     | 
    
         
             
                @redises.sismember(@key, 'cola').should == false
         
     | 
| 
       17 
17 
     | 
    
         
             
              end
         
     | 
| 
       18 
18 
     | 
    
         | 
| 
       19 
     | 
    
         
            -
              it  
     | 
| 
      
 19 
     | 
    
         
            +
              it 'stringifies member' do
         
     | 
| 
       20 
20 
     | 
    
         
             
                @redises.sadd(@key, '1')
         
     | 
| 
       21 
21 
     | 
    
         
             
                @redises.sismember(@key, 1).should == true
         
     | 
| 
       22 
22 
     | 
    
         
             
              end
         
     | 
| 
       23 
23 
     | 
    
         | 
| 
       24 
     | 
    
         
            -
              it  
     | 
| 
      
 24 
     | 
    
         
            +
              it 'treats a nonexistent value as an empty set' do
         
     | 
| 
       25 
25 
     | 
    
         
             
                @redises.sismember('mock-redis-test:nonesuch', 'beer').should == false
         
     | 
| 
       26 
26 
     | 
    
         
             
              end
         
     | 
| 
       27 
27 
     | 
    
         | 
| 
       28 
     | 
    
         
            -
              it_should_behave_like  
     | 
| 
      
 28 
     | 
    
         
            +
              it_should_behave_like 'a set-only command'
         
     | 
| 
       29 
29 
     | 
    
         
             
            end
         
     | 
| 
         @@ -3,14 +3,14 @@ require 'spec_helper' 
     | 
|
| 
       3 
3 
     | 
    
         
             
            describe '#smembers(key)' do
         
     | 
| 
       4 
4 
     | 
    
         
             
              before { @key = 'mock-redis-test:smembers' }
         
     | 
| 
       5 
5 
     | 
    
         | 
| 
       6 
     | 
    
         
            -
              it  
     | 
| 
      
 6 
     | 
    
         
            +
              it 'returns [] for an empty set' do
         
     | 
| 
       7 
7 
     | 
    
         
             
                @redises.smembers(@key).should == []
         
     | 
| 
       8 
8 
     | 
    
         
             
              end
         
     | 
| 
       9 
9 
     | 
    
         | 
| 
       10 
10 
     | 
    
         
             
              it "returns the set's members" do
         
     | 
| 
       11 
     | 
    
         
            -
                @redises.sadd(@key,  
     | 
| 
       12 
     | 
    
         
            -
                @redises.sadd(@key,  
     | 
| 
       13 
     | 
    
         
            -
                @redises.sadd(@key,  
     | 
| 
      
 11 
     | 
    
         
            +
                @redises.sadd(@key, 'Hello')
         
     | 
| 
      
 12 
     | 
    
         
            +
                @redises.sadd(@key, 'World')
         
     | 
| 
      
 13 
     | 
    
         
            +
                @redises.sadd(@key, 'Test')
         
     | 
| 
       14 
14 
     | 
    
         
             
                @redises.smembers(@key).should == %w[Test World Hello]
         
     | 
| 
       15 
15 
     | 
    
         
             
              end
         
     | 
| 
       16 
16 
     | 
    
         | 
| 
         @@ -24,5 +24,5 @@ describe '#smembers(key)' do 
     | 
|
| 
       24 
24 
     | 
    
         
             
                expect(output).to_not be_frozen
         
     | 
| 
       25 
25 
     | 
    
         
             
              end
         
     | 
| 
       26 
26 
     | 
    
         | 
| 
       27 
     | 
    
         
            -
              it_should_behave_like  
     | 
| 
      
 27 
     | 
    
         
            +
              it_should_behave_like 'a set-only command'
         
     | 
| 
       28 
28 
     | 
    
         
             
            end
         
     | 
    
        data/spec/commands/smove_spec.rb
    CHANGED
    
    | 
         @@ -9,33 +9,33 @@ describe '#smove(source, destination, member)' do 
     | 
|
| 
       9 
9 
     | 
    
         
             
                @redises.sadd(@dest, 2)
         
     | 
| 
       10 
10 
     | 
    
         
             
              end
         
     | 
| 
       11 
11 
     | 
    
         | 
| 
       12 
     | 
    
         
            -
              it  
     | 
| 
      
 12 
     | 
    
         
            +
              it 'returns true if the member exists in src' do
         
     | 
| 
       13 
13 
     | 
    
         
             
                @redises.smove(@src, @dest, 1).should == true
         
     | 
| 
       14 
14 
     | 
    
         
             
              end
         
     | 
| 
       15 
15 
     | 
    
         | 
| 
       16 
     | 
    
         
            -
              it  
     | 
| 
      
 16 
     | 
    
         
            +
              it 'returns false if the member exists in src' do
         
     | 
| 
       17 
17 
     | 
    
         
             
                @redises.smove(@src, @dest, 'nope').should == false
         
     | 
| 
       18 
18 
     | 
    
         
             
              end
         
     | 
| 
       19 
19 
     | 
    
         | 
| 
       20 
     | 
    
         
            -
              it  
     | 
| 
      
 20 
     | 
    
         
            +
              it 'returns true if the member exists in src and dest' do
         
     | 
| 
       21 
21 
     | 
    
         
             
                @redises.sadd(@dest, 1)
         
     | 
| 
       22 
22 
     | 
    
         
             
                @redises.smove(@src, @dest, 1).should == true
         
     | 
| 
       23 
23 
     | 
    
         
             
              end
         
     | 
| 
       24 
24 
     | 
    
         | 
| 
       25 
     | 
    
         
            -
              it  
     | 
| 
      
 25 
     | 
    
         
            +
              it 'moves member from source to destination' do
         
     | 
| 
       26 
26 
     | 
    
         
             
                @redises.smove(@src, @dest, 1)
         
     | 
| 
       27 
27 
     | 
    
         
             
                @redises.sismember(@dest, 1).should == true
         
     | 
| 
       28 
28 
     | 
    
         
             
                @redises.sismember(@src, 1).should == false
         
     | 
| 
       29 
29 
     | 
    
         
             
              end
         
     | 
| 
       30 
30 
     | 
    
         | 
| 
       31 
     | 
    
         
            -
              it  
     | 
| 
      
 31 
     | 
    
         
            +
              it 'cleans up empty sets' do
         
     | 
| 
       32 
32 
     | 
    
         
             
                @redises.smove(@src, @dest, 1)
         
     | 
| 
       33 
33 
     | 
    
         
             
                @redises.get(@src).should be_nil
         
     | 
| 
       34 
34 
     | 
    
         
             
              end
         
     | 
| 
       35 
35 
     | 
    
         | 
| 
       36 
     | 
    
         
            -
              it  
     | 
| 
      
 36 
     | 
    
         
            +
              it 'treats a nonexistent value as an empty set' do
         
     | 
| 
       37 
37 
     | 
    
         
             
                @redises.smove('mock-redis-test:nonesuch', @dest, 1).should == false
         
     | 
| 
       38 
38 
     | 
    
         
             
              end
         
     | 
| 
       39 
39 
     | 
    
         | 
| 
       40 
     | 
    
         
            -
              it_should_behave_like  
     | 
| 
      
 40 
     | 
    
         
            +
              it_should_behave_like 'a set-only command'
         
     | 
| 
       41 
41 
     | 
    
         
             
            end
         
     | 
| 
         @@ -2,7 +2,7 @@ require 'spec_helper' 
     | 
|
| 
       2 
2 
     | 
    
         | 
| 
       3 
3 
     | 
    
         
             
            describe '#sort(key, options)' do
         
     | 
| 
       4 
4 
     | 
    
         
             
              before do
         
     | 
| 
       5 
     | 
    
         
            -
                @key =  
     | 
| 
      
 5 
     | 
    
         
            +
                @key = 'mock-redis-test:list_sort'
         
     | 
| 
       6 
6 
     | 
    
         | 
| 
       7 
7 
     | 
    
         
             
                @redises.rpush(@key, '1')
         
     | 
| 
       8 
8 
     | 
    
         
             
                @redises.rpush(@key, '2')
         
     | 
| 
         @@ -17,5 +17,5 @@ describe '#sort(key, options)' do 
     | 
|
| 
       17 
17 
     | 
    
         
             
                @redises.hset('mock-redis-test:hash_2', 'key', 'y')
         
     | 
| 
       18 
18 
     | 
    
         
             
              end
         
     | 
| 
       19 
19 
     | 
    
         | 
| 
       20 
     | 
    
         
            -
              it_should_behave_like  
     | 
| 
       21 
     | 
    
         
            -
            end
         
     | 
| 
      
 20 
     | 
    
         
            +
              it_should_behave_like 'a sortable'
         
     | 
| 
      
 21 
     | 
    
         
            +
            end
         
     | 
| 
         @@ -2,7 +2,7 @@ require 'spec_helper' 
     | 
|
| 
       2 
2 
     | 
    
         | 
| 
       3 
3 
     | 
    
         
             
            describe '#sort(key, options)' do
         
     | 
| 
       4 
4 
     | 
    
         
             
              before do
         
     | 
| 
       5 
     | 
    
         
            -
                @key =  
     | 
| 
      
 5 
     | 
    
         
            +
                @key = 'mock-redis-test:set_sort'
         
     | 
| 
       6 
6 
     | 
    
         | 
| 
       7 
7 
     | 
    
         
             
                @redises.sadd(@key, '1')
         
     | 
| 
       8 
8 
     | 
    
         
             
                @redises.sadd(@key, '2')
         
     | 
| 
         @@ -17,5 +17,5 @@ describe '#sort(key, options)' do 
     | 
|
| 
       17 
17 
     | 
    
         
             
                @redises.hset('mock-redis-test:hash_2', 'key', 'y')
         
     | 
| 
       18 
18 
     | 
    
         
             
              end
         
     | 
| 
       19 
19 
     | 
    
         | 
| 
       20 
     | 
    
         
            -
              it_should_behave_like  
     | 
| 
       21 
     | 
    
         
            -
            end
         
     | 
| 
      
 20 
     | 
    
         
            +
              it_should_behave_like 'a sortable'
         
     | 
| 
      
 21 
     | 
    
         
            +
            end
         
     | 
| 
         @@ -2,7 +2,7 @@ require 'spec_helper' 
     | 
|
| 
       2 
2 
     | 
    
         | 
| 
       3 
3 
     | 
    
         
             
            describe '#sort(key, options)' do
         
     | 
| 
       4 
4 
     | 
    
         
             
              before do
         
     | 
| 
       5 
     | 
    
         
            -
                @key =  
     | 
| 
      
 5 
     | 
    
         
            +
                @key = 'mock-redis-test:zset_sort'
         
     | 
| 
       6 
6 
     | 
    
         | 
| 
       7 
7 
     | 
    
         
             
                @redises.zadd(@key, 100, '1')
         
     | 
| 
       8 
8 
     | 
    
         
             
                @redises.zadd(@key, 99, '2')
         
     | 
| 
         @@ -17,5 +17,5 @@ describe '#sort(key, options)' do 
     | 
|
| 
       17 
17 
     | 
    
         
             
                @redises.hset('mock-redis-test:hash_2', 'key', 'y')
         
     | 
| 
       18 
18 
     | 
    
         
             
              end
         
     | 
| 
       19 
19 
     | 
    
         | 
| 
       20 
     | 
    
         
            -
              it_should_behave_like  
     | 
| 
       21 
     | 
    
         
            -
            end
         
     | 
| 
      
 20 
     | 
    
         
            +
              it_should_behave_like 'a sortable'
         
     | 
| 
      
 21 
     | 
    
         
            +
            end
         
     | 
    
        data/spec/commands/spop_spec.rb
    CHANGED
    
    | 
         @@ -7,19 +7,19 @@ describe '#spop(key)' do 
     | 
|
| 
       7 
7 
     | 
    
         
             
                @redises.sadd(@key, 'value')
         
     | 
| 
       8 
8 
     | 
    
         
             
              end
         
     | 
| 
       9 
9 
     | 
    
         | 
| 
       10 
     | 
    
         
            -
              it  
     | 
| 
      
 10 
     | 
    
         
            +
              it 'returns a member of the set' do
         
     | 
| 
       11 
11 
     | 
    
         
             
                @redises.spop(@key).should == 'value'
         
     | 
| 
       12 
12 
     | 
    
         
             
              end
         
     | 
| 
       13 
13 
     | 
    
         | 
| 
       14 
     | 
    
         
            -
              it  
     | 
| 
      
 14 
     | 
    
         
            +
              it 'removes a member of the set' do
         
     | 
| 
       15 
15 
     | 
    
         
             
                @redises.spop(@key)
         
     | 
| 
       16 
16 
     | 
    
         
             
                @redises.smembers(@key).should == []
         
     | 
| 
       17 
17 
     | 
    
         
             
              end
         
     | 
| 
       18 
18 
     | 
    
         | 
| 
       19 
     | 
    
         
            -
              it  
     | 
| 
      
 19 
     | 
    
         
            +
              it 'returns nil if the set is empty' do
         
     | 
| 
       20 
20 
     | 
    
         
             
                @redises.spop(@key)
         
     | 
| 
       21 
21 
     | 
    
         
             
                @redises.spop(@key).should be_nil
         
     | 
| 
       22 
22 
     | 
    
         
             
              end
         
     | 
| 
       23 
23 
     | 
    
         | 
| 
       24 
     | 
    
         
            -
              it_should_behave_like  
     | 
| 
      
 24 
     | 
    
         
            +
              it_should_behave_like 'a set-only command'
         
     | 
| 
       25 
25 
     | 
    
         
             
            end
         
     | 
| 
         @@ -7,21 +7,21 @@ describe '#srandmember(key)' do 
     | 
|
| 
       7 
7 
     | 
    
         
             
                @redises.sadd(@key, 'value')
         
     | 
| 
       8 
8 
     | 
    
         
             
              end
         
     | 
| 
       9 
9 
     | 
    
         | 
| 
       10 
     | 
    
         
            -
              it  
     | 
| 
      
 10 
     | 
    
         
            +
              it 'returns a member of the set' do
         
     | 
| 
       11 
11 
     | 
    
         
             
                @redises.srandmember(@key).should == 'value'
         
     | 
| 
       12 
12 
     | 
    
         
             
              end
         
     | 
| 
       13 
13 
     | 
    
         | 
| 
       14 
     | 
    
         
            -
              it  
     | 
| 
      
 14 
     | 
    
         
            +
              it 'does not modify the set' do
         
     | 
| 
       15 
15 
     | 
    
         
             
                @redises.srandmember(@key)
         
     | 
| 
       16 
16 
     | 
    
         
             
                @redises.smembers(@key).should == ['value']
         
     | 
| 
       17 
17 
     | 
    
         
             
              end
         
     | 
| 
       18 
18 
     | 
    
         | 
| 
       19 
     | 
    
         
            -
              it  
     | 
| 
      
 19 
     | 
    
         
            +
              it 'returns nil if the set is empty' do
         
     | 
| 
       20 
20 
     | 
    
         
             
                @redises.spop(@key)
         
     | 
| 
       21 
21 
     | 
    
         
             
                @redises.srandmember(@key).should be_nil
         
     | 
| 
       22 
22 
     | 
    
         
             
              end
         
     | 
| 
       23 
23 
     | 
    
         | 
| 
       24 
     | 
    
         
            -
              context  
     | 
| 
      
 24 
     | 
    
         
            +
              context 'when count argument is specified' do
         
     | 
| 
       25 
25 
     | 
    
         
             
                before do
         
     | 
| 
       26 
26 
     | 
    
         
             
                  @redises.sadd(@key, 'value2')
         
     | 
| 
       27 
27 
     | 
    
         
             
                  @redises.sadd(@key, 'value3')
         
     | 
| 
         @@ -29,19 +29,19 @@ describe '#srandmember(key)' do 
     | 
|
| 
       29 
29 
     | 
    
         | 
| 
       30 
30 
     | 
    
         
             
                # NOTE: We disable result checking since MockRedis and Redis will likely
         
     | 
| 
       31 
31 
     | 
    
         
             
                # return a different random set (since the selection is, well, random)
         
     | 
| 
       32 
     | 
    
         
            -
                it  
     | 
| 
      
 32 
     | 
    
         
            +
                it 'returns the whole set if count is greater than the set size' do
         
     | 
| 
       33 
33 
     | 
    
         
             
                  @redises.send_without_checking(:srandmember, @key, 5).should =~ %w[value value2 value3]
         
     | 
| 
       34 
34 
     | 
    
         
             
                end
         
     | 
| 
       35 
35 
     | 
    
         | 
| 
       36 
     | 
    
         
            -
                it  
     | 
| 
      
 36 
     | 
    
         
            +
                it 'returns random members up to count from the set when count is smaller than the set size' do
         
     | 
| 
       37 
37 
     | 
    
         
             
                  @redises.send_without_checking(:srandmember, @key, 2).size.should == 2
         
     | 
| 
       38 
38 
     | 
    
         
             
                end
         
     | 
| 
       39 
39 
     | 
    
         | 
| 
       40 
     | 
    
         
            -
                it  
     | 
| 
      
 40 
     | 
    
         
            +
                it 'returns random members up to count from the set when count is negative even if count.abs is greater than the set size' do # rubocop:disable Metrics/LineLength
         
     | 
| 
       41 
41 
     | 
    
         
             
                  @redises.send_without_checking(:srandmember, @key, -5).size.should == 5
         
     | 
| 
       42 
42 
     | 
    
         
             
                end
         
     | 
| 
       43 
43 
     | 
    
         | 
| 
       44 
     | 
    
         
            -
                it  
     | 
| 
      
 44 
     | 
    
         
            +
                it 'returns nil if the set is empty' do
         
     | 
| 
       45 
45 
     | 
    
         
             
                  @redises.srem(@key, %w[value value2 value3])
         
     | 
| 
       46 
46 
     | 
    
         
             
                  @redises.srandmember(@key, 2).should be_empty
         
     | 
| 
       47 
47 
     | 
    
         
             
                end
         
     | 
    
        data/spec/commands/srem_spec.rb
    CHANGED
    
    | 
         @@ -8,33 +8,33 @@ describe '#srem(key, member)' do 
     | 
|
| 
       8 
8 
     | 
    
         
             
                @redises.sadd(@key, 'ernie')
         
     | 
| 
       9 
9 
     | 
    
         
             
              end
         
     | 
| 
       10 
10 
     | 
    
         | 
| 
       11 
     | 
    
         
            -
              it  
     | 
| 
      
 11 
     | 
    
         
            +
              it 'returns true if member is in the set' do
         
     | 
| 
       12 
12 
     | 
    
         
             
                @redises.srem(@key, 'bert').should == true
         
     | 
| 
       13 
13 
     | 
    
         
             
              end
         
     | 
| 
       14 
14 
     | 
    
         | 
| 
       15 
     | 
    
         
            -
              it  
     | 
| 
      
 15 
     | 
    
         
            +
              it 'returns false if member is not in the set' do
         
     | 
| 
       16 
16 
     | 
    
         
             
                @redises.srem(@key, 'cookiemonster').should == false
         
     | 
| 
       17 
17 
     | 
    
         
             
              end
         
     | 
| 
       18 
18 
     | 
    
         | 
| 
       19 
     | 
    
         
            -
              it  
     | 
| 
      
 19 
     | 
    
         
            +
              it 'removes member from the set' do
         
     | 
| 
       20 
20 
     | 
    
         
             
                @redises.srem(@key, 'ernie')
         
     | 
| 
       21 
21 
     | 
    
         
             
                @redises.smembers(@key).should == ['bert']
         
     | 
| 
       22 
22 
     | 
    
         
             
              end
         
     | 
| 
       23 
23 
     | 
    
         | 
| 
       24 
     | 
    
         
            -
              it  
     | 
| 
      
 24 
     | 
    
         
            +
              it 'stringifies member' do
         
     | 
| 
       25 
25 
     | 
    
         
             
                @redises.sadd(@key, '1')
         
     | 
| 
       26 
26 
     | 
    
         
             
                @redises.srem(@key, 1).should == true
         
     | 
| 
       27 
27 
     | 
    
         
             
              end
         
     | 
| 
       28 
28 
     | 
    
         | 
| 
       29 
     | 
    
         
            -
              it  
     | 
| 
       30 
     | 
    
         
            -
                @redises.smembers(@key).each {|m| @redises.srem(@key, m)}
         
     | 
| 
      
 29 
     | 
    
         
            +
              it 'cleans up empty sets' do
         
     | 
| 
      
 30 
     | 
    
         
            +
                @redises.smembers(@key).each { |m| @redises.srem(@key, m) }
         
     | 
| 
       31 
31 
     | 
    
         
             
                @redises.get(@key).should be_nil
         
     | 
| 
       32 
32 
     | 
    
         
             
              end
         
     | 
| 
       33 
33 
     | 
    
         | 
| 
       34 
     | 
    
         
            -
              it  
     | 
| 
       35 
     | 
    
         
            -
                @redises.srem(@key, [ 
     | 
| 
      
 34 
     | 
    
         
            +
              it 'supports a variable number of arguments' do
         
     | 
| 
      
 35 
     | 
    
         
            +
                @redises.srem(@key, %w[bert ernie]).should == 2
         
     | 
| 
       36 
36 
     | 
    
         
             
                @redises.get(@key).should be_nil
         
     | 
| 
       37 
37 
     | 
    
         
             
              end
         
     | 
| 
       38 
38 
     | 
    
         | 
| 
       39 
     | 
    
         
            -
              it_should_behave_like  
     | 
| 
      
 39 
     | 
    
         
            +
              it_should_behave_like 'a set-only command'
         
     | 
| 
       40 
40 
     | 
    
         
             
            end
         
     | 
| 
         @@ -1,19 +1,19 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            # -*- coding: utf-8 -*-
         
     | 
| 
       2 
2 
     | 
    
         
             
            require 'spec_helper'
         
     | 
| 
       3 
3 
     | 
    
         | 
| 
       4 
     | 
    
         
            -
            describe  
     | 
| 
      
 4 
     | 
    
         
            +
            describe '#strlen(key)' do
         
     | 
| 
       5 
5 
     | 
    
         
             
              before do
         
     | 
| 
       6 
6 
     | 
    
         
             
                @key = 'mock-redis-test:73288'
         
     | 
| 
       7 
     | 
    
         
            -
                @redises.set(@key,  
     | 
| 
      
 7 
     | 
    
         
            +
                @redises.set(@key, '5 ∈ (0..10)')
         
     | 
| 
       8 
8 
     | 
    
         
             
              end
         
     | 
| 
       9 
9 
     | 
    
         | 
| 
       10 
10 
     | 
    
         
             
              it "returns the string's length in bytes" do
         
     | 
| 
       11 
11 
     | 
    
         
             
                @redises.strlen(@key).should == 13
         
     | 
| 
       12 
12 
     | 
    
         
             
              end
         
     | 
| 
       13 
13 
     | 
    
         | 
| 
       14 
     | 
    
         
            -
              it  
     | 
| 
      
 14 
     | 
    
         
            +
              it 'returns 0 for a nonexistent value' do
         
     | 
| 
       15 
15 
     | 
    
         
             
                @redises.strlen('mock-redis-test:does-not-exist').should == 0
         
     | 
| 
       16 
16 
     | 
    
         
             
              end
         
     | 
| 
       17 
17 
     | 
    
         | 
| 
       18 
     | 
    
         
            -
              it_should_behave_like  
     | 
| 
      
 18 
     | 
    
         
            +
              it_should_behave_like 'a string-only command'
         
     | 
| 
       19 
19 
     | 
    
         
             
            end
         
     | 
| 
         @@ -5,30 +5,30 @@ describe '#sunion(key [, key, ...])' do 
     | 
|
| 
       5 
5 
     | 
    
         
             
                @evens   = 'mock-redis-test:sunion:evens'
         
     | 
| 
       6 
6 
     | 
    
         
             
                @primes  = 'mock-redis-test:sunion:primes'
         
     | 
| 
       7 
7 
     | 
    
         | 
| 
       8 
     | 
    
         
            -
                [2, 4, 6, 8, 10].each {|i| @redises.sadd(@evens, i) }
         
     | 
| 
       9 
     | 
    
         
            -
                [2, 3, 5, 7].each {|i| @redises.sadd(@primes, i) }
         
     | 
| 
      
 8 
     | 
    
         
            +
                [2, 4, 6, 8, 10].each { |i| @redises.sadd(@evens, i) }
         
     | 
| 
      
 9 
     | 
    
         
            +
                [2, 3, 5, 7].each { |i| @redises.sadd(@primes, i) }
         
     | 
| 
       10 
10 
     | 
    
         
             
              end
         
     | 
| 
       11 
11 
     | 
    
         | 
| 
       12 
     | 
    
         
            -
              it  
     | 
| 
      
 12 
     | 
    
         
            +
              it 'returns the elements in the resulting set' do
         
     | 
| 
       13 
13 
     | 
    
         
             
                @redises.sunion(@evens, @primes).should == %w[2 4 6 8 10 3 5 7]
         
     | 
| 
       14 
14 
     | 
    
         
             
              end
         
     | 
| 
       15 
15 
     | 
    
         | 
| 
       16 
     | 
    
         
            -
              it  
     | 
| 
      
 16 
     | 
    
         
            +
              it 'treats missing keys as empty sets' do
         
     | 
| 
       17 
17 
     | 
    
         
             
                @redises.sunion(@primes, 'mock-redis-test:nonesuch').
         
     | 
| 
       18 
18 
     | 
    
         
             
                  should == %w[2 3 5 7]
         
     | 
| 
       19 
19 
     | 
    
         
             
              end
         
     | 
| 
       20 
20 
     | 
    
         | 
| 
       21 
     | 
    
         
            -
              it  
     | 
| 
      
 21 
     | 
    
         
            +
              it 'allows Array as argument' do
         
     | 
| 
       22 
22 
     | 
    
         
             
                @redises.sunion([@evens, @primes]).should == %w[2 4 6 8 10 3 5 7]
         
     | 
| 
       23 
23 
     | 
    
         
             
              end
         
     | 
| 
       24 
24 
     | 
    
         | 
| 
       25 
     | 
    
         
            -
              it  
     | 
| 
      
 25 
     | 
    
         
            +
              it 'raises an error if given 0 sets' do
         
     | 
| 
       26 
26 
     | 
    
         
             
                lambda do
         
     | 
| 
       27 
27 
     | 
    
         
             
                  @redises.sunion
         
     | 
| 
       28 
28 
     | 
    
         
             
                end.should raise_error(RuntimeError)
         
     | 
| 
       29 
29 
     | 
    
         
             
              end
         
     | 
| 
       30 
30 
     | 
    
         | 
| 
       31 
     | 
    
         
            -
              it  
     | 
| 
      
 31 
     | 
    
         
            +
              it 'raises an error if any argument is not a a set' do
         
     | 
| 
       32 
32 
     | 
    
         
             
                @redises.set('mock-redis-test:notset', 1)
         
     | 
| 
       33 
33 
     | 
    
         | 
| 
       34 
34 
     | 
    
         
             
                lambda do
         
     | 
| 
         @@ -40,5 +40,3 @@ describe '#sunion(key [, key, ...])' do 
     | 
|
| 
       40 
40 
     | 
    
         
             
                end.should raise_error(RuntimeError)
         
     | 
| 
       41 
41 
     | 
    
         
             
              end
         
     | 
| 
       42 
42 
     | 
    
         
             
            end
         
     | 
| 
       43 
     | 
    
         
            -
             
     | 
| 
       44 
     | 
    
         
            -
             
     | 
| 
         @@ -6,46 +6,46 @@ describe '#sunionstore(destination, key [, key, ...])' do 
     | 
|
| 
       6 
6 
     | 
    
         
             
                @primes      = 'mock-redis-test:sunionstore:primes'
         
     | 
| 
       7 
7 
     | 
    
         
             
                @destination = 'mock-redis-test:sunionstore:destination'
         
     | 
| 
       8 
8 
     | 
    
         | 
| 
       9 
     | 
    
         
            -
                [2, 4, 6, 8, 10].each {|i| @redises.sadd(@evens, i) }
         
     | 
| 
       10 
     | 
    
         
            -
                [2, 3, 5, 7].each {|i| @redises.sadd(@primes, i) }
         
     | 
| 
      
 9 
     | 
    
         
            +
                [2, 4, 6, 8, 10].each { |i| @redises.sadd(@evens, i) }
         
     | 
| 
      
 10 
     | 
    
         
            +
                [2, 3, 5, 7].each { |i| @redises.sadd(@primes, i) }
         
     | 
| 
       11 
11 
     | 
    
         
             
              end
         
     | 
| 
       12 
12 
     | 
    
         | 
| 
       13 
     | 
    
         
            -
              it  
     | 
| 
      
 13 
     | 
    
         
            +
              it 'returns the number of elements in the resulting set' do
         
     | 
| 
       14 
14 
     | 
    
         
             
                @redises.sunionstore(@destination, @primes, @evens).should == 8
         
     | 
| 
       15 
15 
     | 
    
         
             
              end
         
     | 
| 
       16 
16 
     | 
    
         | 
| 
       17 
     | 
    
         
            -
              it  
     | 
| 
      
 17 
     | 
    
         
            +
              it 'stores the resulting set' do
         
     | 
| 
       18 
18 
     | 
    
         
             
                @redises.sunionstore(@destination, @primes, @evens)
         
     | 
| 
       19 
19 
     | 
    
         
             
                @redises.smembers(@destination).should == %w[10 8 6 4 7 5 3 2]
         
     | 
| 
       20 
20 
     | 
    
         
             
              end
         
     | 
| 
       21 
21 
     | 
    
         | 
| 
       22 
     | 
    
         
            -
              it  
     | 
| 
      
 22 
     | 
    
         
            +
              it 'does not store empty sets' do
         
     | 
| 
       23 
23 
     | 
    
         
             
                @redises.sunionstore(@destination,
         
     | 
| 
       24 
24 
     | 
    
         
             
                  'mock-redis-test:nonesuch',
         
     | 
| 
       25 
25 
     | 
    
         
             
                  'mock-redis-test:nonesuch2').should == 0
         
     | 
| 
       26 
26 
     | 
    
         
             
                @redises.get(@destination).should be_nil
         
     | 
| 
       27 
27 
     | 
    
         
             
              end
         
     | 
| 
       28 
28 
     | 
    
         | 
| 
       29 
     | 
    
         
            -
              it  
     | 
| 
      
 29 
     | 
    
         
            +
              it 'removes existing elements in destination' do
         
     | 
| 
       30 
30 
     | 
    
         
             
                @redises.sadd(@destination, 42)
         
     | 
| 
       31 
31 
     | 
    
         | 
| 
       32 
32 
     | 
    
         
             
                @redises.sunionstore(@destination, @primes)
         
     | 
| 
       33 
33 
     | 
    
         
             
                @redises.smembers(@destination).should == %w[7 5 3 2]
         
     | 
| 
       34 
34 
     | 
    
         
             
              end
         
     | 
| 
       35 
35 
     | 
    
         | 
| 
       36 
     | 
    
         
            -
              it  
     | 
| 
      
 36 
     | 
    
         
            +
              it 'correctly unions and stores when the destination is empty and is one of the arguments' do
         
     | 
| 
       37 
37 
     | 
    
         
             
                @redises.sunionstore(@destination, @destination, @primes)
         
     | 
| 
       38 
38 
     | 
    
         | 
| 
       39 
39 
     | 
    
         
             
                @redises.smembers(@destination).should == %w[7 5 3 2]
         
     | 
| 
       40 
40 
     | 
    
         
             
              end
         
     | 
| 
       41 
41 
     | 
    
         | 
| 
       42 
     | 
    
         
            -
              it  
     | 
| 
      
 42 
     | 
    
         
            +
              it 'raises an error if given 0 sets' do
         
     | 
| 
       43 
43 
     | 
    
         
             
                lambda do
         
     | 
| 
       44 
44 
     | 
    
         
             
                  @redises.sunionstore(@destination)
         
     | 
| 
       45 
45 
     | 
    
         
             
                end.should raise_error(RuntimeError)
         
     | 
| 
       46 
46 
     | 
    
         
             
              end
         
     | 
| 
       47 
47 
     | 
    
         | 
| 
       48 
     | 
    
         
            -
              it  
     | 
| 
      
 48 
     | 
    
         
            +
              it 'raises an error if any argument is not a a set' do
         
     | 
| 
       49 
49 
     | 
    
         
             
                @redises.set('mock-redis-test:notset', 1)
         
     | 
| 
       50 
50 
     | 
    
         | 
| 
       51 
51 
     | 
    
         
             
                lambda do
         
     | 
    
        data/spec/commands/ttl_spec.rb
    CHANGED
    
    | 
         @@ -1,25 +1,25 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            require 'spec_helper'
         
     | 
| 
       2 
2 
     | 
    
         | 
| 
       3 
     | 
    
         
            -
            describe  
     | 
| 
      
 3 
     | 
    
         
            +
            describe '#ttl(key)' do
         
     | 
| 
       4 
4 
     | 
    
         
             
              before do
         
     | 
| 
       5 
5 
     | 
    
         
             
                @key = 'mock-redis-test:persist'
         
     | 
| 
       6 
6 
     | 
    
         
             
                @redises.set(@key, 'spork')
         
     | 
| 
       7 
7 
     | 
    
         
             
              end
         
     | 
| 
       8 
8 
     | 
    
         | 
| 
       9 
     | 
    
         
            -
              it  
     | 
| 
      
 9 
     | 
    
         
            +
              it 'returns -1 for a key with no expiration' do
         
     | 
| 
       10 
10 
     | 
    
         
             
                @redises.ttl(@key).should == -1
         
     | 
| 
       11 
11 
     | 
    
         
             
              end
         
     | 
| 
       12 
12 
     | 
    
         | 
| 
       13 
     | 
    
         
            -
              it  
     | 
| 
      
 13 
     | 
    
         
            +
              it 'returns -2 for a key that does not exist' do
         
     | 
| 
       14 
14 
     | 
    
         
             
                @redises.ttl('mock-redis-test:nonesuch').should == -2
         
     | 
| 
       15 
15 
     | 
    
         
             
              end
         
     | 
| 
       16 
16 
     | 
    
         | 
| 
       17 
     | 
    
         
            -
              it  
     | 
| 
      
 17 
     | 
    
         
            +
              it 'stringifies key' do
         
     | 
| 
       18 
18 
     | 
    
         
             
                @redises.expire(@key, 9)
         
     | 
| 
       19 
19 
     | 
    
         
             
                @redises.ttl(@key.to_sym).should > 0
         
     | 
| 
       20 
20 
     | 
    
         
             
              end
         
     | 
| 
       21 
21 
     | 
    
         | 
| 
       22 
     | 
    
         
            -
              context  
     | 
| 
      
 22 
     | 
    
         
            +
              context '[mock only]' do
         
     | 
| 
       23 
23 
     | 
    
         
             
                # These are mock-only since we can't actually manipulate time in
         
     | 
| 
       24 
24 
     | 
    
         
             
                # the real Redis.
         
     | 
| 
       25 
25 
     | 
    
         | 
    
        data/spec/commands/type_spec.rb
    CHANGED
    
    
    
        data/spec/commands/zadd_spec.rb
    CHANGED
    
    | 
         @@ -1,47 +1,47 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            require 'spec_helper'
         
     | 
| 
       2 
2 
     | 
    
         | 
| 
       3 
     | 
    
         
            -
            describe  
     | 
| 
      
 3 
     | 
    
         
            +
            describe '#zadd(key, score, member)' do
         
     | 
| 
       4 
4 
     | 
    
         
             
              before { @key = 'mock-redis-test:zadd' }
         
     | 
| 
       5 
5 
     | 
    
         | 
| 
       6 
6 
     | 
    
         
             
              it "returns true if member wasn't present in the set" do
         
     | 
| 
       7 
7 
     | 
    
         
             
                @redises.zadd(@key, 1, 'foo').should == true
         
     | 
| 
       8 
8 
     | 
    
         
             
              end
         
     | 
| 
       9 
9 
     | 
    
         | 
| 
       10 
     | 
    
         
            -
              it  
     | 
| 
      
 10 
     | 
    
         
            +
              it 'returns false if member was present in the set' do
         
     | 
| 
       11 
11 
     | 
    
         
             
                @redises.zadd(@key, 1, 'foo')
         
     | 
| 
       12 
12 
     | 
    
         
             
                @redises.zadd(@key, 1, 'foo').should == false
         
     | 
| 
       13 
13 
     | 
    
         
             
              end
         
     | 
| 
       14 
14 
     | 
    
         | 
| 
       15 
     | 
    
         
            -
              it  
     | 
| 
      
 15 
     | 
    
         
            +
              it 'adds member to the set' do
         
     | 
| 
       16 
16 
     | 
    
         
             
                @redises.zadd(@key, 1, 'foo')
         
     | 
| 
       17 
17 
     | 
    
         
             
                @redises.zrange(@key, 0, -1).should == ['foo']
         
     | 
| 
       18 
18 
     | 
    
         
             
              end
         
     | 
| 
       19 
19 
     | 
    
         | 
| 
       20 
     | 
    
         
            -
              it  
     | 
| 
      
 20 
     | 
    
         
            +
              it 'treats integer members as strings' do
         
     | 
| 
       21 
21 
     | 
    
         
             
                member = 11
         
     | 
| 
       22 
22 
     | 
    
         
             
                @redises.zadd(@key, 1, member)
         
     | 
| 
       23 
23 
     | 
    
         
             
                @redises.zrange(@key, 0, -1).should == [member.to_s]
         
     | 
| 
       24 
24 
     | 
    
         
             
              end
         
     | 
| 
       25 
25 
     | 
    
         | 
| 
       26 
     | 
    
         
            -
              it  
     | 
| 
      
 26 
     | 
    
         
            +
              it 'updates the score' do
         
     | 
| 
       27 
27 
     | 
    
         
             
                @redises.zadd(@key, 1, 'foo')
         
     | 
| 
       28 
28 
     | 
    
         
             
                @redises.zadd(@key, 2, 'foo')
         
     | 
| 
       29 
29 
     | 
    
         | 
| 
       30 
30 
     | 
    
         
             
                @redises.zscore(@key, 'foo').should == 2.0
         
     | 
| 
       31 
31 
     | 
    
         
             
              end
         
     | 
| 
       32 
32 
     | 
    
         | 
| 
       33 
     | 
    
         
            -
              it  
     | 
| 
      
 33 
     | 
    
         
            +
              it 'supports a variable number of arguments' do
         
     | 
| 
       34 
34 
     | 
    
         
             
                @redises.zadd(@key, [[1, 'one'], [2, 'two']])
         
     | 
| 
       35 
35 
     | 
    
         
             
                @redises.zadd(@key, [[3, 'three']])
         
     | 
| 
       36 
     | 
    
         
            -
                @redises.zrange(@key, 0, -1).should == [ 
     | 
| 
      
 36 
     | 
    
         
            +
                @redises.zrange(@key, 0, -1).should == %w[one two three]
         
     | 
| 
       37 
37 
     | 
    
         
             
              end
         
     | 
| 
       38 
38 
     | 
    
         | 
| 
       39 
     | 
    
         
            -
              it  
     | 
| 
      
 39 
     | 
    
         
            +
              it 'raises an error if an empty array is given' do
         
     | 
| 
       40 
40 
     | 
    
         
             
                lambda do
         
     | 
| 
       41 
41 
     | 
    
         
             
                  @redises.zadd(@key, [])
         
     | 
| 
       42 
42 
     | 
    
         
             
                end.should raise_error(Redis::CommandError)
         
     | 
| 
       43 
43 
     | 
    
         
             
              end
         
     | 
| 
       44 
44 
     | 
    
         | 
| 
       45 
     | 
    
         
            -
              it_should_behave_like  
     | 
| 
       46 
     | 
    
         
            -
              it_should_behave_like  
     | 
| 
      
 45 
     | 
    
         
            +
              it_should_behave_like 'arg 1 is a score'
         
     | 
| 
      
 46 
     | 
    
         
            +
              it_should_behave_like 'a zset-only command'
         
     | 
| 
       47 
47 
     | 
    
         
             
            end
         
     |