Sha256: a9bb7fdc6b489e6d67497267575c4ef9b309f635237bfb688f35c00855bbe531

Contents?: true

Size: 1.13 KB

Versions: 7

Compression:

Stored size: 1.13 KB

Contents

require 'spec_helper'

describe Riak::TimeSeries::Submission do
  subject{ described_class.new client, table_name }
  let(:table_name){ 'GeoCheckin' }
  let(:client){ instance_double('Riak::Client') }
  let(:measurements){ double 'measurements' }
  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::TimeSeriesPutOperator'
    ).tap do |po|
      allow(backend).to receive(:time_series_put_operator).
                         and_return(po)
    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 measurements to a put operator' do
    expect{ subject.measurements = measurements }.to_not raise_error

    expect(operator).to receive(:put).with(table_name, measurements)

    expect{ subject.write! }.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/submission_spec.rb
riak-client-2.4.1 spec/riak/time_series/submission_spec.rb
riak-client-2.4.0 spec/riak/time_series/submission_spec.rb
riak-client-2.4.0.pre1 spec/riak/time_series/submission_spec.rb
riak-client-2.3.2 spec/riak/time_series/submission_spec.rb
riak-client-2.3.1 spec/riak/time_series/submission_spec.rb
riak-client-2.3.0 spec/riak/time_series/submission_spec.rb