Sha256: ae3fb6dadbb38a03b1f4c10c2bed2eaa2e8c79d39e216a425e03d24118497595

Contents?: true

Size: 573 Bytes

Versions: 4

Compression:

Stored size: 573 Bytes

Contents

require_relative '../../spec_helper'

describe RemoveKey do
  let(:backend){ double() }
  let(:key){ 'key' }
  let(:command){ RemoveKey.new(backend, key) }

  describe 'execute' do
    it 'should not delete content if not allowed' do
      Authorization.stub(:authorized_for?).with(:remove_content){ false }
      backend.should_receive(:del).never
      command.execute
    end

    it 'should remove content if allowed' do
      Authorization.stub(:authorized_for?).with(:remove_content){ true }
      backend.should_receive(:del)
      command.execute
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
redis_monitor-0.3.3 lib/engine/spec/lib/commands/remove_key_spec.rb
redis_monitor-0.3.2 lib/engine/spec/lib/commands/remove_key_spec.rb
redis_monitor-0.3 lib/engine/spec/lib/commands/remove_key_spec.rb
redis_monitor-0.2.1 lib/engine/spec/lib/commands/remove_key_spec.rb