Skip to content

Commit 1e3c602

Browse files
authored
Merge pull request #2 from sampatbadhe/fix_to_support_more_than_50_batch_size
fix to support more than 50 batch_size
2 parents 2841611 + 0f6ac17 commit 1e3c602

2 files changed

Lines changed: 8 additions & 4 deletions

File tree

lib/dotloop/loop.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ def raise_if_invalid_batch_size(options)
152152
def query_params(options)
153153
{
154154
batch_number: batch_number(options),
155-
batch_size: batch_size(options),
155+
batch_size: options[:batch_size].to_i,
156156
sort: options[:sort],
157157
filter: options[:filter],
158158
include_details: options[:include_details]

spec/helpers/webmocks.rb

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,18 @@ def dotloop_mock(request, request_type = :get, status_code = 200, query_params =
1010
def dotloop_mock_batch(request)
1111
endpoint = standard_endpoints(request)
1212
batch1_file = File.new(filename_to_path_json([endpoint, '_page1']))
13-
batch2_file = File.new(filename_to_path_json([endpoint, '_page2']))
13+
batch2_file = File.new(filename_to_path_json([endpoint, '_page1']))
14+
batch3_file = File.new(filename_to_path_json([endpoint, '_page2']))
1415
url = endpoint_to_url(endpoint)
1516
WebMock
16-
.stub_request(:get, [url, '?batch_number=1&batch_size=50'].join)
17+
.stub_request(:get, [url, '?batch_number=1&batch_size=100'].join)
1718
.to_return(body: batch1_file, status: 200, headers: { 'Content-Type' => 'application/json' })
1819
WebMock
19-
.stub_request(:get, [url, '?batch_number=2&batch_size=50'].join)
20+
.stub_request(:get, [url, '?batch_number=1&batch_size=50'].join)
2021
.to_return(body: batch2_file, status: 200, headers: { 'Content-Type' => 'application/json' })
22+
WebMock
23+
.stub_request(:get, [url, '?batch_number=2&batch_size=50'].join)
24+
.to_return(body: batch3_file, status: 200, headers: { 'Content-Type' => 'application/json' })
2125
end
2226

2327
def dotloop_mock_raise_error(request, error, batch = false)

0 commit comments

Comments
 (0)