td-client 0.8.79 → 0.8.80

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 361771ba9d0d5fd00765c9ce956c2853ae4b3333
4
- data.tar.gz: b6863fc4474b7598417d3e1fc776f585577b0b8b
3
+ metadata.gz: 6b90ad6943946fa449277adfcb6cf73151d06f5d
4
+ data.tar.gz: 3955d6677c5ff35ec1da44ed517d8ab69fca7b47
5
5
  SHA512:
6
- metadata.gz: 9a36906b042f9fa5f41288a34ae679e54a80af6709f03ca41f94935728ca0450bf2f45adb5c63c348546448d5824c13db3351d6e1f3521963cd453d2f400ca8e
7
- data.tar.gz: 3e564144569d8b2dd1b3ee1895a3a8117846802565d7581395deb5246ebc2588237c64868308e609e75dc9a8160c9a12f9d20687dfc254eb43a52623c51c87ac
6
+ metadata.gz: 21a28c9c7d85fa5b70eca4f9d841cbea5ee19a240140201046a12a3bfd13e52293a6bd6cbccfa4c4b2526b41689f9c027923f0f2b9260853491e839e2a7f603f
7
+ data.tar.gz: ae79f478833ade0e3ab01c30e8eacdbc1ea3b1cbae613e9a68bead92b746b6b5165c1b9106abee517fb865a949813d9ef48eceff44a85bef7cf40bdb524c0109
data/lib/td/client/api.rb CHANGED
@@ -247,7 +247,7 @@ private
247
247
  # @param [Hash] params
248
248
  # @param [Hash] opt
249
249
  # @yield [response]
250
- def do_get(url, params=nil, opt={}, &block)
250
+ def do_get(url, params=nil, opt={})
251
251
  client, header = new_client
252
252
  client.send_timeout = @send_timeout
253
253
  client.receive_timeout = @read_timeout
@@ -272,27 +272,48 @@ private
272
272
  response = nil
273
273
  etag = nil
274
274
  current_total_chunk_size = 0
275
+ body = String.new unless block_given?
275
276
  begin # this block is to allow retry (redo) in the begin part of the begin-rescue block
276
277
  begin
277
278
  if etag
278
279
  header['If-Range'] = etag
279
280
  header['Range'] = "bytes=#{current_total_chunk_size}-"
280
281
  else
282
+ etag = nil
281
283
  current_total_chunk_size = 0
284
+ body.clear if body
282
285
  end
283
- if block
286
+
287
+ if block_given?
284
288
  response = client.get(target, params, header) {|res, chunk|
285
- current_total_chunk_size += chunk.bytesize
286
- block.call(res, chunk, current_total_chunk_size)
289
+ current_total_chunk_size += chunk.bytesize if res.status == 200
290
+ yield res, chunk, current_total_chunk_size
287
291
  }
288
292
  else
289
293
  response = client.get(target, params, header)
290
- current_total_chunk_size += response.body.bytesize
294
+ if response.status == 200
295
+ current_total_chunk_size += response.body.bytesize
296
+ body << response.body
297
+ end
291
298
  end
299
+
292
300
  # XXX ext/openssl raises EOFError in case where underlying connection causes an error,
293
301
  # but httpclient ignores it. Therefor, check content size.
294
302
  # https://github.com/nahi/httpclient/issues/296
295
- validate_content_length!(response, current_total_chunk_size)
303
+ if expected_size = response.header['Content-Range'].first
304
+ expected_size = expected_size[/\d+$/]
305
+ else
306
+ expected_size = response.header['Content-Length'].first
307
+ end
308
+ if expected_size
309
+ expected_size = expected_size.to_i
310
+ if expected_size != current_total_chunk_size
311
+ if expected_size < current_total_chunk_size
312
+ etag = false
313
+ end
314
+ raise IncompleteError, "#{expected_size} bytes expected, but got #{current_total_chunk_size} bytes"
315
+ end
316
+ end
296
317
 
297
318
  status = response.code
298
319
  # retry if the HTTP error code is 500 or higher and we did not run out of retrying attempts
@@ -305,7 +326,7 @@ private
305
326
  end
306
327
  rescue Errno::ECONNREFUSED, Errno::ECONNRESET, Timeout::Error, EOFError, OpenSSL::SSL::SSLError, SocketError, IncompleteError => e
307
328
  if opt[:resume]
