Skip to content
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

Capybara monkey patch causes raise_server_errors to be evaluated at the wrong time #127

Closed
afn opened this issue Sep 22, 2023 · 0 comments · Fixed by #128
Closed

Capybara monkey patch causes raise_server_errors to be evaluated at the wrong time #127

afn opened this issue Sep 22, 2023 · 0 comments · Fixed by #128

Comments

@afn
Copy link
Contributor

afn commented Sep 22, 2023

We generally have Capybara.raise_server_errors set to true, but some of our rspec examples need to disable Capybara.raise_server_errors. To this end, we use an around block:

config.around(:each, ignore_server_errors: true) do |example|
  old_value = Capybara.raise_server_errors
  Capybara.raise_server_errors = false
  example.run
  Capybara.raise_server_errors = old_value
end

With pry-rescue enabled, Capybara checks raise_server_errors too late, after the value has already been reset to old_value.

I've fixed this by updating the monkey patch to account for this scenario. Will post PR shortly.

afn added a commit to cygnuseducation/pry-rescue that referenced this issue Sep 22, 2023
If `Capybara.raise_server_errors` is temporarily disabled for a spec,
reset each session's errors to prevent `reset_sessions_after_rescue!`
from raising an error after `raise_server_errors` has been reset.

Fixes ConradIrwin#127.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant