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.36.0 spec/commands/randomkey_spec.rb
mock_redis-0.35.0 spec/commands/randomkey_spec.rb
mock_redis-0.34.0 spec/commands/randomkey_spec.rb
mock_redis-0.33.0 spec/commands/randomkey_spec.rb
mock_redis-0.32.0 spec/commands/randomkey_spec.rb
mock_redis-0.31.0 spec/commands/randomkey_spec.rb
mock_redis-0.30.0 spec/commands/randomkey_spec.rb
mock_redis-0.29.0 spec/commands/randomkey_spec.rb
mock_redis-0.28.0 spec/commands/randomkey_spec.rb
mock_redis-0.27.3 spec/commands/randomkey_spec.rb
mock_redis-0.27.2 spec/commands/randomkey_spec.rb
mock_redis-0.27.1 spec/commands/randomkey_spec.rb
mock_redis-0.27.0 spec/commands/randomkey_spec.rb
mock_redis-0.26.0 spec/commands/randomkey_spec.rb
mock_redis-0.25.0 spec/commands/randomkey_spec.rb
mock_redis-0.24.0 spec/commands/randomkey_spec.rb
mock_redis-0.23.0 spec/commands/randomkey_spec.rb
mock_redis-0.22.0 spec/commands/randomkey_spec.rb
mock_redis-0.21.0 spec/commands/randomkey_spec.rb
mock_redis-0.20.0 spec/commands/randomkey_spec.rb