1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00

Add test to make sure RJS block inside controller is executed in view context

This commit is contained in:
Pratik Naik 2008-08-30 21:42:53 +01:00
parent e12abb6e8a
commit 4fb75392aa

View file

@ -371,6 +371,12 @@ class TestController < ActionController::Base
end end
end end
def update_page_with_view_method
render :update do |page|
page.replace_html 'person', pluralize(2, 'person')
end
end
def action_talk_to_layout def action_talk_to_layout
# Action template sets variable that's picked up by layout # Action template sets variable that's picked up by layout
end end
@ -1022,6 +1028,13 @@ class RenderTest < Test::Unit::TestCase
assert_match /\$37/, @response.body assert_match /\$37/, @response.body
end end
def test_update_page_with_view_method
get :update_page_with_view_method
assert_template nil
assert_equal 'text/javascript; charset=utf-8', @response.headers['type']
assert_match /2 people/, @response.body
end
def test_yield_content_for def test_yield_content_for
assert_not_deprecated { get :yield_content_for } assert_not_deprecated { get :yield_content_for }
assert_equal "<title>Putting stuff in the title!</title>\n\nGreat stuff!\n", @response.body assert_equal "<title>Putting stuff in the title!</title>\n\nGreat stuff!\n", @response.body