mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
Fix a bug where responders were not working properly on method override.
This commit is contained in:
parent
69a9669d9d
commit
59d1c418be
2 changed files with 14 additions and 1 deletions
|
@ -217,7 +217,7 @@ module ActionController #:nodoc:
|
|||
# the verb is POST.
|
||||
#
|
||||
def default_action
|
||||
@action ||= ACTIONS_FOR_VERBS[request.method_symbol]
|
||||
@action ||= ACTIONS_FOR_VERBS[request.request_method_symbol]
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -668,6 +668,19 @@ class RespondWithControllerTest < ActionController::TestCase
|
|||
end
|
||||
end
|
||||
|
||||
def test_using_resource_for_put_with_html_rerender_on_failure_even_on_method_override
|
||||
with_test_route_set do
|
||||
errors = { :name => :invalid }
|
||||
Customer.any_instance.stubs(:errors).returns(errors)
|
||||
@request.env["rack.methodoverride.original_method"] = "POST"
|
||||
put :using_resource
|
||||
assert_equal "text/html", @response.content_type
|
||||
assert_equal 200, @response.status
|
||||
assert_equal "Edit world!\n", @response.body
|
||||
assert_nil @response.location
|
||||
end
|
||||
end
|
||||
|
||||
def test_using_resource_for_put_with_xml_yields_ok_on_success
|
||||
@request.accept = "application/xml"
|
||||
put :using_resource
|
||||
|
|
Loading…
Reference in a new issue