aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/test/controller
diff options
context:
space:
mode:
Diffstat (limited to 'actionpack/test/controller')
-rw-r--r--actionpack/test/controller/action_pack_assertions_test.rb66
-rw-r--r--actionpack/test/controller/layout_test.rb2
2 files changed, 46 insertions, 22 deletions
diff --git a/actionpack/test/controller/action_pack_assertions_test.rb b/actionpack/test/controller/action_pack_assertions_test.rb
index 1741b58f72..765e111226 100644
--- a/actionpack/test/controller/action_pack_assertions_test.rb
+++ b/actionpack/test/controller/action_pack_assertions_test.rb
@@ -344,25 +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
- 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
@@ -387,7 +368,6 @@ class ActionPackAssertionsControllerTest < ActionController::TestCase
assert_nil @response.redirect_url
end
-
# check server errors
def test_server_error_response_code
process :response500
@@ -538,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
diff --git a/actionpack/test/controller/layout_test.rb b/actionpack/test/controller/layout_test.rb
index 48be7571ea..165c61ffad 100644
--- a/actionpack/test/controller/layout_test.rb
+++ b/actionpack/test/controller/layout_test.rb
@@ -10,8 +10,6 @@ ActionView::Template::register_template_handler :mab,
ActionController::Base.view_paths = [ File.dirname(__FILE__) + '/../fixtures/layout_tests/' ]
-require "fixture_template"
-
class LayoutTest < ActionController::Base
def self.controller_path; 'views' end
def self._implied_layout_name; to_s.underscore.gsub(/_controller$/, '') ; end