Sha256: fde145e3339542015670e05054260221cd5026b795ee42fcecae3d99465ae8ab

Contents?: true

Size: 1.02 KB

Versions: 3

Compression:

Stored size: 1.02 KB

Contents

# encoding: utf-8
require_relative '../../spec_helper.rb'

require 'redis-copy'
require 'redis-copy/key-emitter/interface.spec'

describe RedisCopy::KeyEmitter::Keys do
  it_should_behave_like RedisCopy::KeyEmitter do
    context '#keys' do
      context 'the supplied ui' do
        it 'should get a debug message' do
          ui.should_receive(:debug).
            with(/#{redis.client.id} KEYS \*/).
            exactly(:once)
          instance.keys
        end
        context 'when source has > 10,000 keys' do
          let(:key_count) { 10_001 }
          it 'should ask for confirmation' do
            ui.should_receive(:confirm?) do |confirmation|
              confirmation.should match /\b10,001/
            end
            instance.keys
          end
        end
        context 'when source has <= 10,000 keys' do
          let(:key_count) { 1_000 }
          it 'should not ask for confirmation' do
            ui.should_not_receive(:confirm?)
            instance.keys
          end
        end
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
redis-copy-1.0.0 spec/redis-copy/key-emitter/keys_spec.rb
redis-copy-1.0.0.rc.1 spec/redis-copy/key-emitter/keys_spec.rb
redis-copy-1.0.0.rc.0 spec/redis-copy/key-emitter/keys_spec.rb