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
 
| 
         @@ -1,21 +1,21 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            require 'spec_helper'
         
     | 
| 
       2 
2 
     | 
    
         | 
| 
       3 
     | 
    
         
            -
            describe  
     | 
| 
      
 3 
     | 
    
         
            +
            describe '#pexpireat(key, timestamp_ms)' do
         
     | 
| 
       4 
4 
     | 
    
         
             
              before do
         
     | 
| 
       5 
5 
     | 
    
         
             
                @key = 'mock-redis-test:pexpireat'
         
     | 
| 
       6 
6 
     | 
    
         
             
                @redises.set(@key, 'spork')
         
     | 
| 
       7 
7 
     | 
    
         
             
              end
         
     | 
| 
       8 
8 
     | 
    
         | 
| 
       9 
     | 
    
         
            -
              it  
     | 
| 
      
 9 
     | 
    
         
            +
              it 'returns true for a key that exists' do
         
     | 
| 
       10 
10 
     | 
    
         
             
                @redises.pexpireat(@key, (Time.now.to_f * 1000).to_i + 1).should == true
         
     | 
| 
       11 
11 
     | 
    
         
             
              end
         
     | 
| 
       12 
12 
     | 
    
         | 
| 
       13 
     | 
    
         
            -
              it  
     | 
| 
      
 13 
     | 
    
         
            +
              it 'returns false for a key that does not exist' do
         
     | 
| 
       14 
14 
     | 
    
         
             
                @redises.pexpireat('mock-redis-test:nonesuch',
         
     | 
| 
       15 
15 
     | 
    
         
             
                                   (Time.now.to_f * 1000).to_i + 1).should == false
         
     | 
| 
       16 
16 
     | 
    
         
             
              end
         
     | 
| 
       17 
17 
     | 
    
         | 
| 
       18 
     | 
    
         
            -
              it  
     | 
| 
      
 18 
     | 
    
         
            +
              it 'removes a key immediately when timestamp is now' do
         
     | 
| 
       19 
19 
     | 
    
         
             
                @redises.pexpireat(@key, (Time.now.to_f * 1000).to_i)
         
     | 
| 
       20 
20 
     | 
    
         
             
                @redises.get(@key).should be_nil
         
     | 
| 
       21 
21 
     | 
    
         
             
              end
         
     | 
| 
         @@ -26,7 +26,7 @@ describe "#pexpireat(key, timestamp_ms)" do 
     | 
|
| 
       26 
26 
     | 
    
         
             
                end.should raise_error(RuntimeError)
         
     | 
| 
       27 
27 
     | 
    
         
             
              end
         
     | 
| 
       28 
28 
     | 
    
         | 
| 
       29 
     | 
    
         
            -
              context  
     | 
| 
      
 29 
     | 
    
         
            +
              context '[mock only]' do
         
     | 
| 
       30 
30 
     | 
    
         
             
                # These are mock-only since we can't actually manipulate time in
         
     | 
| 
       31 
31 
     | 
    
         
             
                # the real Redis.
         
     | 
| 
       32 
32 
     | 
    
         | 
| 
         @@ -39,7 +39,7 @@ describe "#pexpireat(key, timestamp_ms)" do 
     | 
|
| 
       39 
39 
     | 
    
         
             
                  Time.stub(:now).and_return(@now)
         
     | 
| 
       40 
40 
     | 
    
         
             
                end
         
     | 
| 
       41 
41 
     | 
    
         | 
| 
       42 
     | 
    
         
            -
                it  
     | 
| 
      
 42 
     | 
    
         
            +
                it 'removes keys after enough time has passed' do
         
     | 
| 
       43 
43 
     | 
    
         
             
                  @mock.pexpireat(@key, (@now.to_f * 1000).to_i + 5)
         
     | 
| 
       44 
44 
     | 
    
         
             
                  Time.stub(:now).and_return(@now + 0.006)
         
     | 
| 
       45 
45 
     | 
    
         
             
                  @mock.get(@key).should be_nil
         
     | 
    
        data/spec/commands/ping_spec.rb
    CHANGED
    
    
| 
         @@ -10,10 +10,10 @@ describe '#pipelined' do 
     | 
|
| 
       10 
10 
     | 
    
         
             
              end
         
     | 
| 
       11 
11 
     | 
    
         | 
| 
       12 
12 
     | 
    
         
             
              context 'with a few added data' do
         
     | 
