mirror of
https://github.com/github/rails.git
synced 2026-04-26 03:00:59 -04:00
move assert_template tests to their own test case [#4501 state:resolved]
Signed-off-by: José Valim <jose.valim@gmail.com>
This commit is contained in:
committed by
José Valim
parent
849ab92942
commit
b3dcbedc67
@@ -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
|
||||
|
||||
|
||||
Reference in New Issue
Block a user