308
- etag = response.header['ETag'].first
329
+ etag = response.header['ETag'].first if etag != false
309
330
  elsif block_given?
310
331
  raise e
311
332
  end
@@ -332,35 +353,24 @@ private
332
353
  puts "DEBUG: body: " + response.body.to_s
333
354
  end
334
355
 
335
- body = block ? response.body : inflate_body(response)
356
+ body = inflate_body(response, body) unless block_given?
336
357
 
337
358
  return [response.code.to_s, body, response]
338
359
  end
339
360
 
340
- def validate_content_length!(response, body_size)
341
- if content_length = response.header['Content-Range'].first
342
- content_length = content_length[/\d+$/]
343
- else
344
- content_length = response.header['Content-Length'].first
345
- end
346
- if content_length && content_length.to_i != body_size
347
- raise IncompleteError, "#{content_length} bytes expected, but got #{body_size} bytes"
348
- end
349
- end
350
-
351
- def inflate_body(response)
352
- return response.body if (ce = response.header['Content-Encoding']).empty?
361
+ def inflate_body(response, body=response.body)
362
+ return body if (ce = response.header['Content-Encoding']).empty?
353
363
 
354
364
  if ce.include?('gzip')
355
365
  infl = Zlib::Inflate.new(Zlib::MAX_WBITS + 16)
356
366
  begin
357
- infl.inflate(response.body)
367
+ infl.inflate(body)
358
368
  ensure
359
369
  infl.close
360
370
  end
361
371
  else
362
372
  # NOTE maybe for content-encoding is msgpack.gz ?
363
- Zlib::Inflate.inflate(response.body)
373
+ Zlib::Inflate.inflate(body)
364
374
  end
365
375
  end
366
376
 
@@ -115,7 +115,7 @@ module Job
115
115
  # @param [String] job_id
116
116
  # @return [Array]
117
117
  def job_result(job_id)
118
- code, body, res = get("/v3/job/result/#{e job_id}", {'format'=>'msgpack'})
118
+ code, body, res = get("/v3/job/result/#{e job_id}", {'format'=>'msgpack'}, {:resume => true})
119
119
  if code != "200"
120
120
  raise_error("Get job result failed", res)
121
121
  end
@@ -136,7 +136,7 @@ module Job
136
136
  def job_result_format(job_id, format, io=nil, &block)
137
137
  if io
138
138
  infl = nil
