Permalink
Browse files

Use performed? instead of checking for response_body

* Check for performed? instead of response_body
* Change performed? to return a boolean
* Refactor AC::Metal#response_body= to reuse variable
  • Loading branch information...
carlosantoniodasilva committed Jan 19, 2012
1 parent 0a3f57e commit 1b4edd173dc2cbe53e48777d3e17be3164513539
@@ -181,13 +181,13 @@ def status=(status)
@_status = Rack::Utils.status_code(status)
end
- def response_body=(val)
- body = (val.nil? || val.respond_to?(:each)) ? val : [val]
- super body
+ def response_body=(body)
+ body = [body] unless body.nil? || body.respond_to?(:each)
+ super
end
def performed?
- response_body
+ !!response_body
end
def dispatch(name, request) #:nodoc:
@@ -2,7 +2,7 @@ module ActionController
module ImplicitRender
def send_action(method, *args)
ret = super
- default_render unless response_body
+ default_render unless performed?
ret
end
@@ -39,10 +39,8 @@ def use_flash
@flashy = flash["that"]
render :inline => "hello"
end
-
end
-
class ForceSSLControllerLevelTest < ActionController::TestCase
tests ForceSSLControllerLevel
@@ -135,5 +133,4 @@ def test_cheeseburger_redirects_to_https
assert_equal "hello", assigns["flash_copy"]["that"]
assert_equal "hello", assigns["flashy"]
end
-
end

0 comments on commit 1b4edd1

Please sign in to comment.