spec/riak/bucket_spec.rb in riak-client-2.2.0.pre1 vs spec/riak/bucket_spec.rb in riak-client-2.2.0
- old
+ new
@@ -36,11 +36,11 @@
expect(@backend).to receive(:list_keys).with(@bucket, {}).and_yield([]).and_yield(["bar"]).and_yield(["baz"])
all_keys = []
@bucket.keys do |list|
all_keys.concat(list)
end
- expect(all_keys).to eq(["bar", "baz"])
+ expect(all_keys).to eq(%w(bar baz))
end
it "fetches a fresh list of keys" do
expect(@backend).to receive(:list_keys).with(@bucket, {}).twice.and_return(["bar"])
2.times { expect(@bucket.keys).to eq(['bar']) }
@@ -64,11 +64,11 @@
end
describe "accessing a counter" do
it "returns a counter object" do
expect(Riak::Counter).to receive(:new).with(@bucket, 'asdf').and_return('example counter')
-
+
new_counter = @bucket.counter 'asdf'
expect(new_counter).to eq('example counter')
end
end
@@ -144,11 +144,11 @@
let(:not_found_error){ Riak::ProtobuffsFailedRequest.new :not_found, 'not found' }
let(:other_error){ Riak::ProtobuffsFailedRequest.new :server_error, 'server error' }
it "returns the existing object if present" do
@object = double("RObject")
- expect(@backend).to receive(:fetch_object).with(@bucket,"db", {}).and_return(@object)
+ expect(@backend).to receive(:fetch_object).with(@bucket, "db", {}).and_return(@object)
expect(@bucket.get_or_new('db')).to eq(@object)
end
it "creates a new blank object if the key does not exist" do
expect(@backend).to receive(:fetch_object).and_raise(not_found_error)
@@ -162,11 +162,11 @@
expect { @bucket.get_or_new('db') }.to raise_error(Riak::ProtobuffsFailedRequest)
end
it "passes the given R quorum parameter to the backend" do
@object = double("RObject")
- expect(@backend).to receive(:fetch_object).with(@bucket,"db", {:r => "all"}).and_return(@object)
+ expect(@backend).to receive(:fetch_object).with(@bucket, "db", {:r => "all"}).and_return(@object)
expect(@bucket.get_or_new('db', :r => "all")).to eq(@object)
end
end
describe "fetching multiple objects" do
@@ -241,10 +241,10 @@
expect(@bucket.send(q)).to eq("quorum")
end
it "sets the #{q} quorum" do
expect(@bucket).to receive(:props=).with(hash_including("#{q}" => 1))
- @bucket.send("#{q}=",1)
+ @bucket.send("#{q}=", 1)
end
end
end
describe "checking whether a key exists" do