Revert "Add Rails >= 5.0.beta3 JSON API params parsing" (#1751)

This commit is contained in:
Ben Mills
2016-05-26 11:17:32 -06:00
parent 94db09b3f6
commit 6288203277
6 changed files with 46 additions and 213 deletions

View File

@@ -1,7 +1,7 @@
module Rails5Shims
module ControllerTests
# https://github.com/rails/rails/blob/b217354/actionpack/lib/action_controller/test_case.rb
REQUEST_KWARGS = [:params, :headers, :session, :flash, :method, :body, :xhr].freeze
REQUEST_KWARGS = [:params, :session, :flash, :method, :body, :xhr].freeze
def get(path, *args)
fold_kwargs!(args)
@@ -30,12 +30,7 @@ module Rails5Shims
return unless hash.respond_to?(:key)
Rails5Shims::ControllerTests::REQUEST_KWARGS.each do |kwarg|
next unless hash.key?(kwarg)
value = hash.delete(kwarg)
if value.is_a? String
args.insert(0, value)
else
hash.merge! value
end
hash.merge! hash.delete(kwarg)
end
end
@@ -49,5 +44,4 @@ module Rails5Shims
end
if Rails::VERSION::MAJOR < 5
ActionController::TestCase.send :include, Rails5Shims::ControllerTests
ActionDispatch::IntegrationTest.send :include, Rails5Shims::ControllerTests
end