diff options
author | Tony Wooster <twooster@gmail.com> | 2014-02-18 14:12:11 -0800 |
---|---|---|
committer | Tony Wooster <tony.wooster@causes.com> | 2014-02-26 10:39:44 -0800 |
commit | a351149e805910cd980bee1558e56e61c4a82db2 (patch) | |
tree | 51db3ad7c6999ecc510137fcb84977714dd04975 /activemodel/test/models | |
parent | 3225898513434ded93fe3abe51ba700f5bd9db84 (diff) | |
download | rails-a351149e805910cd980bee1558e56e61c4a82db2.tar.gz rails-a351149e805910cd980bee1558e56e61c4a82db2.tar.bz2 rails-a351149e805910cd980bee1558e56e61c4a82db2.zip |
Fix controller test not resetting @_url_options
Commit 4f2cd3e9 introduced a bug by reordering the call to
`@controller.recycle!` above the call to `build_request_uri`. The
impact of this was that the `@_url_options` cache ends up not being
reset between building a request URI (occurring within the test
controller) and the firing of the actual request.
We encountered this bug because we had the following setup:
class MinimumReproducibleController < ActionController::Base
before_filter { @param = 'param' }
def index
render text: url_for(params)
end
def default_url_options
{ custom_opt: @param }
end
end
def test_index
get :index # builds url, then fires actual request
end
The first step in `get :index` in the test suite would populate the
@_url_options cache. The subsequent call to `url_for` inside of the
controller action would then utilize the uncleared cache, thus never
calling the now-updated default_url_options.
This commit fixes this bug calling recycle! twice, and removes a call
to set response_body, which should no longer be needed since we're
recycling the request object explicitly.
Diffstat (limited to 'activemodel/test/models')
0 files changed, 0 insertions, 0 deletions