| 
       13 
     | 
    
         
            -
                let(:key1)   {  
     | 
| 
       14 
     | 
    
         
            -
                let(:key2)   {  
     | 
| 
       15 
     | 
    
         
            -
                let(:value1) {  
     | 
| 
       16 
     | 
    
         
            -
                let(:value2) {  
     | 
| 
      
 13 
     | 
    
         
            +
                let(:key1)   { 'hello' }
         
     | 
| 
      
 14 
     | 
    
         
            +
                let(:key2)   { 'world' }
         
     | 
| 
      
 15 
     | 
    
         
            +
                let(:value1) { 'foo' }
         
     | 
| 
      
 16 
     | 
    
         
            +
                let(:value2) { 'bar' }
         
     | 
| 
       17 
17 
     | 
    
         | 
| 
       18 
18 
     | 
    
         
             
                before do
         
     | 
| 
       19 
19 
     | 
    
         
             
                  @redises.set key1, value1
         
     | 
| 
         @@ -26,7 +26,7 @@ describe '#pipelined' do 
     | 
|
| 
       26 
26 
     | 
    
         
             
                    redis.get key2
         
     | 
| 
       27 
27 
     | 
    
         
             
                  end
         
     | 
| 
       28 
28 
     | 
    
         | 
| 
       29 
     | 
    
         
            -
                  results.should == [ 
     | 
| 
      
 29 
     | 
    
         
            +
                  results.should == [value1, value2]
         
     | 
| 
       30 
30 
     | 
    
         
             
                end
         
     | 
| 
       31 
31 
     | 
    
         | 
| 
       32 
32 
     | 
    
         
             
                it 'returns futures' do
         
     | 
    
        data/spec/commands/pttl_spec.rb
    CHANGED
    
    | 
         @@ -1,26 +1,26 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            require 'spec_helper'
         
     | 
| 
       2 
2 
     | 
    
         | 
| 
       3 
     | 
    
         
            -
            describe  
     | 
| 
      
 3 
     | 
    
         
            +
            describe '#pttl(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.pttl(@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.pttl('mock-redis-test:nonesuch').should == -2
         
     | 
| 
       15 
15 
     | 
    
         
             
              end
         
     | 
| 
       16 
16 
     | 
    
         | 
| 
       17 
     | 
    
         
            -
              it  
     | 
| 
      
 17 
     | 
    
         
            +
              it 'stringifies key' do
         
     | 
| 
       18 
18 
     | 
    
         
             
                @redises.expire(@key, 8)
         
     | 
| 
       19 
19 
     | 
    
         
             
                # Don't check against Redis since millisecond timing differences are likely
         
     | 
| 
       20 
20 
     | 
    
         
             
                @redises.send_without_checking(:pttl, @key.to_sym).should > 0
         
     | 
| 
       21 
21 
     | 
    
         
             
              end
         
     | 
| 
       22 
22 
     | 
    
         | 
| 
       23 
     | 
    
         
            -
              context  
     | 
| 
      
 23 
     | 
    
         
            +
              context '[mock only]' do
         
     | 
| 
       24 
24 
     | 
    
         
             
                # These are mock-only since we can't actually manipulate time in
         
     | 
| 
       25 
25 
     | 
    
         
             
                # the real Redis.
         
     | 
| 
       26 
26 
     | 
    
         | 
| 
         @@ -3,7 +3,7 @@ require 'spec_helper' 
     | 
|
| 
       3 
3 
     | 
    
         
             
            describe '#randomkey [mock only]' do
         
     | 
| 
       4 
4 
     | 
    
         
             
              before { @mock = @redises.mock }
         
     | 
| 
       5 
5 
     | 
    
         | 
| 
       6 
     | 
    
         
            -
              it  
     | 
| 
      
 6 
     | 
    
         
            +
              it 'finds a random key' do
         
     | 
| 
       7 
7 
     | 
    
         
             
                @keys = ['mock-redis-test:1', 'mock-redis-test:2', 'mock-redis-test:3']
         
     | 
| 
       8 
8 
     | 
    
         | 
| 
       9 
9 
     | 
    
         
             
                @keys.each do |k|
         
     | 
| 
         @@ -13,8 +13,8 @@ describe '#randomkey [mock only]' do 
     | 
|
| 
       13 
13 
     | 
    
         
             
                @keys.should include(@mock.randomkey)
         
     | 
| 
       14 
14 
     | 
    
         
             
              end
         
     | 
| 
       15 
15 
     | 
    
         | 
| 
       16 
     | 
    
         
            -
              it  
     | 
| 
       17 
     | 
    
         
            -
                @mock.keys('*').each {|k| @mock.del(k)}
         
     | 
| 
      
 16 
     | 
    
         
            +
              it 'returns nil when there are no keys' do
         
     | 
| 
      
 17 
     | 
    
         
            +
                @mock.keys('*').each { |k| @mock.del(k) }
         
     | 
| 
       18 
18 
     | 
    
         
             
                @mock.randomkey.should be_nil
         
     | 
| 
       19 
19 
     | 
    
         
             
              end
         
     | 
| 
       20 
20 
     | 
    
         
             
            end
         
     | 
| 
         @@ -5,38 +5,38 @@ describe '#rename(key, newkey)' do 
     | 
|
| 
       5 
5 
     | 
    
         
             
                @key = 'mock-redis-test:rename:key'
         
     | 
| 
       6 
6 
     | 
    
         
             
                @newkey = 'mock-redis-test:rename:newkey'
         
     | 
| 
       7 
7 
     | 
    
         | 
| 
       8 
     | 
    
         
            -
                @redises.set(@key,  
     | 
| 
      
 8 
     | 
    
         
            +
                @redises.set(@key, 'oof')
         
     | 
| 
       9 
9 
     | 
    
         
             
              end
         
     | 
| 
       10 
10 
     | 
    
         | 
| 
       11 
11 
     | 
    
         
             
              it "responds with 'OK'" do
         
     | 
| 
       12 
12 
     | 
    
         
             
                @redises.rename(@key, @newkey).should == 'OK'
         
     | 
| 
       13 
13 
     | 
    
         
             
              end
         
     | 
| 
       14 
14 
     | 
    
         | 
| 
       15 
     | 
    
         
            -
              it  
     | 
| 
      
 15 
     | 
    
         
            +
              it 'moves the data' do
         
     | 
| 
       16 
16 
     | 
    
         
             
                @redises.rename(@key, @newkey)
         
     | 
| 
       17 
     | 
    
         
            -
                @redises.get(@newkey).should ==  
     | 
| 
      
 17 
     | 
    
         
            +
                @redises.get(@newkey).should == 'oof'
         
     | 
| 
       18 
18 
     | 
    
         
             
              end
         
     | 
| 
       19 
19 
     | 
    
         | 
| 
       20 
     | 
    
         
            -
              it  
     | 
| 
      
 20 
     | 
    
         
            +
              it 'raises an error when the source key is nonexistant' do
         
     | 
| 
       21 
21 
     | 
    
         
             
                @redises.del(@key)
         
     | 
| 
       22 
22 
     | 
    
         
             
                lambda do
         
     | 
| 
       23 
23 
     | 
    
         
             
                  @redises.rename(@key, @newkey)
         
     | 
| 
       24 
24 
     | 
    
         
             
                end.should raise_error(Redis::CommandError)
         
     | 
| 
       25 
25 
     | 
    
         
             
              end
         
     | 
| 
       26 
26 
     | 
    
         | 
| 
       27 
     | 
    
         
            -
              it  
     | 
| 
      
 27 
     | 
    
         
            +
              it 'raises an error when key == newkey' do
         
     | 
| 
       28 
28 
     | 
    
         
             
                lambda do
         
     | 
| 
       29 
29 
     | 
    
         
             
                  @redises.rename(@key, @key)
         
     | 
| 
       30 
30 
     | 
    
         
             
                end.should raise_error(RuntimeError)
         
     | 
| 
       31 
31 
     | 
    
         
             
              end
         
     | 
| 
       32 
32 
     | 
    
         | 
| 
       33 
     | 
    
         
            -
              it  
     | 
| 
       34 
     | 
    
         
            -
                @redises.set(@newkey,  
     | 
| 
      
 33 
     | 
    
         
            +
              it 'overwrites any existing value at newkey' do
         
     | 
| 
      
 34 
     | 
    
         
            +
                @redises.set(@newkey, 'rab')
         
     | 
| 
       35 
35 
     | 
    
         
             
                @redises.rename(@key, @newkey)
         
     | 
| 
       36 
     | 
    
         
            -
                @redises.get(@newkey).should ==  
     | 
| 
      
 36 
     | 
    
         
            +
                @redises.get(@newkey).should == 'oof'
         
     | 
| 
       37 
37 
     | 
    
         
             
              end
         
     | 
| 
       38 
38 
     | 
    
         | 
| 
       39 
     | 
    
         
            -
              it  
     | 
| 
      
 39 
     | 
    
         
            +
              it 'keeps expiration' do
         
     | 
| 
       40 
40 
     | 
    
         
             
                @redises.expire(@key, 1000)
         
     | 
| 
       41 
41 
     | 
    
         
             
                @redises.rename(@key, @newkey)
         
     | 
| 
       42 
42 
     | 
    
         
             
                @redises.ttl(@newkey).should be > 0
         
     | 
| 
         @@ -5,39 +5,39 @@ describe '#renamenx(key, newkey)' do 
     | 
|
| 
       5 
5 
     | 
    
         
             
                @key = 'mock-redis-test:renamenx:key'
         
     | 
| 
       6 
6 
     | 
    
         
             
                @newkey = 'mock-redis-test:renamenx:newkey'
         
     | 
| 
       7 
7 
     | 
    
         | 
| 
       8 
     | 
    
         
            -
                @redises.set(@key,  
     | 
| 
      
 8 
     | 
    
         
            +
                @redises.set(@key, 'oof')
         
     | 
| 
       9 
9 
     | 
    
         
             
              end
         
     | 
| 
       10 
10 
     | 
    
         | 
| 
       11 
     | 
    
         
            -
              it  
     | 
| 
      
 11 
     | 
    
         
            +
              it 'responds with true when newkey does not exist' do
         
     | 
| 
       12 
12 
     | 
    
         
             
                @redises.renamenx(@key, @newkey).should == true
         
     | 
| 
       13 
13 
     | 
    
         
             
              end
         
     | 
| 
       14 
14 
     | 
    
         | 
| 
       15 
     | 
    
         
            -
              it  
     | 
| 
      
 15 
     | 
    
         
            +
              it 'responds with false when newkey exists' do
         
     | 
| 
       16 
16 
     | 
    
         
             
                @redises.set(@newkey, 'monkey')
         
     | 
| 
       17 
17 
     | 
    
         
             
                @redises.renamenx(@key, @newkey).should == false
         
     | 
| 
       18 
18 
     | 
    
         
             
              end
         
     | 
| 
       19 
19 
     | 
    
         | 
| 
       20 
     | 
    
         
            -
              it  
     | 
| 
      
 20 
     | 
    
         
            +
              it 'moves the data' do
         
     | 
| 
       21 
21 
     | 
    
         
             
                @redises.renamenx(@key, @newkey)
         
     | 
| 
       22 
     | 
    
         
            -
                @redises.get(@newkey).should ==  
     | 
| 
      
 22 
     | 
    
         
            +
                @redises.get(@newkey).should == 'oof'
         
     | 
| 
       23 
23 
     | 
    
         
             
              end
         
     | 
| 
       24 
24 
     | 
    
         | 
| 
       25 
     | 
    
         
            -
              it  
     | 
| 
      
 25 
     | 
    
         
            +
              it 'raises an error when the source key is nonexistant' do
         
     | 
| 
       26 
26 
     | 
    
         
             
                @redises.del(@key)
         
     | 
| 
       27 
27 
     | 
    
         
             
                lambda do
         
     | 
| 
       28 
28 
     | 
    
         
             
                  @redises.rename(@key, @newkey)
         
     | 
| 
       29 
29 
     | 
    
         
             
                end.should raise_error(Redis::CommandError)
         
     | 
| 
       30 
30 
     | 
    
         
             
              end
         
     | 
| 
       31 
31 
     | 
    
         | 
| 
       32 
     | 
    
         
            -
              it  
     | 
| 
      
 32 
     | 
    
         
            +
              it 'raises an error when key == newkey' do
         
     | 
| 
       33 
33 
     | 
    
         
             
                lambda do
         
     | 
| 
       34 
34 
     | 
    
         
             
                  @redises.renamenx(@key, @key)
         
     | 
| 
       35 
35 
     | 
    
         
             
                end.should raise_error(RuntimeError)
         
     | 
| 
       36 
36 
     | 
    
         
             
              end
         
     | 
| 
       37 
37 
     | 
    
         | 
| 
       38 
     | 
    
         
            -
              it  
     | 
| 
       39 
     | 
    
         
            -
                @redises.set(@newkey,  
     | 
| 
      
 38 
     | 
    
         
            +
              it 'leaves any existing value at newkey alone' do
         
     | 
| 
      
 39 
     | 
    
         
            +
                @redises.set(@newkey, 'rab')
         
     | 
| 
       40 
40 
     | 
    
         
             
                @redises.renamenx(@key, @newkey)
         
     | 
| 
       41 
     | 
    
         
            -
                @redises.get(@newkey).should ==  
     | 
| 
      
 41 
     | 
    
         
            +
                @redises.get(@newkey).should == 'rab'
         
     | 
| 
       42 
42 
     | 
    
         
             
              end
         
     | 
| 
       43 
43 
     | 
    
         
             
            end
         
     | 
    
        data/spec/commands/rpop_spec.rb
    CHANGED
    
    | 
         @@ -3,32 +3,32 @@ require 'spec_helper' 
     | 
|
| 
       3 
3 
     | 
    
         
             
            describe '#rpop(key)' do
         
     | 
| 
       4 
4 
     | 
    
         
             
              before { @key = 'mock-redis-test:43093' }
         
     | 
| 
       5 
5 
     | 
    
         | 
| 
       6 
     | 
    
         
            -
              it  
     | 
| 
      
 6 
     | 
    
         
            +
              it 'returns and removes the first element of a list' do
         
     | 
| 
       7 
7 
     | 
    
         
             
                @redises.lpush(@key, 1)
         
     | 
| 
       8 
8 
     | 
    
         
             
                @redises.lpush(@key, 2)
         
     | 
| 
       9 
9 
     | 
    
         | 
| 
       10 
     | 
    
         
            -
                @redises.rpop(@key).should ==  
     | 
| 
      
 10 
     | 
    
         
            +
                @redises.rpop(@key).should == '1'
         
     | 
| 
       11 
11 
     | 
    
         | 
| 
       12 
12 
     | 
    
         
             
                @redises.llen(@key).should == 1
         
     | 
| 
       13 
13 
     | 
    
         
             
              end
         
     | 
| 
       14 
14 
     | 
    
         | 
| 
       15 
     | 
    
         
            -
              it  
     | 
| 
      
 15 
     | 
    
         
            +
              it 'returns nil if the list is empty' do
         
     | 
| 
       16 
16 
     | 
    
         
             
                @redises.lpush(@key, 'foo')
         
     | 
| 
       17 
17 
     | 
    
         
             
                @redises.rpop(@key)
         
     | 
| 
       18 
18 
     | 
    
         | 
| 
       19 
19 
     | 
    
         
             
                @redises.rpop(@key).should be_nil
         
     | 
| 
       20 
20 
     | 
    
         
             
              end
         
     | 
| 
       21 
21 
     | 
    
         | 
| 
       22 
     | 
    
         
            -
              it  
     | 
| 
      
 22 
     | 
    
         
            +
              it 'returns nil for nonexistent values' do
         
     | 
| 
       23 
23 
     | 
    
         
             
                @redises.rpop(@key).should be_nil
         
     | 
| 
       24 
24 
     | 
    
         
             
              end
         
     | 
| 
       25 
25 
     | 
    
         | 
| 
       26 
     | 
    
         
            -
              it  
     | 
| 
      
 26 
     | 
    
         
            +
              it 'removes empty lists' do
         
     | 
| 
       27 
27 
     | 
    
         
             
                @redises.lpush(@key, 'foo')
         
     | 
| 
       28 
28 
     | 
    
         
             
                @redises.rpop(@key)
         
     | 
| 
       29 
29 
     | 
    
         | 
| 
       30 
30 
     | 
    
         
             
                @redises.get(@key).should be_nil
         
     | 
| 
       31 
31 
     | 
    
         
             
              end
         
     | 
| 
       32 
32 
     | 
    
         | 
| 
       33 
     | 
    
         
            -
              it_should_behave_like  
     | 
| 
      
 33 
     | 
    
         
            +
              it_should_behave_like 'a list-only command'
         
     | 
| 
       34 
34 
     | 
    
         
             
            end
         
     | 
| 
         @@ -12,8 +12,8 @@ describe '#rpoplpush(source, destination)' do 
     | 
|
| 
       12 
12 
     | 
    
         
             
                @redises.lpush(@list2, 'x')
         
     | 
| 
       13 
13 
     | 
    
         
             
              end
         
     | 
| 
       14 
14 
     | 
    
         | 
| 
       15 
     | 
    
         
            -
              it  
     | 
| 
       16 
     | 
    
         
            -
                @redises.rpoplpush(@list1, @list2).should ==  
     | 
| 
      
 15 
     | 
    
         
            +
              it 'returns the value moved' do
         
     | 
| 
      
 16 
     | 
    
         
            +
                @redises.rpoplpush(@list1, @list2).should == 'b'
         
     | 
| 
       17 
17 
     | 
    
         
             
              end
         
     | 
| 
       18 
18 
     | 
    
         | 
| 
       19 
19 
     | 
    
         
             
              it "returns false and doesn't append if source empty" do
         
     | 
| 
         @@ -21,24 +21,24 @@ describe '#rpoplpush(source, destination)' do 
     | 
|
| 
       21 
21 
     | 
    
         
             
                @redises.lrange(@list1, 0, -1).should == %w[a b]
         
     | 
| 
       22 
22 
     | 
    
         
             
              end
         
     | 
| 
       23 
23 
     | 
    
         | 
| 
       24 
     | 
    
         
            -
              it  
     | 
| 
      
 24 
     | 
    
         
            +
              it 'takes the last element of destination and prepends it to source' do
         
     | 
| 
       25 
25 
     | 
    
         
             
                @redises.rpoplpush(@list1, @list2)
         
     | 
| 
       26 
26 
     | 
    
         | 
| 
       27 
27 
     | 
    
         
             
                @redises.lrange(@list1, 0, -1).should == %w[a]
         
     | 
| 
       28 
28 
     | 
    
         
             
                @redises.lrange(@list2, 0, -1).should == %w[b x y]
         
     | 
| 
       29 
29 
     | 
    
         
             
              end
         
     | 
| 
       30 
30 
     | 
    
         | 
| 
       31 
     | 
    
         
            -
              it  
     | 
| 
      
 31 
     | 
    
         
            +
              it 'rotates a list when source and destination are the same' do
         
     | 
| 
       32 
32 
     | 
    
         
             
                @redises.rpoplpush(@list1, @list1)
         
     | 
| 
       33 
33 
     | 
    
         
             
                @redises.lrange(@list1, 0, -1).should == %w[b a]
         
     | 
| 
       34 
34 
     | 
    
         
             
              end
         
     | 
| 
       35 
35 
     | 
    
         | 
| 
       36 
     | 
    
         
            -
              it  
     | 
| 
      
 36 
     | 
    
         
            +
              it 'removes empty lists' do
         
     | 
| 
       37 
37 
     | 
    
         
             
                @redises.llen(@list1).times { @redises.rpoplpush(@list1, @list2) }
         
     | 
| 
       38 
38 
     | 
    
         
             
                @redises.get(@list1).should be_nil
         
     | 
| 
       39 
39 
     | 
    
         
             
              end
         
     | 
| 
       40 
40 
     | 
    
         | 
| 
       41 
     | 
    
         
            -
              it  
     | 
| 
      
 41 
     | 
    
         
            +
              it 'raises an error for non-list source value' do
         
     | 
| 
       42 
42 
     | 
    
         
             
                @redises.set(@list1, 'string value')
         
     | 
| 
       43 
43 
     | 
    
         | 
| 
       44 
44 
     | 
    
         
             
                lambda do
         
     | 
| 
         @@ -46,5 +46,5 @@ describe '#rpoplpush(source, destination)' do 
     | 
|
| 
       46 
46 
     | 
    
         
             
                end.should raise_error(RuntimeError)
         
     | 
| 
       47 
47 
     | 
    
         
             
              end
         
     | 
| 
       48 
48 
     | 
    
         | 
| 
       49 
     | 
    
         
            -
              it_should_behave_like  
     | 
| 
      
 49 
     | 
    
         
            +
              it_should_behave_like 'a list-only command'
         
     | 
| 
       50 
50 
     | 
    
         
             
            end
         
     | 
    
        data/spec/commands/rpush_spec.rb
    CHANGED
    
    | 
         @@ -1,43 +1,43 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            require 'spec_helper'
         
     | 
| 
       2 
2 
     | 
    
         | 
| 
       3 
     | 
    
         
            -
            describe  
     | 
| 
      
 3 
     | 
    
         
            +
            describe '#rpush(key)' do
         
     | 
| 
       4 
4 
     | 
    
         
             
              before { @key = "mock-redis-test:#{__FILE__}" }
         
     | 
| 
       5 
5 
     | 
    
         | 
| 
       6 
     | 
    
         
            -
              it  
     | 
| 
      
 6 
     | 
    
         
            +
              it 'returns the new size of the list' do
         
     | 
| 
       7 
7 
     | 
    
         
             
                @redises.rpush(@key, 'X').should == 1
         
     | 
| 
       8 
8 
     | 
    
         
             
                @redises.rpush(@key, 'X').should == 2
         
     | 
| 
       9 
9 
     | 
    
         
             
              end
         
     | 
| 
       10 
10 
     | 
    
         | 
| 
       11 
     | 
    
         
            -
              it  
     | 
| 
      
 11 
     | 
    
         
            +
              it 'creates a new list when run against a nonexistent key' do
         
     | 
| 
       12 
12 
     | 
    
         
             
                @redises.rpush(@key, 'value')
         
     | 
| 
       13 
13 
     | 
    
         
             
                @redises.llen(@key).should == 1
         
     | 
| 
       14 
14 
     | 
    
         
             
              end
         
     | 
| 
       15 
15 
     | 
    
         | 
| 
       16 
     | 
    
         
            -
              it  
     | 
| 
       17 
     | 
    
         
            -
                @redises.rpush(@key,  
     | 
| 
       18 
     | 
    
         
            -
                @redises.rpush(@key,  
     | 
| 
      
 16 
     | 
    
         
            +
              it 'appends items to the list' do
         
     | 
| 
      
 17 
     | 
    
         
            +
                @redises.rpush(@key, 'bert')
         
     | 
| 
      
 18 
     | 
    
         
            +
                @redises.rpush(@key, 'ernie')
         
     | 
| 
       19 
19 
     | 
    
         | 
| 
       20 
     | 
    
         
            -
                @redises.lindex(@key, 0).should ==  
     | 
| 
       21 
     | 
    
         
            -
                @redises.lindex(@key, 1).should ==  
     | 
| 
      
 20 
     | 
    
         
            +
                @redises.lindex(@key, 0).should == 'bert'
         
     | 
| 
      
 21 
     | 
    
         
            +
                @redises.lindex(@key, 1).should == 'ernie'
         
     | 
| 
       22 
22 
     | 
    
         
             
              end
         
     | 
| 
       23 
23 
     | 
    
         | 
| 
       24 
     | 
    
         
            -
              it  
     | 
| 
      
 24 
     | 
    
         
            +
              it 'stores values as strings' do
         
     | 
| 
       25 
25 
     | 
    
         
             
                @redises.rpush(@key, 1)
         
     | 
| 
       26 
     | 
    
         
            -
                @redises.lindex(@key, 0).should ==  
     | 
| 
      
 26 
     | 
    
         
            +
                @redises.lindex(@key, 0).should == '1'
         
     | 
| 
       27 
27 
     | 
    
         
             
              end
         
     | 
| 
       28 
28 
     | 
    
         | 
| 
       29 
     | 
    
         
            -
              it  
     | 
| 
      
 29 
     | 
    
         
            +
              it 'supports a variable number of arguments' do
         
     | 
| 
       30 
30 
     | 
    
         
             
                @redises.rpush(@key, [1, 2, 3]).should == 3
         
     | 
| 
       31 
     | 
    
         
            -
                @redises.lindex(@key, 0).should ==  
     | 
| 
       32 
     | 
    
         
            -
                @redises.lindex(@key, 1).should ==  
     | 
| 
       33 
     | 
    
         
            -
                @redises.lindex(@key, 2).should ==  
     | 
| 
      
 31 
     | 
    
         
            +
                @redises.lindex(@key, 0).should == '1'
         
     | 
| 
      
 32 
     | 
    
         
            +
                @redises.lindex(@key, 1).should == '2'
         
     | 
| 
      
 33 
     | 
    
         
            +
                @redises.lindex(@key, 2).should == '3'
         
     | 
| 
       34 
34 
     | 
    
         
             
              end
         
     | 
| 
       35 
35 
     | 
    
         | 
| 
       36 
     | 
    
         
            -
              it  
     | 
| 
      
 36 
     | 
    
         
            +
              it 'raises an error if an empty array is given' do
         
     | 
| 
       37 
37 
     | 
    
         
             
                lambda do
         
     | 
| 
       38 
38 
     | 
    
         
             
                  @redises.rpush(@key, [])
         
     | 
| 
       39 
39 
     | 
    
         
             
                end.should raise_error(Redis::CommandError)
         
     | 
| 
       40 
40 
     | 
    
         
             
              end
         
     | 
| 
       41 
41 
     | 
    
         | 
| 
       42 
     | 
    
         
            -
              it_should_behave_like  
     | 
| 
      
 42 
     | 
    
         
            +
              it_should_behave_like 'a list-only command'
         
     | 
| 
       43 
43 
     | 
    
         
             
            end
         
     | 
| 
         @@ -1,45 +1,45 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            require 'spec_helper'
         
     | 
| 
       2 
2 
     | 
    
         | 
| 
       3 
     | 
    
         
            -
            describe  
     | 
| 
      
 3 
     | 
    
         
            +
            describe '#rpushx(key, value)' do
         
     | 
| 
       4 
4 
     | 
    
         
             
              before { @key = 'mock-redis-test:92925' }
         
     | 
| 
       5 
5 
     | 
    
         | 
| 
       6 
     | 
    
         
            -
              it  
     | 
| 
      
 6 
     | 
    
         
            +
              it 'returns the new size of the list' do
         
     | 
| 
       7 
7 
     | 
    
         
             
                @redises.lpush(@key, 'X')
         
     | 
| 
       8 
8 
     | 
    
         | 
| 
       9 
9 
     | 
    
         
             
                @redises.rpushx(@key, 'X').should == 2
         
     | 
| 
       10 
10 
     | 
    
         
             
                @redises.rpushx(@key, 'X').should == 3
         
     | 
| 
       11 
11 
     | 
    
         
             
              end
         
     | 
| 
       12 
12 
     | 
    
         | 
| 
       13 
     | 
    
         
            -
              it  
     | 
| 
      
 13 
     | 
    
         
            +
              it 'does nothing when run against a nonexistent key' do
         
     | 
| 
       14 
14 
     | 
    
         
             
                @redises.rpushx(@key, 'value')
         
     | 
| 
       15 
15 
     | 
    
         
             
                @redises.get(@key).should be_nil
         
     | 
| 
       16 
16 
     | 
    
         
             
              end
         
     | 
| 
       17 
17 
     | 
    
         | 
| 
       18 
     | 
    
         
            -
              it  
     | 
| 
       19 
     | 
    
         
            -
                @redises.lpush(@key,  
     | 
| 
       20 
     | 
    
         
            -
                @redises.rpushx(@key,  
     | 
| 
      
 18 
     | 
    
         
            +
              it 'appends items to the list' do
         
     | 
| 
      
 19 
     | 
    
         
            +
                @redises.lpush(@key, 'bert')
         
     | 
| 
      
 20 
     | 
    
         
            +
                @redises.rpushx(@key, 'ernie')
         
     | 
| 
       21 
21 
     | 
    
         | 
| 
       22 
     | 
    
         
            -
                @redises.lindex(@key, 0).should ==  
     | 
| 
       23 
     | 
    
         
            -
                @redises.lindex(@key, 1).should ==  
     | 
| 
      
 22 
     | 
    
         
            +
                @redises.lindex(@key, 0).should == 'bert'
         
     | 
| 
      
 23 
     | 
    
         
            +
                @redises.lindex(@key, 1).should == 'ernie'
         
     | 
| 
       24 
24 
     | 
    
         
             
              end
         
     | 
| 
       25 
25 
     | 
    
         | 
| 
       26 
     | 
    
         
            -
              it  
     | 
| 
      
 26 
     | 
    
         
            +
              it 'stores values as strings' do
         
     | 
| 
       27 
27 
     | 
    
         
             
                @redises.rpush(@key, 1)
         
     | 
| 
       28 
28 
     | 
    
         
             
                @redises.rpushx(@key, 2)
         
     | 
| 
       29 
     | 
    
         
            -
                @redises.lindex(@key, 1).should ==  
     | 
| 
      
 29 
     | 
    
         
            +
                @redises.lindex(@key, 1).should == '2'
         
     | 
| 
       30 
30 
     | 
    
         
             
              end
         
     | 
| 
       31 
31 
     | 
    
         | 
| 
       32 
     | 
    
         
            -
              it  
     | 
| 
      
 32 
     | 
    
         
            +
              it 'raises an error if an empty array is given' do
         
     | 
| 
       33 
33 
     | 
    
         
             
                lambda do
         
     | 
| 
       34 
34 
     | 
    
         
             
                  @redises.rpushx(@key, [])
         
     | 
| 
       35 
35 
     | 
    
         
             
                end.should raise_error(Redis::CommandError)
         
     | 
| 
       36 
36 
     | 
    
         
             
              end
         
     | 
| 
       37 
37 
     | 
    
         | 
| 
       38 
     | 
    
         
            -
              it  
     | 
| 
      
 38 
     | 
    
         
            +
              it 'raises an error if an array of more than one item is given' do
         
     | 
| 
       39 
39 
     | 
    
         
             
                lambda do
         
     | 
| 
       40 
40 
     | 
    
         
             
                  @redises.rpushx(@key, [1, 2])
         
     | 
| 
       41 
41 
     | 
    
         
             
                end.should raise_error(Redis::CommandError)
         
     | 
| 
       42 
42 
     | 
    
         
             
              end
         
     | 
| 
       43 
43 
     | 
    
         | 
| 
       44 
     | 
    
         
            -
              it_should_behave_like  
     | 
| 
      
 44 
     | 
    
         
            +
              it_should_behave_like 'a list-only command'
         
     | 
| 
       45 
45 
     | 
    
         
             
            end
         
     | 
    
        data/spec/commands/sadd_spec.rb
    CHANGED
    
    | 
         @@ -3,44 +3,43 @@ require 'spec_helper' 
     | 
|
| 
       3 
3 
     | 
    
         
             
            describe '#sadd(key, member)' do
         
     | 
| 
       4 
4 
     | 
    
         
             
              before { @key = 'mock-redis-test:sadd' }
         
     | 
| 
       5 
5 
     | 
    
         | 
| 
       6 
     | 
    
         
            -
              it  
     | 
| 
      
 6 
     | 
    
         
            +
              it 'returns true if the set did not already contain member' do
         
     | 
| 
       7 
7 
     | 
    
         
             
                @redises.sadd(@key, 1).should == true
         
     | 
| 
       8 
8 
     | 
    
         
             
              end
         
     | 
| 
       9 
9 
     | 
    
         | 
| 
       10 
     | 
    
         
            -
              it  
     | 
| 
      
 10 
     | 
    
         
            +
              it 'returns false if the set did already contain member' do
         
     | 
| 
       11 
11 
     | 
    
         
             
                @redises.sadd(@key, 1)
         
     | 
| 
       12 
12 
     | 
    
         
             
                @redises.sadd(@key, 1).should == false
         
     | 
| 
       13 
13 
     | 
    
         
             
              end
         
     | 
| 
       14 
14 
     | 
    
         | 
| 
       15 
     | 
    
         
            -
              it  
     | 
| 
      
 15 
     | 
    
         
            +
              it 'adds member to the set' do
         
     | 
| 
       16 
16 
     | 
    
         
             
                @redises.sadd(@key, 1)
         
     | 
| 
       17 
17 
     | 
    
         
             
                @redises.sadd(@key, 2)
         
     | 
| 
       18 
18 
     | 
    
         
             
                @redises.smembers(@key).should == %w[2 1]
         
     | 
| 
       19 
19 
     | 
    
         
             
              end
         
     | 
| 
       20 
20 
     | 
    
         | 
| 
       21 
21 
     | 
    
         
             
              describe 'adding multiple members at once' do
         
     | 
| 
       22 
     | 
    
         
            -
             
     | 
| 
       23 
     | 
    
         
            -
                it "returns the amount of added members" do
         
     | 
| 
      
 22 
     | 
    
         
            +
                it 'returns the amount of added members' do
         
     | 
| 
       24 
23 
     | 
    
         
             
                  @redises.sadd(@key, [1, 2, 3]).should == 3
         
     | 
| 
       25 
24 
     | 
    
         
             
                  @redises.sadd(@key, [1, 2, 3, 4]).should == 1
         
     | 
| 
       26 
25 
     | 
    
         
             
                end
         
     | 
| 
       27 
26 
     | 
    
         | 
| 
       28 
     | 
    
         
            -
                it  
     | 
| 
      
 27 
     | 
    
         
            +
                it 'returns 0 if the set did already contain all members' do
         
     | 
| 
       29 
28 
     | 
    
         
             
                  @redises.sadd(@key, [1, 2, 3])
         
     | 
| 
       30 
29 
     | 
    
         
             
                  @redises.sadd(@key, [1, 2, 3]).should == 0
         
     | 
| 
       31 
30 
     | 
    
         
             
                end
         
     | 
| 
       32 
31 
     | 
    
         | 
| 
       33 
     | 
    
         
            -
                it  
     | 
| 
      
 32 
     | 
    
         
            +
                it 'adds the members to the set' do
         
     | 
| 
       34 
33 
     | 
    
         
             
                  @redises.sadd(@key, [1, 2, 3])
         
     | 
| 
       35 
34 
     | 
    
         
             
                  @redises.smembers(@key).should == %w[1 2 3]
         
     | 
| 
       36 
35 
     | 
    
         
             
                end
         
     | 
| 
       37 
36 
     | 
    
         | 
| 
       38 
     | 
    
         
            -
                it  
     | 
| 
      
 37 
     | 
    
         
            +
                it 'raises an error if an empty array is given' do
         
     | 
| 
       39 
38 
     | 
    
         
             
                  lambda do
         
     | 
| 
       40 
39 
     | 
    
         
             
                    @redises.sadd(@key, [])
         
     | 
| 
       41 
40 
     | 
    
         
             
                  end.should raise_error(Redis::CommandError)
         
     | 
| 
       42 
41 
     | 
    
         
             
                end
         
     | 
| 
       43 
42 
     | 
    
         
             
              end
         
     | 
| 
       44 
43 
     | 
    
         | 
| 
       45 
     | 
    
         
            -
              it_should_behave_like  
     | 
| 
      
 44 
     | 
    
         
            +
              it_should_behave_like 'a set-only command'
         
     | 
| 
       46 
45 
     | 
    
         
             
            end
         
     |