-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow configuring exceptions raise_error should capture to display webmock errors correctly #137
Comments
Would you consider something like this: def raise_standard_error(message, &block)
raise_error(StandardError, message, &block)
end There's also this option if you're not happy with clipping of the error text https://github.com/rspec/rspec-expectations/blob/eb1787f0e1a5ec2c2650048ee60a45d4c9738d78/lib/rspec/expectations/configuration.rb#L59. What makes you uncomfortable with the current behaviour specifically, how does it slow you down exactly? |
The current behavior makes debugging webmock errors hard because it clips the error message. So ideally I'd like to opt-out of the "capture everything" so I get the raw error message :) |
Not necessarily, you can change it locally to webmocked examples only: RSpec.configure do |config|
around(:example, :webmock) do |example|
old = Rails.configuration.max_formatted_output_length
Rails.configuration.max_formatted_output_length = 2000
example.run
ensure
Rails.configuration.max_formatted_output_length = old
end
end |
hmm yeah that could work, but I'm more happier with my workaround script, seems simpler/cleaner and removes a level of indirection |
Got it. |
Not rescuing Exception by default would be great, but could break a lot of tests that play with Splitting A global setting for "raise_exception_base: StandardError" would be nice and not break anyones workflow. |
Unfortunately thats not possible, as it would mean there is a state where the matcher wouldn't pass, but wouldn't fail either. I don't want to open that can of worms. I'm looking at an alternative formatting for the error instead. e.g.
|
oh yeah, that looks nice! |
I added a sample implementation idea. I need to generate a few Webmock errors to really see if this idea works in practice. |
I'm doing:
expect { call }.to raise_error(/ABORTED/)
this triggers a http request and then it ends up as:
but what I want to see is:
... this does not surface though since
raise_error
capturesException
and notStandardError
likeminitest
does.I assume changing the default would be too disruptive, so I'd suggest we make that configureable ?
workaround I'm using atm:
The text was updated successfully, but these errors were encountered: