From a2762d95c6f2c1cf6ba96002ffb5ebea7c3eac61 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafael=20Mendon=C3=A7a=20Fran=C3=A7a?= Date: Tue, 10 May 2016 04:54:17 -0300 Subject: Remove deprecated support for status option in head --- actionpack/CHANGELOG.md | 4 ++++ actionpack/lib/action_controller/metal/head.rb | 8 +------- actionpack/test/controller/render_test.rb | 21 --------------------- 3 files changed, 5 insertions(+), 28 deletions(-) diff --git a/actionpack/CHANGELOG.md b/actionpack/CHANGELOG.md index aa18e94edc..736c36c7b4 100644 --- a/actionpack/CHANGELOG.md +++ b/actionpack/CHANGELOG.md @@ -1,3 +1,7 @@ +* Remove deprecated support to passing status as option `head`. + + *Rafael Mendonça França* + * Remove deprecated support to passing original exception to `ActionController::BadRequest` and the `ActionController::BadRequest#original_exception` method. diff --git a/actionpack/lib/action_controller/metal/head.rb b/actionpack/lib/action_controller/metal/head.rb index 86b5eb20d7..4dff23dd85 100644 --- a/actionpack/lib/action_controller/metal/head.rb +++ b/actionpack/lib/action_controller/metal/head.rb @@ -18,13 +18,7 @@ module ActionController # See Rack::Utils::SYMBOL_TO_STATUS_CODE for a full list of valid +status+ symbols. def head(status, options = {}) if status.is_a?(Hash) - msg = status[:status] ? "The :status option" : "The implicit :ok status" - options, status = status, status.delete(:status) - - ActiveSupport::Deprecation.warn(<<-MSG.squish) - #{msg} on `head` has been deprecated and will be removed in Rails 5.1. - Please pass the status as a separate parameter before the options, instead. - MSG + raise ArgumentError, "#{status.inspect} is not a valid value for `status`." end status ||= :ok diff --git a/actionpack/test/controller/render_test.rb b/actionpack/test/controller/render_test.rb index 70e5760764..cc4fe5c6b4 100644 --- a/actionpack/test/controller/render_test.rb +++ b/actionpack/test/controller/render_test.rb @@ -173,14 +173,6 @@ class TestController < ActionController::Base fresh_when(last_modified: Time.now.utc.beginning_of_day, etag: [ :foo, 123 ]) end - def head_with_status_hash - head status: :created - end - - def head_with_hash_does_not_include_status - head warning: :deprecated - end - def head_created head :created end @@ -670,19 +662,6 @@ class HeadRenderTest < ActionController::TestCase assert_response :created end - def test_passing_hash_to_head_as_first_parameter_deprecated - assert_deprecated do - get :head_with_status_hash - end - end - - def test_head_with_default_value_is_deprecated - assert_deprecated do - get :head_with_hash_does_not_include_status - assert_response :ok - end - end - def test_head_created_with_application_json_content_type post :head_created_with_application_json_content_type assert @response.body.blank? -- cgit v1.2.3