Sha256: 95d7f8d21bd369cbdc684ba23bd16885763da9868f3b86d00e0bb93bf34acf55

Contents?: true

Size: 801 Bytes

Versions: 33

Compression:

Stored size: 801 Bytes

Contents

require 'spec_helper'

describe '#flushall [mock only]' do
  # don't want to hurt things in the real redis that are outside our
  # namespace.
  before { @mock = @redises.mock }
  before { @key = 'mock-redis-test:select' }

  it "returns 'OK'" do
    @mock.flushall.should == 'OK'
  end

  it 'removes all keys in the current DB' do
    @mock.set('k1', 'v1')
    @mock.lpush('k2', 'v2')

    @mock.flushall
    @mock.keys('*').should == []
  end

  it 'removes all keys in other DBs, too' do
    @mock.set('k1', 'v1')

    @mock.select(1)
    @mock.flushall
    @mock.select(0)

    @mock.get('k1').should be_nil
  end

  it 'removes expiration times' do
    @mock.set('k1', 'v1')
    @mock.expire('k1', 360_000)
    @mock.flushall
    @mock.set('k1', 'v1')
    @mock.ttl('k1').should == -1
  end
end

Version data entries

33 entries across 33 versions & 1 rubygems

Version Path
mock_redis-0.36.0 spec/commands/flushall_spec.rb
mock_redis-0.35.0 spec/commands/flushall_spec.rb
mock_redis-0.34.0 spec/commands/flushall_spec.rb
mock_redis-0.33.0 spec/commands/flushall_spec.rb
mock_redis-0.32.0 spec/commands/flushall_spec.rb
mock_redis-0.31.0 spec/commands/flushall_spec.rb
mock_redis-0.30.0 spec/commands/flushall_spec.rb
mock_redis-0.29.0 spec/commands/flushall_spec.rb
mock_redis-0.28.0 spec/commands/flushall_spec.rb
mock_redis-0.27.3 spec/commands/flushall_spec.rb
mock_redis-0.27.2 spec/commands/flushall_spec.rb
mock_redis-0.27.1 spec/commands/flushall_spec.rb
mock_redis-0.27.0 spec/commands/flushall_spec.rb
mock_redis-0.26.0 spec/commands/flushall_spec.rb
mock_redis-0.25.0 spec/commands/flushall_spec.rb
mock_redis-0.24.0 spec/commands/flushall_spec.rb
mock_redis-0.23.0 spec/commands/flushall_spec.rb
mock_redis-0.22.0 spec/commands/flushall_spec.rb
mock_redis-0.21.0 spec/commands/flushall_spec.rb
mock_redis-0.20.0 spec/commands/flushall_spec.rb