Ticket #9476: layout_with_status.2.diff
| File layout_with_status.2.diff, 1.4 kB (added by lotswholetime, 1 year ago) |
|---|
-
test/controller/layout_test.rb
old new 200 200 assert_equal ActionController::MissingTemplate, @response.template.exception.class 201 201 end 202 202 end 203 204 class LayoutStatusIsRendered < LayoutTest 205 def hello 206 render :status => 401 207 end 208 end 209 210 class LayoutStatusIsRenderedTest < Test::Unit::TestCase 211 def setup 212 @request = ActionController::TestRequest.new 213 @response = ActionController::TestResponse.new 214 end 215 216 def test_layout_status_is_rendered 217 @controller = LayoutStatusIsRendered.new 218 get :hello 219 assert_response 401 220 end 221 end -
lib/action_controller/layout.rb
old new 247 247 add_variables_to_assigns 248 248 @template.instance_variable_set("@content_for_layout", content_for_layout) 249 249 response.layout = layout 250 render_for_text(@template.render_file(layout, true)) 250 status = template_with_options ? options[:status] : nil 251 render_for_text(@template.render_file(layout, true), status) 251 252 else 252 253 render_with_no_layout(options, &block) 253 254 end