spec/riak/client_spec.rb in riak-client-2.1.0 vs spec/riak/client_spec.rb in riak-client-2.2.0.pre1
- old
+ new
@@ -29,24 +29,31 @@
expect(Riak::Client.new(pb_port: test_client.nodes.first.pb_port).client_id).not_to be_nil
end
it "accepts multiple nodes" do
client = Riak::Client.new :nodes => [
- {:host => 'riak1.basho.com'},
- {:host => 'riak2.basho.com', :pb_port => 1234},
- {:host => 'riak3.basho.com', :pb_port => 5678}
- ]
+ {:host => 'riak1.basho.com'},
+ {:host => 'riak2.basho.com', :pb_port => 1234},
+ {:host => 'riak3.basho.com', :pb_port => 5678}
+ ]
expect(client.nodes.size).to eq(3)
expect(client.nodes.first.host).to eq("riak1.basho.com")
end
end
it "exposes a Stamp object" do
expect(subject).to respond_to(:stamp)
expect(subject.stamp).to be_kind_of(Riak::Stamp)
end
+ it 'exposes bucket types' do
+ bucket_type = nil
+ expect{ bucket_type = subject.bucket_type('example') }.to_not raise_error
+ expect(bucket_type).to be_a Riak::BucketType
+ expect(bucket_type.name).to eq 'example'
+ end
+
describe "reconfiguring" do
before :each do
@client = Riak::Client.new
end
@@ -106,13 +113,13 @@
@client = Riak::Client.new
@bucket = @client.bucket('foo')
expect(@bucket).to receive(:[]).with('value1').and_return(double('robject'))
expect(@bucket).to receive(:[]).with('value2').and_return(double('robject'))
@pairs = [
- [@bucket, 'value1'],
- [@bucket, 'value2']
- ]
+ [@bucket, 'value1'],
+ [@bucket, 'value2']
+ ]
end
it 'accepts an array of bucket and key pairs' do
expect{ @client.get_many(@pairs) }.not_to raise_error
end
@@ -183,11 +190,11 @@
buckets = @client.buckets timeout: 1234
expect(buckets.size).to eq(2)
end
end
- describe "when receiving errors from the backend"
+ describe "when receiving errors from the backend" do
before do
@client = Riak::Client.new
end
it "retries on recoverable errors" do
@@ -215,6 +222,7 @@
end
expect(error).not_to be_nil
expect(error).to be_instance_of(RuntimeError)
end
+ end
end