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

[Rebased] Disable display of detailed exceptions #387

Merged

Conversation

xtrasimplicity
Copy link
Member

@xtrasimplicity xtrasimplicity commented Apr 22, 2018

Summary

This is the same as #296 (PR), but has been rebased onto the latest changes to master. The following summary is copied from the other PR.

@allow-rescue permits rescuing exceptions by setting action_dispatch.show_exceptions to true in the env hash. However, this will render the detailed error page and not the public error page you'd encounter in production.

Given that the feature enables testing of error pages, and seems to be intended to mirror production behaviour as per the comment on https://github.com/cucumber/cucumber-rails/blob/master/lib/generators/cucumber/install/templates/support/_rails_each_run.rb.erb#L6-L14, this PR sets action_dispatch.show_detailed_exceptions to false, thus enabling the public error page to be rendered.

How Has This Been Tested?

The allow_rescue feature has been extended to verify the content of the error page.

Types of changes

  • Bug fix (non-breaking change which fixes an issue).
  • New feature (non-breaking change which adds functionality).
  • Breaking change (fix or feature that would cause existing functionality to not work as expected).

Checklist:

  • I've added tests for my code.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.

This change is Reviewable

pedrosmmoreira and others added 3 commits April 22, 2018 18:22
`@allow-rescue` permits rescuing exceptions by setting
`action_dispatch.show_exceptions` to true in the env hash. However,
this will render the detailed error page and not the public error page
you'd encounter in production.

Given that the feature enables testing of error pages, and seems to be
intended to mirror production behaviour as per the comment on
https://github.com/cucumber/cucumber-rails/blob/master/lib/generators/cucumber/install/templates/support/_rails_each_run.rb.erb#L6-L14,
this PR sets `action_dispatch.show_detailed_exceptions` to false, thus
enabling the public error page to be rendered.
There are slight changes in the error message displayed in the public
error pages across Rails versions. Checking for "We're sorry, but
something went wrong." seems to be the safest option.
This PR depends on action_dispatch.show_detailed_exceptions being set,
which was only introduced in Rails 3.2.1.

Here we introduce a conditional check based on the required Rails
version in order to ensure backwards compatibility.
@xtrasimplicity xtrasimplicity changed the title [Rebased] Disable detailed exceptions [Rebased] Disable display of detailed exceptions Apr 22, 2018
As we don't support Rails 3 in Cucumber-rails >= 1.5
Copy link
Contributor

@olleolleolle olleolleolle left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A clear description and a clear change.

@xtrasimplicity xtrasimplicity merged commit a09175a into cucumber:master Apr 22, 2018
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 this pull request may close these issues.

None yet

3 participants