|
55 | 55 | end |
56 | 56 |
|
57 | 57 | context 'when client is configured without retries' do |
58 | | - let(:client) { described_class.new(nil, Optimizely::CmabRetryConfig.new(max_retries: 0), spy_logger) } |
| 58 | + let(:client) { described_class.new(http_client: nil, retry_config: Optimizely::CmabRetryConfig.new(max_retries: 0), logger: spy_logger) } |
59 | 59 |
|
60 | 60 | it 'should return the variation id on success' do |
61 | 61 | WebMock.stub_request(:post, expected_url) |
|
132 | 132 | end |
133 | 133 |
|
134 | 134 | context 'when client is configured with retries' do |
135 | | - let(:client_with_retry) { described_class.new(nil, retry_config, spy_logger) } |
| 135 | + let(:client_with_retry) { described_class.new(http_client: nil, retry_config: retry_config, logger: spy_logger) } |
136 | 136 |
|
137 | 137 | it 'should return the variation id on first try' do |
138 | 138 | WebMock.stub_request(:post, expected_url) |
|
199 | 199 | context 'when custom prediction endpoint is configured' do |
200 | 200 | let(:custom_endpoint) { 'https://custom.endpoint.com/predict/%s' } |
201 | 201 | let(:custom_url) { 'https://custom.endpoint.com/predict/test_rule' } |
202 | | - let(:client_with_custom_endpoint) { described_class.new(nil, Optimizely::CmabRetryConfig.new(max_retries: 0), spy_logger, custom_endpoint) } |
| 202 | + let(:client_with_custom_endpoint) { described_class.new(http_client: nil, retry_config: Optimizely::CmabRetryConfig.new(max_retries: 0), logger: spy_logger, prediction_endpoint: custom_endpoint) } |
203 | 203 |
|
204 | 204 | it 'should use the custom prediction endpoint' do |
205 | 205 | WebMock.stub_request(:post, custom_url) |
|
215 | 215 | end |
216 | 216 |
|
217 | 217 | context 'when no prediction endpoint is provided' do |
218 | | - let(:client_with_default) { described_class.new(nil, Optimizely::CmabRetryConfig.new(max_retries: 0), spy_logger, nil) } |
| 218 | + let(:client_with_default) { described_class.new(http_client: nil, retry_config: Optimizely::CmabRetryConfig.new(max_retries: 0), logger: spy_logger, prediction_endpoint: nil) } |
219 | 219 |
|
220 | 220 | it 'should use the default prediction endpoint' do |
221 | 221 | WebMock.stub_request(:post, expected_url) |
|
231 | 231 | end |
232 | 232 |
|
233 | 233 | context 'when empty string prediction endpoint is provided' do |
234 | | - let(:client_with_empty_endpoint) { described_class.new(nil, Optimizely::CmabRetryConfig.new(max_retries: 0), spy_logger, '') } |
| 234 | + let(:client_with_empty_endpoint) { described_class.new(http_client: nil, retry_config: Optimizely::CmabRetryConfig.new(max_retries: 0), logger: spy_logger, prediction_endpoint: '') } |
235 | 235 |
|
236 | 236 | it 'should fall back to the default prediction endpoint' do |
237 | 237 | WebMock.stub_request(:post, expected_url) |
|
0 commit comments