Sha256: 54c6255c952c1004f5a0a9c00dbc02fd39358481db54ed2d12214c07f901b2d0

Contents?: true

Size: 800 Bytes

Versions: 39

Compression:

Stored size: 800 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', 360000)
    @mock.flushall
    @mock.set('k1', 'v1')
    @mock.ttl('k1').should == -1
  end
end

Version data entries

39 entries across 39 versions & 2 rubygems

Version Path
mock_redis-0.14.1 spec/commands/flushall_spec.rb
mock_redis-0.14.0 spec/commands/flushall_spec.rb
mock_redis-0.13.2 spec/commands/flushall_spec.rb
mock_redis-0.13.1 spec/commands/flushall_spec.rb
mock_redis-0.13.0 spec/commands/flushall_spec.rb
mock_redis-0.12.1 spec/commands/flushall_spec.rb
mock_redis-0.12.0 spec/commands/flushall_spec.rb
mock_redis-0.11.0 spec/commands/flushall_spec.rb
mock_redis-0.10.0 spec/commands/flushall_spec.rb
mock_redis-0.9.0 spec/commands/flushall_spec.rb
mock_redis-0.8.2 spec/commands/flushall_spec.rb
mock_redis-0.8.1 spec/commands/flushall_spec.rb
mock_redis-0.8.0 spec/commands/flushall_spec.rb
mock_redis-0.7.0 spec/commands/flushall_spec.rb
mock_redis-0.6.6 spec/commands/flushall_spec.rb
mock_redis-0.6.5 spec/commands/flushall_spec.rb
mock_redis-0.6.4 spec/commands/flushall_spec.rb
mock_redis-0.6.3 spec/commands/flushall_spec.rb
mock_redis-0.6.2 spec/commands/flushall_spec.rb
mock_redis-0.6.1 spec/commands/flushall_spec.rb