aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/test/controller/action_pack_assertions_test.rb
diff options
context:
space:
mode:
authorDavid Chelimsky <dchelimsky@gmail.com>2010-04-29 09:29:35 -0500
committerJosé Valim <jose.valim@gmail.com>2010-05-03 13:46:34 +0200
commitb3dcbedc67f49ef64f33570f3e24ac00a47c0181 (patch)
tree1823d26a518f9fd5f285032e8f812f336574bf82 /actionpack/test/controller/action_pack_assertions_test.rb
parent849ab9294244ac94f9ce4621c8cd325a2992a382 (diff)
downloadrails-b3dcbedc67f49ef64f33570f3e24ac00a47c0181.tar.gz
rails-b3dcbedc67f49ef64f33570f3e24ac00a47c0181.tar.bz2
rails-b3dcbedc67f49ef64f33570f3e24ac00a47c0181.zip
move assert_template tests to their own test case [#4501 state:resolved]
Signed-off-by: José Valim <jose.valim@gmail.com>
Diffstat (limited to 'actionpack/test/controller/action_pack_assertions_test.rb')
-rw-r--r--actionpack/test/controller/action_pack_assertions_test.rb87
1 files changed, 46 insertions, 41 deletions
diff --git a/actionpack/test/controller/action_pack_assertions_test.rb b/actionpack/test/controller/action_pack_assertions_test.rb
index eae2641dc0..765e111226 100644
--- a/actionpack/test/controller/action_pack_assertions_test.rb
+++ b/actionpack/test/controller/action_pack_assertions_test.rb
@@ -344,47 +344,6 @@ 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_passes_when_no_template_rendered
- get :nothing
- assert_template nil
- end
-
- def test_assert_template_with_nil_fails_when_template_rendered
- get :hello_world
- assert_raise(ActiveSupport::TestCase::Assertion) do
- assert_template nil
- end
- end
-
- def test_assert_template_passes_with_correct_string
- get :hello_world
- assert_template 'hello_world'
- assert_template 'test/hello_world'
- end
-
- def test_assert_template_passes_with_correct_symbol
- get :hello_world
- assert_template :hello_world
- end
-
- def test_assert_template_fails_with_incorrect_string
- get :hello_world
- assert_raise(ActiveSupport::TestCase::Assertion) do
- assert_template 'hello_planet'
- end
- end
-
- def test_assert_template_fails_with_incorrect_symbol
- get :hello_world
- assert_raise(ActiveSupport::TestCase::Assertion) do
- assert_template :hello_planet
- end
- end
# check if we were rendered by a file-based template?
def test_rendered_action
@@ -559,6 +518,52 @@ class ActionPackAssertionsControllerTest < ActionController::TestCase
end
end
+class AssertTemplateTest < ActionController::TestCase
+ tests ActionPackAssertionsController
+
+ def test_with_partial
+ get :partial
+ assert_template :partial => '_partial'
+ end
+
+ def test_with_nil_passes_when_no_template_rendered
+ get :nothing
+ assert_template nil
+ end
+
+ def test_with_nil_fails_when_template_rendered
+ get :hello_world
+ assert_raise(ActiveSupport::TestCase::Assertion) do
+ assert_template nil
+ end
+ end
+
+ def test_passes_with_correct_string
+ get :hello_world
+ assert_template 'hello_world'
+ assert_template 'test/hello_world'
+ end
+
+ def test_passes_with_correct_symbol
+ get :hello_world
+ assert_template :hello_world
+ end
+
+ def test_fails_with_incorrect_string
+ get :hello_world
+ assert_raise(ActiveSupport::TestCase::Assertion) do
+ assert_template 'hello_planet'
+ end
+ end
+
+ def test_fails_with_incorrect_symbol
+ get :hello_world
+ assert_raise(ActiveSupport::TestCase::Assertion) do
+ assert_template :hello_planet
+ end
+ end
+end
+
class ActionPackHeaderTest < ActionController::TestCase
tests ActionPackAssertionsController