Sha256: 0b3fc6df508778438dbbe458e66d8cda91852a3e3bcff554303140b4f5f116ac

Contents?: true

Size: 439 Bytes

Versions: 33

Compression:

Stored size: 439 Bytes

Contents

require 'spec_helper'

describe '#randomkey [mock only]' do
  before { @mock = @redises.mock }

  it 'finds a random key' do
    @keys = ['mock-redis-test:1', 'mock-redis-test:2', 'mock-redis-test:3']

    @keys.each do |k|
      @mock.set(k, 1)
    end

    @keys.should include(@mock.randomkey)
  end

  it 'returns nil when there are no keys' do
    @mock.keys('*').each { |k| @mock.del(k) }
    @mock.randomkey.should be_nil
  end
end

Version data entries

33 entries across 33 versions & 1 rubygems

Version Path
mock_redis-0.19.0 spec/commands/randomkey_spec.rb
mock_redis-0.18.0 spec/commands/randomkey_spec.rb
mock_redis-0.17.3 spec/commands/randomkey_spec.rb
mock_redis-0.17.2 spec/commands/randomkey_spec.rb
mock_redis-0.17.1 spec/commands/randomkey_spec.rb
mock_redis-0.17.0 spec/commands/randomkey_spec.rb
mock_redis-0.16.1 spec/commands/randomkey_spec.rb
mock_redis-0.16.0 spec/commands/randomkey_spec.rb
mock_redis-0.15.4 spec/commands/randomkey_spec.rb
mock_redis-0.15.3 spec/commands/randomkey_spec.rb
mock_redis-0.15.2 spec/commands/randomkey_spec.rb
mock_redis-0.15.1 spec/commands/randomkey_spec.rb
mock_redis-0.15.0 spec/commands/randomkey_spec.rb