Sha256: 8a71794c1c6304e839afb7d63cda3e5b882fc9753af13cdbe2acb1eeca73bcb3

Contents?: true

Size: 1.1 KB

Versions: 7

Compression:

Stored size: 1.1 KB

Contents

require 'spec_helper'

describe Riak::TimeSeries::Deletion do
  subject{ described_class.new client, table_name }
  let(:table_name){ 'GeoCheckin' }
  let(:client){ instance_double('Riak::Client') }
  let(:key){ double 'key' }
  let(:backend) do
    instance_double('Riak::Client::BeefcakeProtobuffsBackend').tap do |be|
      allow(client).to receive(:backend).and_yield be
    end
  end
  let(:operator) do
    Riak::Client::BeefcakeProtobuffsBackend.configured?
    instance_double(
      'Riak::Client::BeefcakeProtobuffsBackend::TimeSeriesDeleteOperator'
    ).tap do |op|
      allow(backend).to receive(:time_series_delete_operator).
                         and_return(op)
    end
  end

  it 'initializes with client and table name' do
    expect{ described_class.new client, table_name }.to_not raise_error
    expect{ described_class.new client }.to raise_error ArgumentError
  end

  it 'passes keys to delete to a delete operator' do
    expect{ subject.key = key }.to_not raise_error
    expect(operator).to receive(:delete).with(table_name, key, Hash.new)
    expect{ subject.delete! }.to_not raise_error
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
riak-client-2.5.0 spec/riak/time_series/deletion_spec.rb
riak-client-2.4.1 spec/riak/time_series/deletion_spec.rb
riak-client-2.4.0 spec/riak/time_series/deletion_spec.rb
riak-client-2.4.0.pre1 spec/riak/time_series/deletion_spec.rb
riak-client-2.3.2 spec/riak/time_series/deletion_spec.rb
riak-client-2.3.1 spec/riak/time_series/deletion_spec.rb
riak-client-2.3.0 spec/riak/time_series/deletion_spec.rb