riak-client 2.0.0 → 2.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (67) hide show
  1. checksums.yaml +4 -4
  2. data/README.markdown +55 -12
  3. data/RELEASE_NOTES.md +20 -1
  4. data/lib/riak.rb +1 -0
  5. data/lib/riak/client.rb +2 -1
  6. data/lib/riak/client/beefcake/crdt/counter_loader.rb +18 -0
  7. data/lib/riak/client/beefcake/crdt/map_loader.rb +64 -0
  8. data/lib/riak/client/beefcake/crdt/set_loader.rb +18 -0
  9. data/lib/riak/client/beefcake/crdt_loader.rb +16 -59
  10. data/lib/riak/client/beefcake/crdt_operator.rb +2 -1
  11. data/lib/riak/client/instrumentation.rb +19 -0
  12. data/lib/riak/crdt/base.rb +16 -0
  13. data/lib/riak/errors/backend_creation.rb +9 -0
  14. data/lib/riak/instrumentation.rb +6 -0
  15. data/lib/riak/version.rb +1 -1
  16. data/riak-client.gemspec +3 -2
  17. data/spec/integration/riak/counters_spec.rb +1 -1
  18. data/spec/integration/riak/crdt_spec.rb +68 -23
  19. data/spec/integration/riak/protobuffs_backends_spec.rb +1 -1
  20. data/spec/integration/riak/threading_spec.rb +4 -4
  21. data/spec/integration/yokozuna/index_spec.rb +5 -5
  22. data/spec/integration/yokozuna/queries_spec.rb +15 -16
  23. data/spec/integration/yokozuna/schema_spec.rb +2 -2
  24. data/spec/riak/beefcake_protobuffs_backend/crdt_operator_spec.rb +8 -8
  25. data/spec/riak/beefcake_protobuffs_backend/object_methods_spec.rb +1 -1
  26. data/spec/riak/beefcake_protobuffs_backend_spec.rb +8 -8
  27. data/spec/riak/bucket_spec.rb +38 -38
  28. data/spec/riak/client_spec.rb +26 -27
  29. data/spec/riak/core_ext/to_param_spec.rb +2 -2
  30. data/spec/riak/counter_spec.rb +11 -11
  31. data/spec/riak/crdt/counter_spec.rb +4 -2
  32. data/spec/riak/crdt/inner_counter_spec.rb +1 -1
  33. data/spec/riak/crdt/inner_flag_spec.rb +4 -4
  34. data/spec/riak/crdt/inner_map_spec.rb +3 -3
  35. data/spec/riak/crdt/inner_register_spec.rb +5 -5
  36. data/spec/riak/crdt/inner_set_spec.rb +1 -1
  37. data/spec/riak/crdt/map_spec.rb +2 -2
  38. data/spec/riak/crdt/set_spec.rb +4 -2
  39. data/spec/riak/crdt/shared_examples.rb +15 -15
  40. data/spec/riak/crdt/typed_collection_spec.rb +16 -22
  41. data/spec/riak/escape_spec.rb +10 -10
  42. data/spec/riak/feature_detection_spec.rb +1 -1
  43. data/spec/riak/index_collection_spec.rb +7 -4
  44. data/spec/riak/instrumentation_spec.rb +124 -0
  45. data/spec/riak/link_spec.rb +12 -12
  46. data/spec/riak/list_buckets_spec.rb +2 -2
  47. data/spec/riak/map_reduce/filter_builder_spec.rb +5 -5
  48. data/spec/riak/map_reduce/phase_spec.rb +20 -20
  49. data/spec/riak/map_reduce_spec.rb +50 -50
  50. data/spec/riak/multiget_spec.rb +5 -5
  51. data/spec/riak/node_spec.rb +3 -3
  52. data/spec/riak/robject_spec.rb +46 -45
  53. data/spec/riak/search_spec.rb +11 -11
  54. data/spec/riak/secondary_index_spec.rb +9 -9
  55. data/spec/riak/stamp_spec.rb +5 -5
  56. data/spec/riak/walk_spec_spec.rb +30 -30
  57. data/spec/spec_helper.rb +6 -0
  58. data/spec/support/certs/ca.crt +19 -20
  59. data/spec/support/certs/client.crl +13 -0
  60. data/spec/support/certs/client.crt +68 -69
  61. data/spec/support/certs/client.csr +18 -0
  62. data/spec/support/certs/client.key +25 -25
  63. data/spec/support/certs/server.crl +11 -11
  64. data/spec/support/certs/server.crt +68 -69
  65. data/spec/support/certs/server.key +25 -25
  66. data/spec/support/unified_backend_examples.rb +33 -33
  67. metadata +31 -5
