Sha256: 89b4ecda1fc438a1ca0a313b357516b9c40069fe13b4f5337cc6bd46e072b37f
Contents?: true
Size: 1.53 KB
Versions: 11
Compression:
Stored size: 1.53 KB
Contents
require 'spec_helper' require 'riak/bucket_type' describe Riak::BucketType do let(:client){ Riak::Client.allocate } let(:name){ 'bucket_type_spec' } let(:backend) do double('Backend').tap do |backend| allow(client).to receive(:backend).and_yield(backend) end end subject{ described_class.new client, name } it 'is created with a client and name' do expect{ described_class.new client, name }.to_not raise_error end it 'returns a typed bucket' do typed_bucket = subject.bucket 'empanadas' expect(typed_bucket).to be_a Riak::Bucket expect(typed_bucket).to be_a Riak::BucketTyped::Bucket expect(typed_bucket.name).to eq 'empanadas' expect(typed_bucket.type).to eq subject end describe 'equality' do let(:same){ described_class.new client, name } let(:different_client){ described_class.new Riak::Client.allocate, name } let(:different_name){ described_class.new client, 'different name' } it { is_expected.to eq same } it { is_expected.to_not eq different_client } it { is_expected.to_not eq different_name } end describe 'properties' do let(:props_expectation){ expect(backend).to receive(:get_bucket_type_props).with(name) } it 'is queryable' do props_expectation.and_return(allow_mult: true) expect(props = subject.properties).to be_a Hash expect(props[:allow_mult]).to be end it 'asks for data type' do props_expectation.and_return(datatype: 'set') expect(subject.data_type_class).to eq Riak::Crdt::Set end end end
Version data entries
11 entries across 11 versions & 2 rubygems