Skip to content

Commit 53d5967

Browse files
committed
Fix mock response issue
1 parent dd9ab16 commit 53d5967

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

spec/cmab_client_spec.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@
4444
let(:expected_headers) { {'Content-Type' => 'application/json'} }
4545

4646
it 'should return the variation id on success without retrying' do
47-
mock_response = double('response', status_code: 200, json: {'predictions' => [{'variationId': 'abc123'}]})
47+
mock_response = double('response', status_code: 200, json: {'predictions' => [{'variationId' => 'abc123'}]})
4848
allow(mock_http_client).to receive(:post).and_return(mock_response)
4949
result = client.fetch_decision(rule_id, user_id, attributes, cmab_uuid)
5050
expect(result).to eq('abc123')
@@ -134,7 +134,7 @@
134134
)
135135

136136
# Mock successful response
137-
mock_response = double('response', status_code: 200, json: {'predictions' => [{'variationId': 'abc123'}]})
137+
mock_response = double('response', status_code: 200, json: {'predictions' => [{'variationId' => 'abc123'}]})
138138
allow(mock_http_client).to receive(:post).and_return(mock_response)
139139
allow_any_instance_of(Object).to receive(:sleep)
140140

@@ -161,7 +161,7 @@
161161

162162
# Create failure and success responses
163163
failure_response = double('response', status_code: 500)
164-
success_response = double('response', status_code: 200, json: {'predictions' => [{'variationId': 'xyz456'}]})
164+
success_response = double('response', status_code: 200, json: {'predictions' => [{'variationId' => 'xyz456'}]})
165165

166166
# First two calls fail, third succeeds
167167
call_sequence = [failure_response, failure_response, success_response]

0 commit comments

Comments
 (0)