aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRafael Mendonça França <rafaelmfranca@gmail.com>2016-05-23 18:45:09 -0300
committerRafael Mendonça França <rafaelmfranca@gmail.com>2016-10-10 00:17:08 -0300
commit31639eab59e9029328251eb1c4d6ddb5bd1db88d (patch)
tree34753979f148507c6fccb4f5d34e349875b84c48
parent7093ceb480ad6a0a91b511832dad4c6a86981b93 (diff)
downloadrails-31639eab59e9029328251eb1c4d6ddb5bd1db88d.tar.gz
rails-31639eab59e9029328251eb1c4d6ddb5bd1db88d.tar.bz2
rails-31639eab59e9029328251eb1c4d6ddb5bd1db88d.zip
Remove deprecated `xml_http_request` and `xhr` methods
-rw-r--r--actionpack/CHANGELOG.md4
-rw-r--r--actionpack/lib/action_controller/test_case.rb15
-rw-r--r--actionpack/test/controller/test_case_test.rb15
3 files changed, 4 insertions, 30 deletions
diff --git a/actionpack/CHANGELOG.md b/actionpack/CHANGELOG.md
index aac2e270b4..10c95ad5b7 100644
--- a/actionpack/CHANGELOG.md
+++ b/actionpack/CHANGELOG.md
@@ -1,3 +1,7 @@
+* Remove deprecated `xml_http_request` and `xhr` methods in `ActionController::TestCase`.
+
+ *Rafael Mendonça França*
+
* Remove deprecated methods in `ActionController::Parameters`.
*Rafael Mendonça França*
diff --git a/actionpack/lib/action_controller/test_case.rb b/actionpack/lib/action_controller/test_case.rb
index f4ec13c831..051cb40381 100644
--- a/actionpack/lib/action_controller/test_case.rb
+++ b/actionpack/lib/action_controller/test_case.rb
@@ -422,21 +422,6 @@ module ActionController
process_with_kwargs("HEAD", action, *args)
end
- def xml_http_request(*args)
- ActiveSupport::Deprecation.warn(<<-MSG.strip_heredoc)
- xhr and xml_http_request methods are deprecated in favor of
- `get :index, xhr: true` and `post :create, xhr: true`
- MSG
-
- @request.env["HTTP_X_REQUESTED_WITH"] = "XMLHttpRequest"
- @request.env["HTTP_ACCEPT"] ||= [Mime[:js], Mime[:html], Mime[:xml], "text/xml", "*/*"].join(", ")
- __send__(*args).tap do
- @request.env.delete "HTTP_X_REQUESTED_WITH"
- @request.env.delete "HTTP_ACCEPT"
- end
- end
- alias xhr :xml_http_request
-
# Simulate an HTTP request to +action+ by specifying request method,
# parameters and set/volley the response.
#
diff --git a/actionpack/test/controller/test_case_test.rb b/actionpack/test/controller/test_case_test.rb
index d929885aea..b07e26fb57 100644
--- a/actionpack/test/controller/test_case_test.rb
+++ b/actionpack/test/controller/test_case_test.rb
@@ -742,12 +742,6 @@ XML
assert_nil @request.env["HTTP_ACCEPT"]
end
- def test_deprecated_xhr_with_params
- assert_deprecated { xhr :get, :test_params, params: { id: 1 } }
-
- assert_equal({ "id"=>"1", "controller"=>"test_case_test/test", "action"=>"test_params" }, ::JSON.parse(@response.body))
- end
-
def test_xhr_with_params
get :test_params, params: { id: 1 }, xhr: true
@@ -763,15 +757,6 @@ XML
assert_equal "it works", session[:symbol], "Test session hash should allow indifferent access"
end
- def test_deprecated_xhr_with_session
- assert_deprecated { xhr :get, :set_session }
-
- assert_equal "A wonder", session["string"], "A value stored in the session should be available by string key"
- assert_equal "A wonder", session[:string], "Test session hash should allow indifferent access"
- assert_equal "it works", session["symbol"], "Test session hash should allow indifferent access"
- assert_equal "it works", session[:symbol], "Test session hash should allow indifferent access"
- end
-
def test_deprecated_params_reset_between_post_requests
assert_deprecated { post :no_op, foo: "bar" }
assert_equal "bar", @request.params[:foo]