diff options
Diffstat (limited to 'actionpack/test/controller')
-rw-r--r-- | actionpack/test/controller/render_test.rb | 28 |
1 files changed, 19 insertions, 9 deletions
diff --git a/actionpack/test/controller/render_test.rb b/actionpack/test/controller/render_test.rb index 6a03466db1..462fba7045 100644 --- a/actionpack/test/controller/render_test.rb +++ b/actionpack/test/controller/render_test.rb @@ -39,7 +39,7 @@ class TestController < ActionController::Base render :action => 'hello_world' end before_filter :handle_last_modified_and_etags, :only=>:conditional_hello_with_bangs - + def handle_last_modified_and_etags fresh_when(:last_modified => Time.now.utc.beginning_of_day, :etag => [ :foo, 123 ]) end @@ -337,6 +337,11 @@ class TestController < ActionController::Base render :text => "Hi web users! #{@stuff}" end + def render_to_string_with_inline_and_render + render_to_string :inline => "<%= 'dlrow olleh'.reverse %>" + render :template => "test/hello_world" + end + def rendering_with_conflicting_local_vars @name = "David" def @template.name() nil end @@ -906,6 +911,11 @@ class RenderTest < ActionController::TestCase assert_equal "The value of foo is: ::this is a test::\n", @response.body end + def test_render_to_string_inline + get :render_to_string_with_inline_and_render + assert_template "test/hello_world" + end + def test_nested_rendering @controller = Fun::GamesController.new get :hello_world @@ -1364,7 +1374,7 @@ class EtagRenderTest < ActionController::TestCase assert_equal "200 OK", @response.status assert !@response.body.empty? end - + def test_render_should_not_set_etag_when_last_modified_has_been_specified get :render_hello_world_with_last_modified_set assert_equal "200 OK", @response.status @@ -1378,7 +1388,7 @@ class EtagRenderTest < ActionController::TestCase expected_etag = etag_for('hello david') assert_equal expected_etag, @response.headers['ETag'] @response = ActionController::TestResponse.new - + @request.if_none_match = expected_etag get :render_hello_world_from_variable assert_equal "304 Not Modified", @response.status @@ -1403,24 +1413,24 @@ class EtagRenderTest < ActionController::TestCase assert_equal "<wrapper>\n<html>\n <p>Hello </p>\n<p>This is grand!</p>\n</html>\n</wrapper>\n", @response.body assert_equal etag_for("<wrapper>\n<html>\n <p>Hello </p>\n<p>This is grand!</p>\n</html>\n</wrapper>\n"), @response.headers['ETag'] end - + def test_etag_with_bang_should_set_etag get :conditional_hello_with_bangs assert_equal @expected_bang_etag, @response.headers["ETag"] assert_response :success end - + def test_etag_with_bang_should_obey_if_none_match @request.if_none_match = @expected_bang_etag get :conditional_hello_with_bangs assert_response :not_modified end - + protected def etag_for(text) %("#{Digest::MD5.hexdigest(text)}") end - + def expand_key(args) ActiveSupport::Cache.expand_cache_key(args) end @@ -1461,13 +1471,13 @@ class LastModifiedRenderTest < ActionController::TestCase assert !@response.body.blank? assert_equal @last_modified, @response.headers['Last-Modified'] end - + def test_request_with_bang_gets_last_modified get :conditional_hello_with_bangs assert_equal @last_modified, @response.headers['Last-Modified'] assert_response :success end - + def test_request_with_bang_obeys_last_modified @request.if_modified_since = @last_modified get :conditional_hello_with_bangs |