diff options
| author | Pratik Naik <pratiknaik@gmail.com> | 2009-05-24 11:54:27 +0200 |
|---|---|---|
| committer | Pratik Naik <pratiknaik@gmail.com> | 2009-05-24 11:54:27 +0200 |
| commit | 7324e46a3fe7be282deeda14783f4170ccf03a3c (patch) | |
| tree | 79968712783f47c816d81e97604f77ff7d920b40 /actionpack/test/controller/action_pack_assertions_test.rb | |
| parent | 1fee2fb996229236fb236bcef423930fdf1dfe2d (diff) | |
| parent | 6e039e863a5d71f2a516be2eef2605be23281290 (diff) | |
| download | rails-7324e46a3fe7be282deeda14783f4170ccf03a3c.tar.gz rails-7324e46a3fe7be282deeda14783f4170ccf03a3c.tar.bz2 rails-7324e46a3fe7be282deeda14783f4170ccf03a3c.zip | |
Merge commit 'mainstream/master'
Conflicts:
actionpack/lib/action_controller/base/mime_responds.rb
Diffstat (limited to 'actionpack/test/controller/action_pack_assertions_test.rb')
| -rw-r--r-- | actionpack/test/controller/action_pack_assertions_test.rb | 29 |
1 files changed, 26 insertions, 3 deletions
diff --git a/actionpack/test/controller/action_pack_assertions_test.rb b/actionpack/test/controller/action_pack_assertions_test.rb index 484d3c5ce7..24686ab4b6 100644 --- a/actionpack/test/controller/action_pack_assertions_test.rb +++ b/actionpack/test/controller/action_pack_assertions_test.rb @@ -1,4 +1,5 @@ require 'abstract_unit' +require 'action_controller/vendor/html-scanner' # a controller class to facilitate the tests class ActionPackAssertionsController < ActionController::Base @@ -12,6 +13,9 @@ class ActionPackAssertionsController < ActionController::Base # a standard template def hello_xml_world() render :template => "test/hello_xml_world"; end + # a standard partial + def partial() render :partial => 'test/partial'; end + # a redirect to an internal location def redirect_internal() redirect_to "/nothing"; end @@ -292,8 +296,8 @@ class ActionPackAssertionsControllerTest < ActionController::TestCase # make sure that the template objects exist def test_template_objects_alive process :assign_this - assert !@controller.template.assigns['hi'] - assert @controller.template.assigns['howdy'] + assert !@controller.template.instance_variable_get(:"@hi") + assert @controller.template.instance_variable_get(:"@howdy") end # make sure we don't have template objects when we shouldn't @@ -331,6 +335,26 @@ class ActionPackAssertionsControllerTest < ActionController::TestCase end end + def test_assert_template_with_partial + get :partial + assert_template :partial => '_partial' + end + + def test_assert_template_with_nil + get :nothing + assert_template nil + end + + def test_assert_template_with_string + get :hello_world + assert_template 'hello_world' + end + + def test_assert_template_with_symbol + get :hello_world + assert_template :hello_world + end + # check if we were rendered by a file-based template? def test_rendered_action process :nothing @@ -421,7 +445,6 @@ class ActionPackAssertionsControllerTest < ActionController::TestCase assert_equal "Mr. David", @response.body end - def test_assert_redirection_fails_with_incorrect_controller process :redirect_to_controller assert_raise(ActiveSupport::TestCase::Assertion) do |
