|
55 | 55 | end |
56 | 56 |
|
57 | 57 | context 'when client is configured without retries' do |
58 | | - let(:client) { described_class.new(nil, nil, spy_logger) } |
| 58 | + let(:client) { described_class.new(nil, Optimizely::CmabRetryConfig.new(max_retries: 0), spy_logger) } |
59 | 59 |
|
60 | 60 | it 'should return the variation id on success' do |
61 | 61 | WebMock.stub_request(:post, expected_url) |
|
158 | 158 |
|
159 | 159 | expect(result).to eq('xyz456') |
160 | 160 | expect(WebMock).to have_requested(:post, expected_url) |
161 | | - .with(body: expected_body_for_webmock, headers: expected_headers).exactly(3).times |
| 161 | + .with(body: expected_body_for_webmock, headers: expected_headers).times(3) |
162 | 162 |
|
163 | 163 | expect(spy_logger).to have_received(:log).with(Logger::INFO, 'Retrying CMAB request (attempt 1) after 0.01 seconds...').once |
164 | 164 | expect(spy_logger).to have_received(:log).with(Logger::INFO, 'Retrying CMAB request (attempt 2) after 0.02 seconds...').once |
|
182 | 182 | end.to raise_error(Optimizely::CmabFetchError) |
183 | 183 |
|
184 | 184 | expect(WebMock).to have_requested(:post, expected_url) |
185 | | - .with(body: expected_body_for_webmock, headers: expected_headers).exactly(4).times |
| 185 | + .with(body: expected_body_for_webmock, headers: expected_headers).times(4) |
186 | 186 |
|
187 | 187 | expect(spy_logger).to have_received(:log).with(Logger::INFO, 'Retrying CMAB request (attempt 1) after 0.01 seconds...').once |
188 | 188 | expect(spy_logger).to have_received(:log).with(Logger::INFO, 'Retrying CMAB request (attempt 2) after 0.02 seconds...').once |
|
0 commit comments