139
- code, body, res = get("/v3/job/result/#{e job_id}", {'format'=>format}) {|res, chunk, current_total_chunk_size|
139
+ code, body, res = get("/v3/job/result/#{e job_id}", {'format'=>format}, {:resume => true}) {|res, chunk, current_total_chunk_size|
140
140
  if res.code != 200
141
141
  raise_error("Get job result failed", res)
142
142
  end
@@ -148,7 +148,7 @@ module Job
148
148
  }
149
149
  nil
150
150
  else
151
- code, body, res = get("/v3/job/result/#{e job_id}", {'format'=>format})
151
+ code, body, res = get("/v3/job/result/#{e job_id}", {'format'=>format}, {:resume => true})
152
152
  if code != "200"
153
153
  raise_error("Get job result failed", res)
154
154
  end
@@ -165,7 +165,7 @@ module Job
165
165
  upkr = MessagePack::Unpacker.new
166
166
  infl = nil
167
167
 
168
- get("/v3/job/result/#{e job_id}", {'format'=>'msgpack'}) {|res, chunk, current_total_chunk_size|
168
+ get("/v3/job/result/#{e job_id}", {'format'=>'msgpack'}, {:resume => true}) {|res, chunk, current_total_chunk_size|
169
169
  if res.code != 200
170
170
  raise_error("Get job result failed", res)
171
171
  end
@@ -190,7 +190,7 @@ module Job
190
190
  upkr = MessagePack::Unpacker.new
191
191
  infl = nil
192
192
 
193
- get("/v3/job/result/#{e job_id}", {'format'=>'msgpack'}) {|res, chunk, current_total_chunk_size|
193
+ get("/v3/job/result/#{e job_id}", {'format'=>'msgpack'}, {:resume => true}) {|res, chunk, current_total_chunk_size|
194
194
  if res.code != 200
195
195
  raise_error("Get job result failed", res)
196
196
  end
@@ -1,5 +1,5 @@
1
1
  module TreasureData
2
2
  class Client
3
- VERSION = '0.8.79'
3
+ VERSION = '0.8.80'
4
4
  end
5
5
  end
@@ -14,7 +14,7 @@ describe 'Account API' do
14
14
  it 'returns account properties' do
15
15
  stub_api_request(:get, "/v3/account/show").
16
16
  to_return(:body => {'account' => {'id' => 1, 'plan' => 0, 'storage_size' => 2, 'guaranteed_cores' => 3, 'maximum_cores' => 4, 'created_at' => '2014-12-14T17:24:00+0900'}}.to_json)
17
- api.show_account.should == [1, 0, 2, 3, 4, "2014-12-14T17:24:00+0900"]
17
+ expect(api.show_account).to eq([1, 0, 2, 3, 4, "2014-12-14T17:24:00+0900"])
18
18
  end
19
19
  end
20
20
 
@@ -25,10 +25,10 @@ describe 'Account API' do
25
25
  stub_api_request(:get, "/v3/account/core_utilization", :query => {'from' => from, 'to' => to}).
26
26
  to_return(:body => {'from' => from, 'to' => to, 'interval' => 1, 'history' => ['dummy']}.to_json)
27
27
  r = api.account_core_utilization(from, to)
28
- r[0].should == Time.parse(from)
29
- r[1].should == Time.parse(to)
30
- r[2].should == 1
31
- r[3].should == ['dummy']
28
+ expect(r[0]).to eq(Time.parse(from))
29
+ expect(r[1]).to eq(Time.parse(to))
30
+ expect(r[2]).to eq(1)
31
+ expect(r[3]).to eq(['dummy'])
32
32
  end
33
33
  end
34
34
  end
@@ -40,26 +40,26 @@ describe API do
40
40
 
41
41
  it 'normalize_database_name should return normalized data' do
42
42
  INVALID_NAMES.each_pair {|ng,ok|
43
- API.normalize_database_name(ng).should == ok
43
+ expect(API.normalize_database_name(ng)).to eq(ok)
44
44
  }
45
- lambda {
45
+ expect {
46
46
  API.normalize_database_name('')
47
- }.should raise_error(RuntimeError)
47
+ }.to raise_error(RuntimeError)
48
48
  end
49
49
 
50
50
  it 'normalize_table_name should return normalized data' do
51
51
  INVALID_NAMES.each_pair {|ng,ok|
52
- API.normalize_table_name(ng).should == ok
52
+ expect(API.normalize_table_name(ng)).to eq(ok)
53
53
  }
54
54
  # empty
55
- lambda {
55
+ expect {
56
56
  API.normalize_table_name('')
57
- }.should raise_error(RuntimeError)
57
+ }.to raise_error(RuntimeError)
58
58
  end
59
59
 
60
60
  it 'normalize_database_name should return valid data' do
61
61
  VALID_NAMES.each {|ok|
62
- API.normalize_database_name(ok).should == ok
62
+ expect(API.normalize_database_name(ok)).to eq(ok)
63
63
  }
64
64
  end
65
65
  end
@@ -68,19 +68,19 @@ describe API do
68
68
  describe "'validate_database_name'" do
69
69
  it 'should raise a ParameterValidationError exceptions' do
70
70
  INVALID_NAMES.each_pair {|ng,ok|
71
- lambda {
71
+ expect {
72
72
  API.validate_database_name(ng)
73
- }.should raise_error(ParameterValidationError)
73
+ }.to raise_error(ParameterValidationError)
74
74
  }
75
75
  # empty
76
- lambda {
76
+ expect {
77
77
  API.validate_database_name('')
78
- }.should raise_error(ParameterValidationError)
78
+ }.to raise_error(ParameterValidationError)
79
79
  end
80
80
 
81
81
  it 'should return valid data' do
82
82
  VALID_NAMES.each {|ok|
83
- API.validate_database_name(ok).should == ok
83
+ expect(API.validate_database_name(ok)).to eq(ok)
84
84
  }
85
85
  end
86
86
  end
@@ -88,18 +88,18 @@ describe API do
88
88
  describe "'validate_table_name'" do
89
89
  it 'should raise a ParameterValidationError exception' do
90
90
  INVALID_NAMES.each_pair {|ng,ok|
91
- lambda {
91
+ expect {
92
92
  API.validate_table_name(ng)
93
- }.should raise_error(ParameterValidationError)
93
+ }.to raise_error(ParameterValidationError)
94
94
  }
95
- lambda {
95
+ expect {
96
96
  API.validate_table_name('')
97
- }.should raise_error(ParameterValidationError)
97
+ }.to raise_error(ParameterValidationError)
98
98
  end
99
99
 
100
100
  it 'should return valid data' do
101
101
  VALID_NAMES.each {|ok|
102
- API.validate_database_name(ok).should == ok
102
+ expect(API.validate_database_name(ok)).to eq(ok)
103
103
  }
104
104
  end
105
105
  end
@@ -107,19 +107,19 @@ describe API do
107
107
  describe "'validate_result_set_name'" do
108
108
  it 'should raise a ParameterValidationError exception' do
109
109
  INVALID_NAMES.each_pair {|ng,ok|
110
- lambda {
110
+ expect {
111
111
  API.validate_result_set_name(ng)
112
- }.should raise_error(ParameterValidationError)
112
+ }.to raise_error(ParameterValidationError)
113
113
  }
114
114
  # empty
115
- lambda {
115
+ expect {
116
116
  API.validate_result_set_name('')
117
- }.should raise_error(ParameterValidationError)
117
+ }.to raise_error(ParameterValidationError)
118
118
  end
119
119
 
120
120
  it 'should return valid data' do
121
121
  VALID_NAMES.each {|ok|
122
- API.validate_result_set_name(ok).should == ok
122
+ expect(API.validate_result_set_name(ok)).to eq(ok)
123
123
  }
124
124
  end
125
125
  end
@@ -127,18 +127,18 @@ describe API do
127
127
  describe "'validate_column_name'" do
128
128
  it 'should raise a ParameterValidationError exception' do
129
129
  ['/', '', 'D'].each { |ng|
130
- lambda {
130
+ expect {
131
131
  API.validate_column_name(ng)
132
- }.should raise_error(ParameterValidationError)
132
+ }.to raise_error(ParameterValidationError)
133
133
  }
134
134
  end
135
135
 
136
136
  it 'should return valid data' do
137
137
  VALID_NAMES.each {|ok|
138
- API.validate_column_name(ok).should == ok
138
+ expect(API.validate_column_name(ok)).to eq(ok)
139
139
  }
140
140
  # columns can be as short as 2 characters
141
- API.validate_column_name('ab').should == 'ab'
141
+ expect(API.validate_column_name('ab')).to eq('ab')
142
142
  end
143
143
  end
144
144
 
@@ -146,30 +146,30 @@ describe API do
146
146
  describe "'generic validate_name'" do
147
147
  it 'should raise a ParameterValidationError exception' do
148
148
  INVALID_NAMES.each_pair {|ng,ok|
149
- lambda {
149
+ expect {
150
150
  API.validate_name("generic", 3, 256, ng)
151
- }.should raise_error(ParameterValidationError)
151
+ }.to raise_error(ParameterValidationError)
152
152
  }
153
153
  # empty
154
- lambda {
154
+ expect {
155
155
  API.validate_name("generic", 3, 256, '')
156
- }.should raise_error(ParameterValidationError)
156
+ }.to raise_error(ParameterValidationError)
157
157
  # too short - one less than left limit
158
- lambda {
158
+ expect {
159
159
  API.validate_name("generic", 3, 256, 'ab')
160
- }.should raise_error(ParameterValidationError)
160
+ }.to raise_error(ParameterValidationError)
161
161
  end
162
162
 
163
163
  it 'should return valid data' do
164
164
  VALID_NAMES.each {|ok|
165
- API.validate_name("generic", 3, 256, ok).should == ok
165
+ expect(API.validate_name("generic", 3, 256, ok)).to eq(ok)
166
166
  }
167
167
  # esplore left boundary
168
- API.validate_name("generic", 2, 256, 'ab').should == 'ab'
169
- API.validate_name("generic", 1, 256, 'a').should == 'a'
168
+ expect(API.validate_name("generic", 2, 256, 'ab')).to eq('ab')
169
+ expect(API.validate_name("generic", 1, 256, 'a')).to eq('a')
170
170
  # explore right boundary
171
- API.validate_name("generic", 3, 256, 'a' * 256).should == 'a' * 256
172
- API.validate_name("generic", 3, 128, 'a' * 128).should == 'a' * 128
171
+ expect(API.validate_name("generic", 3, 256, 'a' * 256)).to eq('a' * 256)
172
+ expect(API.validate_name("generic", 3, 128, 'a' * 128)).to eq('a' * 128)
173
173
  end
174
174
  end
175
175
 
@@ -204,7 +204,7 @@ describe API do
204
204
  let(:content_length) { {'Content-Length' => packed.size} }
205
205
 
206
206
  it 'not called #completed_body?' do
207
- api.should_not_receive(:completed_body?)
207
+ expect(api).not_to receive(:completed_body?)
208
208
 
209
209
  get_api_call
210
210
  end
@@ -223,21 +223,13 @@ describe API do
223
223
  end
224
224
 
225
225
  context 'with Content-Length' do
226
- context 'macth Content-Length and body.size' do
226
+ context 'match Content-Length and body.size' do
227
227
  let(:content_length) { {'Content-Length' => packed.size} }
228
228
 
229
229
  it 'api accuess succeded' do
230
230
  expect { get_api_call }.not_to raise_error
231
231
  end
232
232
  end
233
-
234
- context 'not macth Content-Length and body.size' do
235
- let(:content_length) { {'Content-Length' => packed.size + 1} }
236
-
237
- it 'api accuess succeded' do
238
- expect { get_api_call }.to raise_error(TreasureData::API::IncompleteError)
239
- end
240
- end
241
233
  end
242
234
  end
243
235
  end
@@ -29,7 +29,7 @@ describe 'BulkImport API' do
29
29
  stub_api_request(:post, "/v3/bulk_import/create/#{e(bi_name)}/#{e(db_name)}/#{e(table_name)}").
30
30
  to_return(:body => {'bulk_import' => bi_name}.to_json)
31
31
 
32
- api.create_bulk_import(bi_name, db_name, table_name).should be_nil
32
+ expect(api.create_bulk_import(bi_name, db_name, table_name)).to be_nil
33
33
  end
34
34
 
35
35
  it 'should return 422 error with invalid name' do
@@ -70,7 +70,7 @@ describe 'BulkImport API' do
70
70
  it 'runs' do
71
71
  stub_api_request(:post, '/v3/bulk_import/delete/name').
72
72
  with(:body => 'foo=bar')
73
- api.delete_bulk_import('name', 'foo' => 'bar').should == nil
73
+ expect(api.delete_bulk_import('name', 'foo' => 'bar')).to eq(nil)
74
74
  end
75
75
  end
76
76
 
@@ -78,7 +78,7 @@ describe 'BulkImport API' do
78
78
  it 'runs' do
79
79
  stub_api_request(:get, '/v3/bulk_import/show/name').
80
80
  to_return(:body => {'status' => 'status', 'other' => 'other'}.to_json)
81
- api.show_bulk_import('name')['status'].should == 'status'
81
+ expect(api.show_bulk_import('name')['status']).to eq('status')
82
82
  end
83
83
  end
84
84
 
@@ -87,7 +87,7 @@ describe 'BulkImport API' do
87
87
  stub_api_request(:get, '/v3/bulk_import/list').
88
88
  with(:query => 'foo=bar').
89
89
  to_return(:body => {'bulk_imports' => %w(1 2 3)}.to_json)
90
- api.list_bulk_imports('foo' => 'bar').should == %w(1 2 3)
90
+ expect(api.list_bulk_imports('foo' => 'bar')).to eq(%w(1 2 3))
91
91
  end
92
92
  end
93
93
 
@@ -96,7 +96,7 @@ describe 'BulkImport API' do
96
96
  stub_api_request(:get, '/v3/bulk_import/list_parts/name').
97
97
  with(:query => 'foo=bar').
98
98
  to_return(:body => {'parts' => %w(1 2 3)}.to_json)
99
- api.list_bulk_import_parts('name', 'foo' => 'bar').should == %w(1 2 3)
99
+ expect(api.list_bulk_import_parts('name', 'foo' => 'bar')).to eq(%w(1 2 3))
100
100
  end
101
101
  end
102
102
 
@@ -109,7 +109,7 @@ describe 'BulkImport API' do
109
109
  stub_request(:put, 'http://api.treasure-data.com/v3/bulk_import/upload_part/name/part').
110
110
  with(:body => '12345')
111
111
  File.open(t.path) do |f|
112
- api.bulk_import_upload_part('name', 'part', f, 5).should == nil
112
+ expect(api.bulk_import_upload_part('name', 'part', f, 5)).to eq(nil)
113
113
  end
114
114
  end
115
115
 
@@ -122,7 +122,7 @@ describe 'BulkImport API' do
122
122
  stub_request(:put, 'http://api.treasure-data.com/v3/bulk_import/upload_part/name/' + CGI.escape('日本語(Japanese)'.encode('UTF-8'))).
123
123
  with(:body => '12345')
124
124
  File.open(t.path) do |f|
125
- api.bulk_import_upload_part('name', '日本語(Japanese)'.encode('Windows-31J'), f, 5).should == nil
125
+ expect(api.bulk_import_upload_part('name', '日本語(Japanese)'.encode('Windows-31J'), f, 5)).to eq(nil)
126
126
  end
127
127
  end
128
128
  end
@@ -131,21 +131,21 @@ describe 'BulkImport API' do
131
131
  describe 'bulk_import_delete_part' do
132
132
  it 'runs' do
133
133
  stub_api_request(:post, '/v3/bulk_import/delete_part/name/part')
134
- api.bulk_import_delete_part('name', 'part').should == nil
134
+ expect(api.bulk_import_delete_part('name', 'part')).to eq(nil)
135
135
  end
136
136
  end
137
137
 
138
138
  describe 'freeze_bulk_import' do
139
139
  it 'runs' do
140
140
  stub_api_request(:post, '/v3/bulk_import/freeze/name')
141
- api.freeze_bulk_import('name').should == nil
141
+ expect(api.freeze_bulk_import('name')).to eq(nil)
142
142
  end
143
143
  end
144
144
 
145
145
  describe 'unfreeze_bulk_import' do
146
146
  it 'runs' do
147
147
  stub_api_request(:post, '/v3/bulk_import/unfreeze/name')
148
- api.unfreeze_bulk_import('name').should == nil
148
+ expect(api.unfreeze_bulk_import('name')).to eq(nil)
149
149
  end
150
150
  end
151
151
 
@@ -153,7 +153,7 @@ describe 'BulkImport API' do
153
153
  it 'runs' do
154
154
  stub_api_request(:post, '/v3/bulk_import/perform/name').
155
155
  to_return(:body => {'job_id' => 12345}.to_json)
156
- api.perform_bulk_import('name').should == '12345'
156
+ expect(api.perform_bulk_import('name')).to eq('12345')
157
157
  end
158
158
  end
159
159
 
@@ -161,7 +161,7 @@ describe 'BulkImport API' do
161
161
  it 'runs' do
162
162
  stub_api_request(:post, '/v3/bulk_import/commit/name').
163
163
  to_return(:body => {'job_id' => 12345}.to_json)
164
- api.commit_bulk_import('name').should == nil
164
+ expect(api.commit_bulk_import('name')).to eq(nil)
165
165
  end
166
166
  end
167
167
 
@@ -169,19 +169,19 @@ describe 'BulkImport API' do
169
169
  it 'returns [] on empty' do
170
170
  stub_api_request(:get, '/v3/bulk_import/error_records/name').
171
171
  to_return(:body => '')
172
- api.bulk_import_error_records('name').should == []
172
+ expect(api.bulk_import_error_records('name')).to eq([])
173
173
  end
174
174
 
175
175
  it 'returns nil on empty if block given' do
176
176
  stub_api_request(:get, '/v3/bulk_import/error_records/name').
177
177
  to_return(:body => '')
178
- api.bulk_import_error_records('name'){}.should == nil
178
+ expect(api.bulk_import_error_records('name'){}).to eq(nil)
179
179
  end
180
180
 
181
181
  it 'returns unpacked result' do
182
182
  stub_api_request(:get, '/v3/bulk_import/error_records/name').
183
183
  to_return(:body => packed)
184
- api.bulk_import_error_records('name').should == [[1, '2', 3.0], [4, '5', 6.0], [7, '8', 9.0]]
184
+ expect(api.bulk_import_error_records('name')).to eq([[1, '2', 3.0], [4, '5', 6.0], [7, '8', 9.0]])
185
185
  end
186
186
 
187
187
  it 'yields unpacked result if block given' do
@@ -191,7 +191,7 @@ describe 'BulkImport API' do
191
191
  api.bulk_import_error_records('name') do |row|
192
192
  result << row
193
193
  end
194
- result.should == [[1, '2', 3.0], [4, '5', 6.0], [7, '8', 9.0]]
194
+ expect(result).to eq([[1, '2', 3.0], [4, '5', 6.0], [7, '8', 9.0]])
195
195
  end
196
196
  end
197
197
  end