mirror of
https://github.com/github/rails.git
synced 2026-04-26 03:00:59 -04:00
Merge pull request #3581 from amatsuda/metal_response_body_19
AC::Metal#response_body= stores different value in Ruby 1.8 and 1.9
This commit is contained in:
@@ -182,7 +182,13 @@ module ActionController
|
||||
end
|
||||
|
||||
def response_body=(val)
|
||||
body = val.nil? ? nil : (val.respond_to?(:each) ? val : [val])
|
||||
body = if val.is_a?(String)
|
||||
[val]
|
||||
elsif val.nil? || val.respond_to?(:each)
|
||||
val
|
||||
else
|
||||
[val]
|
||||
end
|
||||
super body
|
||||
end
|
||||
|
||||
|
||||
@@ -23,6 +23,12 @@ module BareMetalTest
|
||||
|
||||
assert_equal "Hello world", string
|
||||
end
|
||||
|
||||
test "response_body value is wrapped in an array when the value is a String" do
|
||||
controller = BareController.new
|
||||
controller.index
|
||||
assert_equal ["Hello world"], controller.response_body
|
||||
end
|
||||
end
|
||||
|
||||
class HeadController < ActionController::Metal
|
||||
|
||||
Reference in New Issue
Block a user