|
66 | 66 |
|
67 | 67 | expect(result).to eq('abc123')
|
68 | 68 | expect(WebMock).to have_requested(:post, expected_url)
|
69 |
| - .with(body: expected_body_for_webmock, headers: expected_headers).once |
| 69 | + .with(body: expected_body_for_webmock, headers: expected_headers).once |
70 | 70 | expect(Kernel).not_to have_received(:sleep)
|
71 | 71 | end
|
72 | 72 |
|
|
80 | 80 | end.to raise_error(Optimizely::CmabFetchError, /Connection error/)
|
81 | 81 |
|
82 | 82 | expect(WebMock).to have_requested(:post, expected_url)
|
83 |
| - .with(body: expected_body_for_webmock, headers: expected_headers).once |
| 83 | + .with(body: expected_body_for_webmock, headers: expected_headers).once |
84 | 84 | expect(spy_logger).to have_received(:log).with(Logger::ERROR, a_string_including('Connection error'))
|
85 | 85 | expect(Kernel).not_to have_received(:sleep)
|
86 | 86 | end
|
|
95 | 95 | end.to raise_error(Optimizely::CmabFetchError, /500/)
|
96 | 96 |
|
97 | 97 | expect(WebMock).to have_requested(:post, expected_url)
|
98 |
| - .with(body: expected_body_for_webmock, headers: expected_headers).once |
| 98 | + .with(body: expected_body_for_webmock, headers: expected_headers).once |
99 | 99 | expect(spy_logger).to have_received(:log).with(Logger::ERROR, a_string_including('500'))
|
100 | 100 | expect(Kernel).not_to have_received(:sleep)
|
101 | 101 | end
|
|
110 | 110 | end.to raise_error(Optimizely::CmabInvalidResponseError, /Invalid CMAB fetch response/)
|
111 | 111 |
|
112 | 112 | expect(WebMock).to have_requested(:post, expected_url)
|
113 |
| - .with(body: expected_body_for_webmock, headers: expected_headers).once |
| 113 | + .with(body: expected_body_for_webmock, headers: expected_headers).once |
114 | 114 | expect(spy_logger).to have_received(:log).with(Logger::ERROR, a_string_including('Invalid CMAB fetch response'))
|
115 | 115 | expect(Kernel).not_to have_received(:sleep)
|
116 | 116 | end
|
|
125 | 125 | end.to raise_error(Optimizely::CmabInvalidResponseError, /Invalid CMAB fetch response/)
|
126 | 126 |
|
127 | 127 | expect(WebMock).to have_requested(:post, expected_url)
|
128 |
| - .with(body: expected_body_for_webmock, headers: expected_headers).once |
| 128 | + .with(body: expected_body_for_webmock, headers: expected_headers).once |
129 | 129 | expect(spy_logger).to have_received(:log).with(Logger::ERROR, a_string_including('Invalid CMAB fetch response'))
|
130 | 130 | expect(Kernel).not_to have_received(:sleep)
|
131 | 131 | end
|
|
143 | 143 |
|
144 | 144 | expect(result).to eq('abc123')
|
145 | 145 | expect(WebMock).to have_requested(:post, expected_url)
|
146 |
| - .with(body: expected_body_for_webmock, headers: expected_headers).once |
| 146 | + .with(body: expected_body_for_webmock, headers: expected_headers).once |
147 | 147 | expect(Kernel).not_to have_received(:sleep)
|
148 | 148 | end
|
149 | 149 |
|
|
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).exactly(3).times |
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).exactly(4).times |
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