@@ -11,7 +11,7 @@ describe Riak::Client::BeefcakeProtobuffsBackend::ObjectMethods do
11
11
  end
12
12
 
13
13
  describe "loading object data from the response" do
14
- it "should load the key" do
14
+ it "loads the key" do
15
15
  content = double(:value => '', :vtag => nil, :content_type => nil, :links => nil, :usermeta => nil, :last_mod => nil, :indexes => nil, :charset => nil)
16
16
  pbuf = double(:vclock => nil, :content => [content], :value => nil, :key => 'akey')
17
17
  o = @backend.load_object(pbuf, @object)
@@ -17,7 +17,7 @@ describe Riak::Client::BeefcakeProtobuffsBackend do
17
17
  allow(TCPSocket).to receive(:new).and_return(@socket)
18
18
  end
19
19
 
20
- it 'should raise an appropriate error when 2i is not available' do
20
+ it 'raises an appropriate error when 2i is not available' do
21
21
  expect(protocol).to receive(:write)
22
22
  expect(protocol).to receive(:expect).
23
23
  and_raise(
@@ -34,7 +34,7 @@ describe Riak::Client::BeefcakeProtobuffsBackend do
34
34
  end
35
35
 
36
36
  context 'when streaming' do
37
- it "should stream when a block is given" do
37
+ it "streams when a block is given" do
38
38
  expect(protocol).to receive(:write) do |msg, req|
39
39
  expect(msg).to eq(:IndexReq)
40
40
  expect(req[:stream]).to eq(true)
@@ -47,7 +47,7 @@ describe Riak::Client::BeefcakeProtobuffsBackend do
47
47
  backend.get_index('bucket', 'words', 'asdf'..'hjkl', &blk)
48
48
  end
49
49
 
50
- it "should send batches of results to the block" do
50
+ it "sends batches of results to the block" do
51
51
  expect(protocol).to receive(:write)
52
52
 
53
53
  response_sets = [%w{asdf asdg asdh}, %w{gggg gggh gggi}]
@@ -68,7 +68,7 @@ describe Riak::Client::BeefcakeProtobuffsBackend do
68
68
  end
69
69
  end
70
70
 
71
- it "should return a full batch of results when not streaming" do
71
+ it "returns a full batch of results when not streaming" do
72
72
  expect(protocol).to receive(:write) do |msg, req|
73
73
  expect(msg).to eq(:IndexReq)
74
74
  expect(req[:stream]).not_to be
@@ -85,7 +85,7 @@ describe Riak::Client::BeefcakeProtobuffsBackend do
85
85
  expect(results).to eq(%w{asdf asdg asdh})
86
86
  end
87
87
 
88
- it "should not crash out when no keys or terms are returned" do
88
+ it "returns no results when no keys or terms are returned" do
89
89
  expect(protocol).to receive(:write) do |msg, req|
90
90
  expect(msg).to eq(:IndexReq)
91
91
  expect(req[:stream]).not_to be
@@ -109,7 +109,7 @@ describe Riak::Client::BeefcakeProtobuffsBackend do
109
109
  context "#mapred" do
110
110
  let(:mapred) { Riak::MapReduce.new(client).add('test').map("function(){}").map("function(){}") }
111
111
 
112
- it "should not return nil for previous phases that don't return anything" do
112
+ it "returns empty sets for previous phases that don't return anything" do
113
113
  expect(protocol).to receive(:write)
114
114
 
115
115
  message = double(:message, :phase => 1, :response => [{}].to_json)
@@ -137,7 +137,7 @@ describe Riak::Client::BeefcakeProtobuffsBackend do
137
137
  end
138
138
  end
139
139
 
140
- it "should set the if_none_match field when the object is new" do
140
+ it "sets the if_none_match field when the object is new" do
141
141
  expect(protocol).to receive(:write) do |msg, req|
142
142
  expect(msg).to eq(:PutReq)
143
143
  expect(req.if_none_match).to be_truthy
@@ -148,7 +148,7 @@ describe Riak::Client::BeefcakeProtobuffsBackend do
148
148
  backend.store_object(robject)
149
149
  end
150
150
 
151
- it "should set the if_not_modified field when the object has a vclock" do
151
+ it "sets the if_not_modified field when the object has a vclock" do
152
152
  robject.vclock = Base64.encode64("foo")
153
153
  expect(protocol).to receive(:write) do |msg, req|
154
154
  expect(msg).to eq(:PutReq)
@@ -10,16 +10,16 @@ describe Riak::Bucket do
10
10
  end
11
11
 
12
12
  describe "when initializing" do
13
- it "should require a client and a name" do
14
- expect { Riak::Bucket.new }.to raise_error
15
- expect { Riak::Bucket.new(@client) }.to raise_error
16
- expect { Riak::Bucket.new("foo") }.to raise_error
17
- expect { Riak::Bucket.new("foo", @client) }.to raise_error
13
+ it "requires a client and a name" do
14
+ expect { Riak::Bucket.new }.to raise_error ArgumentError
15
+ expect { Riak::Bucket.new(@client) }.to raise_error ArgumentError
16
+ expect { Riak::Bucket.new("foo") }.to raise_error ArgumentError
17
+ expect { Riak::Bucket.new("foo", @client) }.to raise_error ArgumentError
18
18
  expect { Riak::Bucket.new(@client, "foo") }.not_to raise_error
19
19
  expect { Riak::Bucket.new(@client, '') }.to raise_error(ArgumentError)
20
20
  end
21
21
 
22
- it "should set the client and name attributes" do
22
+ it "sets the client and name attributes" do
23
23
  bucket = Riak::Bucket.new(@client, "foo")
24
24
  expect(bucket.client).to eq(@client)
25
25
  expect(bucket.name).to eq("foo")
@@ -27,12 +27,12 @@ describe Riak::Bucket do
27
27
  end
28
28
 
29
29
  describe "accessing keys" do
30
- it "should list the keys" do
30
+ it "lists the keys" do
31
31
  expect(@backend).to receive(:list_keys).with(@bucket, {}).and_return(["bar"])
32
32
  expect(@bucket.keys).to eq(["bar"])
33
33
  end
34
34
 
35
- it "should allow streaming keys through block" do
35
+ it "allows streaming keys through block" do
36
36
  expect(@backend).to receive(:list_keys).with(@bucket, {}).and_yield([]).and_yield(["bar"]).and_yield(["baz"])
37
37
  all_keys = []
38
38
  @bucket.keys do |list|
@@ -41,12 +41,12 @@ describe Riak::Bucket do
41
41
  expect(all_keys).to eq(["bar", "baz"])
42
42
  end
43
43
 
44
- it "should not cache the list of keys" do
44
+ it "fetches a fresh list of keys" do
45
45
  expect(@backend).to receive(:list_keys).with(@bucket, {}).twice.and_return(["bar"])
46
46
  2.times { expect(@bucket.keys).to eq(['bar']) }
47
47
  end
48
48
 
49
- it "should warn about the expense of list-keys when warnings are not disabled" do
49
+ it "warns about the expense of list-keys when warnings are not disabled" do
50
50
  Riak.disable_list_keys_warnings = false
51
51
  allow(@backend).to receive(:list_keys).and_return(%w{test test2})
52
52
  expect(@bucket).to receive(:warn)
@@ -54,7 +54,7 @@ describe Riak::Bucket do
54
54
  Riak.disable_list_keys_warnings = true
55
55
  end
56
56
 
57
- it "should allow a specified timeout when listing keys" do
57
+ it "allows a specified timeout when listing keys" do
58
58
  expect(@backend).to receive(:list_keys).with(@bucket, timeout: 1234).and_return(%w{bar})
59
59
 
60
60
  keys = @bucket.keys timeout: 1234
@@ -64,7 +64,7 @@ describe Riak::Bucket do
64
64
  end
65
65
 
66
66
  describe "accessing a counter" do
67
- it "should return a counter object" do
67
+ it "returns a counter object" do
68
68
  expect(Riak::Counter).to receive(:new).with(@bucket, 'asdf').and_return('example counter')
69
69
 
70
70
  new_counter = @bucket.counter 'asdf'
@@ -74,31 +74,31 @@ describe Riak::Bucket do
74
74
  end
75
75
 
76
76
  describe "setting the bucket properties" do
77
- it "should prefetch the properties when they are not present" do
77
+ it "prefetches the properties when they are not present" do
78
78
  allow(@backend).to receive(:set_bucket_props)
79
79
  expect(@backend).to receive(:get_bucket_props).with(@bucket, { }).and_return({"name" => "foo"})
80
80
  @bucket.props = {"precommit" => []}
81
81
  end
82
82
 
83
- it "should set the new properties on the bucket" do
83
+ it "sets the new properties on the bucket" do
84
84
  @bucket.instance_variable_set(:@props, {}) # Pretend they are there
85
85
  expect(@backend).to receive(:set_bucket_props).with(@bucket, { :name => "foo" }, nil)
86
86
  @bucket.props = { :name => "foo" }
87
87
  end
88
88
 
89
- it "should raise an error if an invalid type is given" do
89
+ it "raises an error if an invalid type is given" do
90
90
  expect { @bucket.props = "blah" }.to raise_error(ArgumentError)
91
91
  end
92
92
  end
93
93
 
94
94
  describe "fetching the bucket properties" do
95
- it "should fetch properties on first access" do
95
+ it "fetches properties on first access" do
96
96
  expect(@bucket.instance_variable_get(:@props)).to be_nil
97
97
  expect(@backend).to receive(:get_bucket_props).with(@bucket, { }).and_return({"name" => "foo"})
98
98
  expect(@bucket.props).to eq({"name" => "foo"})
99
99
  end
100
100
 
101
- it "should memoize fetched properties" do
101
+ it "memoizes fetched properties" do
102
102
  expect(@backend).to receive(:get_bucket_props).once.with(@bucket, { }).and_return({"name" => "foo"})
103
103
  expect(@bucket.props).to eq({"name" => "foo"})
104
104
  expect(@bucket.props).to eq({"name" => "foo"})
@@ -106,7 +106,7 @@ describe Riak::Bucket do
106
106
  end
107
107
 
108
108
  describe "clearing the bucket properties" do
109
- it "should make the request and delete the internal properties cache" do
109
+ it "sends the request and delete the internal properties cache" do
110
110
  expect(@client).to receive(:clear_bucket_props).with(@bucket).and_return(true)
111
111
  expect(@bucket.clear_props).to be_truthy
112
112
  expect(@bucket.instance_variable_get(:@props)).to be_nil
@@ -114,17 +114,17 @@ describe Riak::Bucket do
114
114
  end
115
115
 
116
116
  describe "fetching an object" do
117
- it "should fetch the object via the backend" do
117
+ it "fetches the object via the backend" do
118
118
  expect(@backend).to receive(:fetch_object).with(@bucket, "db", {}).and_return(nil)
119
119
  @bucket.get("db")
120
120
  end
121
121
 
122
- it "should use the specified R quroum" do
122
+ it "uses the specified R quroum" do
123
123
  expect(@backend).to receive(:fetch_object).with(@bucket, "db", {:r => 2}).and_return(nil)
124
124
  @bucket.get("db", :r => 2)
125
125
  end
126
126
 
127
- it "should disallow fetching an object with a zero-length key" do
127
+ it "disallows fetching an object with a zero-length key" do
128
128
  ## TODO: This actually tests the Client object, but there is no suite
129
129
  ## of tests for its generic interface.
130
130
  expect { @bucket.get('') }.to raise_error(ArgumentError)
@@ -132,7 +132,7 @@ describe Riak::Bucket do
132
132
  end
133
133
 
134
134
  describe "creating a new blank object" do
135
- it "should instantiate the object with the given key, default to JSON" do
135
+ it "instantiates the object with the given key, default to JSON" do
136
136
  obj = @bucket.new('bar')
137
137
  expect(obj).to be_kind_of(Riak::RObject)
138
138
  expect(obj.key).to eq('bar')
@@ -144,25 +144,25 @@ describe Riak::Bucket do
144
144
  let(:not_found_error){ Riak::ProtobuffsFailedRequest.new :not_found, 'not found' }
145
145
  let(:other_error){ Riak::ProtobuffsFailedRequest.new :server_error, 'server error' }
146
146
 
147
- it "should return the existing object if present" do
147
+ it "returns the existing object if present" do
148
148
  @object = double("RObject")
149
149
  expect(@backend).to receive(:fetch_object).with(@bucket,"db", {}).and_return(@object)
150
150
  expect(@bucket.get_or_new('db')).to eq(@object)
151
151
  end
152
152
 
153
- it "should create a new blank object if the key does not exist" do
153
+ it "creates a new blank object if the key does not exist" do
154
154
  expect(@backend).to receive(:fetch_object).and_raise(not_found_error)
155
155
  obj = @bucket.get_or_new('db')
156
156
  expect(obj.key).to eq('db')
157
157
  expect(obj.data).to be_blank
158
158
  end
159
159
 
160
- it "should bubble up non-ok non-missing errors" do
160
+ it "bubbles up non-ok non-missing errors" do
161
161
  expect(@backend).to receive(:fetch_object).and_raise(other_error)
162
162
  expect { @bucket.get_or_new('db') }.to raise_error(Riak::ProtobuffsFailedRequest)
163
163
  end
164
164
 
165
- it "should pass along the given R quorum parameter" do
165
+ it "passes the given R quorum parameter to the backend" do
166
166
  @object = double("RObject")
167
167
  expect(@backend).to receive(:fetch_object).with(@bucket,"db", {:r => "all"}).and_return(@object)
168
168
  expect(@bucket.get_or_new('db', :r => "all")).to eq(@object)
@@ -170,7 +170,7 @@ describe Riak::Bucket do
170
170
  end
171
171
 
172
172
  describe "fetching multiple objects" do
173
- it 'should get each object individually' do
173
+ it 'gets each object individually' do
174
174
  @object1 = double('obj1')
175
175
  @object2 = double('obj2')
176
176
  expect(@bucket).to receive(:[]).with('key1').and_return(@object1)
@@ -184,7 +184,7 @@ describe Riak::Bucket do
184
184
  end
185
185
 
186
186
  describe "querying an index" do
187
- it "should list the matching keys" do
187
+ it "lists the matching keys" do
188
188
  expect(@backend).
189
189
  to receive(:get_index).
190
190
  with(@bucket, "test_bin", "testing", {return_terms: true}).
@@ -206,11 +206,11 @@ describe Riak::Bucket do
206
206
  allow(@backend).to receive(:get_bucket_props).and_return({"allow_mult" => false})
207
207
  end
208
208
 
209
- it "should extract the allow_mult property" do
209
+ it "extracts the allow_mult property" do
210
210
  expect(@bucket.allow_mult).to be_falsey
211
211
  end
212
212
 
213
- it "should set the allow_mult property" do
213
+ it "sets the allow_mult property" do
214
214
  expect(@bucket).to receive(:props=).with(hash_including('allow_mult' => true))
215
215
  @bucket.allow_mult = true
216
216
  end
@@ -221,11 +221,11 @@ describe Riak::Bucket do
221
221
  allow(@backend).to receive(:get_bucket_props).and_return({"n_val" => 3})
222
222
  end
223
223
 
224
- it "should extract the N value" do
224
+ it "extracts the N value" do
225
225
  expect(@bucket.n_value).to eq(3)
226
226
  end
227
227
 
228
- it "should set the N value" do
228
+ it "sets the N value" do
229
229
  expect(@bucket).to receive(:props=).with(hash_including('n_val' => 1))
230
230
  @bucket.n_value = 1
231
231
  end
@@ -237,11 +237,11 @@ describe Riak::Bucket do
237
237
  allow(@backend).to receive(:get_bucket_props).and_return({"r" => "quorum", "w" => "quorum", "dw" => "quorum", "rw" => "quorum"})
238
238
  end
239
239
 
240
- it "should extract the default #{q} quorum" do
240
+ it "extracts the default #{q} quorum" do
241
241
  expect(@bucket.send(q)).to eq("quorum")
242
242
  end
243
243
 
244
- it "should set the #{q} quorum" do
244
+ it "sets the #{q} quorum" do
245
245
  expect(@bucket).to receive(:props=).with(hash_including("#{q}" => 1))
246
246
  @bucket.send("#{q}=",1)
247
247
  end
@@ -249,12 +249,12 @@ describe Riak::Bucket do
249
249
  end
250
250
 
251
251
  describe "checking whether a key exists" do
252
- it "should return true if the object does exist" do
252
+ it "returns true if the object does exist" do
253
253
  expect(@backend).to receive(:fetch_object).and_return(double)
254
254
  expect(@bucket.exists?("foo")).to be_truthy
255
255
  end
256
256
 
257
- it "should return false if the object doesn't exist" do
257
+ it "returns false if the object doesn't exist" do
258
258
  expect(@backend).to receive(:fetch_object).
259
259
  and_raise(Riak::ProtobuffsFailedRequest.new(:not_found, "not found"))
260
260
  expect(@bucket.exists?("foo")).to be_falsey
@@ -262,12 +262,12 @@ describe Riak::Bucket do
262
262
  end
263
263
 
264
264
  describe "deleting an object" do
265
- it "should delete a key from within the bucket" do
265
+ it "deletes a key from within the bucket" do
266
266
  expect(@backend).to receive(:delete_object).with(@bucket, "bar", {})
267
267
  @bucket.delete('bar')
268
268
  end
269
269
 
270
- it "should use the specified RW quorum" do
270
+ it "uses the specified RW quorum" do
271
271
  expect(@backend).to receive(:delete_object).with(@bucket, "bar", {:rw => "all"})
272
272
  @bucket.delete('bar', :rw => "all")
273
273
  end
@@ -3,33 +3,33 @@ require 'riak/errors/protobuffs_error'
3
3
 
4
4
  describe Riak::Client, test_client: true do
5
5
  describe "when initializing" do
6
- it "should default a single local node" do
6
+ it "defaults to a single local node" do
7
7
  client = Riak::Client.new
8
8
  expect(client.nodes).to eq([Riak::Client::Node.new(client)])
9
9
  end
10
10
 
11
- it "should accept a host" do
11
+ it "accepts a host" do
12
12
  client = Riak::Client.new :host => "riak.basho.com"
13
13
  expect(client.nodes.size).to eq(1)
14
14
  expect(client.nodes.first.host).to eq("riak.basho.com")
15
15
  end
16
16
 
17
- it "should accept a Protobuffs port" do
17
+ it "accepts a Protobuffs port" do
18
18
  client = Riak::Client.new :pb_port => 9000
19
19
  expect(client.nodes.size).to eq(1)
20
20
  expect(client.nodes.first.pb_port).to eq(9000)
21
21
  end
22
22
 
23
- it "should accept a client ID" do
23
+ it "accepts a client ID" do
24
24
  client = Riak::Client.new :client_id => "AAAAAA=="
25
25
  expect(client.client_id).to eq("AAAAAA==")
26
26
  end
27
27
 
28
- it "should create a client ID if not specified" do
28
+ it "creates a client ID if not specified" do
29
29
  expect(Riak::Client.new(pb_port: test_client.nodes.first.pb_port).client_id).not_to be_nil
30
30
  end
31
31
 
32
- it "should accept multiple nodes" do
32
+ it "accepts multiple nodes" do
33
33
  client = Riak::Client.new :nodes => [
34
34
  {:host => 'riak1.basho.com'},
35
35
  {:host => 'riak2.basho.com', :pb_port => 1234},
@@ -40,7 +40,7 @@ describe Riak::Client, test_client: true do
40
40
  end
41
41
  end
42
42
 
43
- it "should expose a Stamp object" do
43
+ it "exposes a Stamp object" do
44
44
  expect(subject).to respond_to(:stamp)
45
45
  expect(subject.stamp).to be_kind_of(Riak::Stamp)
46
46
  end
@@ -51,16 +51,16 @@ describe Riak::Client, test_client: true do
51
51
  end
52
52
 
53
53
  describe "setting the client id" do
54
- it "should accept a string unmodified" do
54
+ it "accepts a string unmodified" do
55
55
  @client.client_id = "foo"
56
56
  expect(@client.client_id).to eq("foo")
57
57
  end
58
58
 
59
- it "should reject an integer equal to the maximum client id" do
59
+ it "rejects an integer equal to the maximum client id" do
60
60
  expect { @client.client_id = Riak::Client::MAX_CLIENT_ID }.to raise_error(ArgumentError)
61
61
  end
62
62
 
63
- it "should reject an integer larger than the maximum client id" do
63
+ it "rejects an integer larger than the maximum client id" do
64
64
  expect { @client.client_id = Riak::Client::MAX_CLIENT_ID + 1 }.to raise_error(ArgumentError)
65
65
  end
66
66
  end
@@ -71,21 +71,21 @@ describe Riak::Client, test_client: true do
71
71
  @client = Riak::Client.new
72
72
  end
73
73
 
74
- it "should choose the selected backend" do
74
+ it "chooses the selected backend" do
75
75
  @client.protobuffs_backend = :Beefcake
76
76
  @client.protobuffs do |p|
77
77
  expect(p).to be_instance_of(Riak::Client::BeefcakeProtobuffsBackend)
78
78
  end
79
79
  end
80
80
 
81
- it "should teardown the existing Protobuffs connections when changed" do
81
+ it "tears down the existing Protobuffs connections when changed" do
82
82
  expect(@client.protobuffs_pool).to receive(:clear)
83
83
  @client.protobuffs_backend = :Beefcake
84
84
  end
85
85
 
86
- it "should raise an error when the chosen backend is not valid" do
86
+ it "raises an error when the chosen backend is not valid" do
87
87
  expect(Riak::Client::BeefcakeProtobuffsBackend).to receive(:configured?).and_return(false)
88
- expect { @client.protobuffs { |x| } }.to raise_error
88
+ expect { @client.protobuffs { |x| } }.to raise_error Riak::BackendCreationError
89
89
  end
90
90
  end
91
91
 
@@ -94,7 +94,7 @@ describe Riak::Client, test_client: true do
94
94
  @client = Riak::Client.new
95
95
  end
96
96
 
97
- it "should use Protobuffs when the protocol is pbc" do
97
+ it "uses Protobuffs when the protocol is pbc" do
98
98
  @client.backend do |b|
99
99
  expect(b).to be_kind_of(Riak::Client::ProtobuffsBackend)
100
100
  end
@@ -113,11 +113,11 @@ describe Riak::Client, test_client: true do
113
113
  ]
114
114
  end
115
115
 
116
- it 'should accept an array of bucket and key pairs' do
116
+ it 'accepts an array of bucket and key pairs' do
117
117
  expect{ @client.get_many(@pairs) }.not_to raise_error
118
118
  end
119
119
 
120
- it 'should return a hash of bucket/key pairs and robjects' do
120
+ it 'returns a hash of bucket/key pairs and robjects' do
121
121
  @results = @client.get_many(@pairs)
122
122
  expect(@results).to be_a Hash
123
123
  expect(@results.length).to be(@pairs.length)
@@ -131,23 +131,23 @@ describe Riak::Client, test_client: true do
131
131
  allow(@client).to receive(:backend).and_yield(@backend)
132
132
  end
133
133
 
134
- it "should return a bucket object" do
134
+ it "returns a bucket object" do
135
135
  expect(@client.bucket("foo")).to be_kind_of(Riak::Bucket)
136
136
  end
137
137
 
138
- it "should fetch bucket properties if asked" do
138
+ it "fetches bucket properties if asked" do
139
139
  expect(@backend).to receive(:get_bucket_props) {|b| expect(b.name).to eq("foo"); {} }
140
140
  @client.bucket("foo", :props => true)
141
141
  end
142
142
 
143
- it "should memoize bucket parameters" do
143
+ it "memoizes bucket parameters" do
144
144
  @bucket = double("Bucket")
145
145
  expect(Riak::Bucket).to receive(:new).with(@client, "baz").once.and_return(@bucket)
146
146
  expect(@client.bucket("baz")).to eq(@bucket)
147
147
  expect(@client.bucket("baz")).to eq(@bucket)
148
148
  end
149
149
 
150
- it "should reject buckets with zero-length names" do
150
+ it "rejects buckets with zero-length names" do
151
151
  expect { @client.bucket('') }.to raise_error(ArgumentError)
152
152
  end
153
153
  end
@@ -161,7 +161,7 @@ describe Riak::Client, test_client: true do
161
161
 
162
162
  after { Riak.disable_list_keys_warnings = true }
163
163
 
164
- it "should list buckets" do
164
+ it "lists buckets" do
165
165
  expect(@backend).to receive(:list_buckets).and_return(%w{test test2})
166
166
  buckets = @client.buckets
167
167
  expect(buckets.size).to eq(2)
@@ -170,14 +170,14 @@ describe Riak::Client, test_client: true do
170
170
  expect(buckets[1].name).to eq("test2")
171
171
  end
172
172
 
173
- it "should warn about the expense of list-buckets when warnings are not disabled" do
173
+ it "warns about the expense of list-buckets when warnings are not disabled" do
174
174
  Riak.disable_list_keys_warnings = false
175
175
  allow(@backend).to receive(:list_buckets).and_return(%w{test test2})
176
176
  expect(@client).to receive(:warn)
177
177
  @client.buckets
178
178
  end
179
179
 
180
- it "should support a timeout option" do
180
+ it "supports a timeout option" do
181
181
  expect(@backend).to receive(:list_buckets).with(timeout: 1234).and_return(%w{test test2})
182
182
 
183
183
  buckets = @client.buckets timeout: 1234
@@ -190,7 +190,7 @@ describe Riak::Client, test_client: true do
190
190
  @client = Riak::Client.new
191
191
  end
192
192
 
193
- it "should retry on recoverable errors" do
193
+ it "retries on recoverable errors" do
194
194
  call_count = 0
195
195
 
196
196
  begin
@@ -204,7 +204,7 @@ describe Riak::Client, test_client: true do
204
204
  expect(call_count).to eq(3)
205
205
  end
206
206
 
207
- it "should throw a RuntimeError if it runs out of retries" do
207
+ it "throws a RuntimeError if it runs out of retries" do
208
208
  error = nil
209
209
  begin
210
210
  @client.backend do |b|
@@ -217,5 +217,4 @@ describe Riak::Client, test_client: true do
217
217
  expect(error).not_to be_nil
218
218
  expect(error).to be_instance_of(RuntimeError)
219
219
  end
220
-
221
220
  end