fixes a failing test in actionpack #3641
Closed
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The test on line 120 of
actionpack/test/controller/new_base/render_template_test.rb
:is currently failing on master. The test expects to see the message attached to the exception object (and a stack trace) but instead it gets the contents of the fixture
500.html
.It looks like the
RoutedRackApp
instance created forActionDispatch::IntegrationTest
inactionpack/test/abstract_unit.rb
initializes theActionDispatch::ShowExceptions
middleware but doesn't explicitly tell it to consider all requests as local.One way to way to make the test pass is to change line 167 of
actionpack/test/abstract_unit.rb
from:to
then all the requests in the test cases that subclass from
ActionDispatch::IntegrationTest
would be considered local.Alternatively we could alter the logic in
actionpack/lib/action_dispatch/http/request.rb
that decides whether or not a request is local. Right now bothRequest#remote_addr
andRequest#remote_ip
have to match one of[/^127\.0\.0\.\d{1,3}$/, "::1", /^0:0:0:0:0:0:0:1(%.*)?$/]
. In the test casesRequest#remote_addr
is127.0.0.1
butRequest#remote_ip
is an empty string. Changing the logic from:to:
would make the test pass and all other test requests would be considered local.
In this patch I just updated the test to send the loopback IP with the request as it seemed the least intrusive way to get it to pass and can have no effect on any of the other tests: