Skip to content

Commit 27f9a15

Browse files
authored
Avoid warning of potential false positive in API Client tests. (#675)
I was seeing warnings that `expect {}.not_to raise_error(Faraday::Error)` was risking any other error causing the test to pass. These test warnings are new (probably introduced in #666). I think in this particular case it's a deliberate decision to test that this one error is NOT generated for this one particular status code, so I rewrote the test to avoid the warning but keep the intent of the test. ## What's changed? - Rewrote the `does not raise faraday exception for 401` test to expect an error but assert that it not be a `Faraday::Error`. ## Steps to perform after deploying to production None. Test change only.
1 parent 8f4e628 commit 27f9a15

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

spec/support/shared_examples/profile_api_client_examples.rb

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,9 @@
5454

5555
it 'does not raise faraday exception for 401' do
5656
stub_request(http_method, expected_url).to_return(status: 401)
57-
expect { subject }.not_to raise_error(Faraday::Error)
57+
expect { subject }.to raise_error { |error|
58+
expect(error).not_to be_a(Faraday::Error)
59+
}
5860
end
5961

6062
it 'raises UnauthorizedError on 401' do

0 commit comments

Comments
 (0)