Skip to content

Commit 3f13c2a

Browse files
committed
hopefully fix
1 parent ba78601 commit 3f13c2a

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

spec/cmab_client_spec.rb

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
let(:spy_logger) { spy('logger') }
2525
let(:retry_config) { Optimizely::CmabRetryConfig.new(max_retries: 3, retry_delay: 0.01, max_backoff: 1, backoff_multiplier: 2) }
2626
let(:client) { described_class.new(mock_http_client, nil, spy_logger) }
27+
let(:client_with_retry) { described_class.new(mock_http_client, retry_config, spy_logger) }
2728
let(:rule_id) { 'test_rule' }
2829
let(:user_id) { 'user123' }
2930
let(:attributes) { {'attr1': 'value1', 'attr2': 'value2'} }
@@ -44,6 +45,12 @@
4445
end
4546
let(:expected_headers) { {'Content-Type' => 'application/json'} }
4647

48+
before do
49+
allow(Kernel).to receive(:sleep)
50+
allow(mock_http_client).to receive(:post).and_call_original
51+
allow(spy_logger).to receive(:log).and_call_original
52+
end
53+
4754
it 'should return the variation id on success without retrying' do
4855
mock_response = double('response', status_code: 200, json: {'predictions' => [{'variationId' => 'abc123'}]})
4956
allow(mock_http_client).to receive(:post).and_return(mock_response)

0 commit comments

Comments
 (0)