Created
August 21, 2024 13:33
-
-
Save jaydorsey/a1e809faa72ba59cf332aa847128f046 to your computer and use it in GitHub Desktop.
Rescueing a flakey spec to debug
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
RSpec.describe MyClass do | |
let(:my_value) { 1 } | |
let(:other_value) { 2 } | |
it 'does a thing' do | |
expect(my_value).to eq(other_value) # failure condition, something flakey though | |
rescue RSpec::Expectations::ExpectationNotMetError | |
$ERROR_INFO.message << <<~MSG | |
This spec is flakey in CI. Here is some debug information. | |
If it fails again and you don't know why, please feel free to add more debug information. | |
Sidekiq::Testing.inline?: #{Sidekiq::Testing.inline?} | |
Sidekiq::Testing.fake?: #{Sidekiq::Testing.fake?} | |
my_value: #{my_value} | |
other_value: #{other_value} | |
MSG | |
raise | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment