diff options
author | eileencodes <eileencodes@gmail.com> | 2016-08-05 14:20:21 -0400 |
---|---|---|
committer | eileencodes <eileencodes@gmail.com> | 2016-08-05 15:43:39 -0400 |
commit | af1680f51c127c7e40019e68c01b2a693ba2640f (patch) | |
tree | 323cb7099ca25dc407bd83bfdb267c95e9b49cac /actionpack/test/abstract_unit.rb | |
parent | 70f2f981503d4f08b48ae0a05cf0e69308e1aba0 (diff) | |
download | rails-af1680f51c127c7e40019e68c01b2a693ba2640f.tar.gz rails-af1680f51c127c7e40019e68c01b2a693ba2640f.tar.bz2 rails-af1680f51c127c7e40019e68c01b2a693ba2640f.zip |
Fix GET JSON integration test request to use method override
When a `GET` request is sent `as: :json` in an integration test the test
should use Rack's method override to change to a post request so the
paramters are included in the postdata. Otherwise it will not encode the
parameters correctly for the integration test.
Because integration test sets up it's own middleware,
`Rack::MethodOverride` needs to be included in the integration tests as
well.
`headers ||= {}` was moved so that headers are never nil. They should
default to a hash.
Fixes #26033
[Eileen M. Uchitelle & Aaron Patterson]
Diffstat (limited to 'actionpack/test/abstract_unit.rb')
-rw-r--r-- | actionpack/test/abstract_unit.rb | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/actionpack/test/abstract_unit.rb b/actionpack/test/abstract_unit.rb index c8a45a0851..2d189f9f27 100644 --- a/actionpack/test/abstract_unit.rb +++ b/actionpack/test/abstract_unit.rb @@ -104,6 +104,7 @@ class ActionDispatch::IntegrationTest < ActiveSupport::TestCase middleware.use ActionDispatch::Callbacks middleware.use ActionDispatch::Cookies middleware.use ActionDispatch::Flash + middleware.use Rack::MethodOverride middleware.use Rack::Head yield(middleware) if block_given? end |