Created
June 18, 2011 01:22
-
-
Save raviolicode/1032704 to your computer and use it in GitHub Desktop.
Test for rails issue: https://github.com/rails/rails/issues/1685
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'abstract_unit' | |
class ParentController < ActionController::Base | |
protect_from_forgery | |
layout Proc.new { |controller| controller.request.xhr? ? '/layouts/xhr' : '/layouts/standard' } | |
end | |
class ChildController < ParentController | |
def render_implicit_html_template_from_xhr_request | |
render :template => "test/hello_world" | |
end | |
end | |
class RenderChildControllerTest < ActionController::TestCase | |
tests ChildController | |
def test_should_render_xhr_template_from_inherited_proc | |
xhr :get, :render_implicit_html_template_from_xhr_request | |
assert_equal "XHR!\nHello world!", @response.body | |
end | |
def test_should_render_standard_template_on_get_request | |
get :render_implicit_html_template_from_xhr_request | |
assert_equal "<html>Hello world!</html>", @response.body | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment