Skip to content

Commit f035844

Browse files
committed
Implement comments
1 parent fbd9afe commit f035844

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

lib/optimizely/cmab/cmab_client.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@ def _do_fetch_with_retry(url, request_body, retry_config, timeout)
161161
Kernel.sleep(backoff)
162162

163163
backoff = [
164-
backoff * (retry_config.backoff_multiplier**(attempt + 1)),
164+
backoff * retry_config.backoff_multiplier,
165165
retry_config.max_backoff
166166
].min
167167
else

spec/cmab_client_spec.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@
7070
expect(Kernel).not_to have_received(:sleep)
7171
end
7272

73-
it 'should return HTTP exception' do
73+
it 'should raise error on http client exception' do
7474
WebMock.stub_request(:post, expected_url)
7575
.with(body: expected_body_for_webmock, headers: expected_headers)
7676
.to_raise(StandardError.new('Connection error'))
@@ -85,7 +85,7 @@
8585
expect(Kernel).not_to have_received(:sleep)
8686
end
8787

88-
it 'should not return 200 status' do
88+
it 'should raise error on non success status' do
8989
WebMock.stub_request(:post, expected_url)
9090
.with(body: expected_body_for_webmock, headers: expected_headers)
9191
.to_return(status: 500)
@@ -115,7 +115,7 @@
115115
expect(Kernel).not_to have_received(:sleep)
116116
end
117117

118-
it 'should return invalid response structure' do
118+
it 'should raise error on invalid structure' do
119119
WebMock.stub_request(:post, expected_url)
120120
.with(body: expected_body_for_webmock, headers: expected_headers)
121121
.to_return(status: 200, body: {'no_predictions' => []}.to_json, headers: {'Content-Type' => 'application/json'})

0 commit comments

Comments
 (0)