diff options
Diffstat (limited to 'actionpack/test/controller/layout_test.rb')
-rw-r--r-- | actionpack/test/controller/layout_test.rb | 24 |
1 files changed, 13 insertions, 11 deletions
diff --git a/actionpack/test/controller/layout_test.rb b/actionpack/test/controller/layout_test.rb index f2721e274d..11559b4071 100644 --- a/actionpack/test/controller/layout_test.rb +++ b/actionpack/test/controller/layout_test.rb @@ -56,8 +56,8 @@ class LayoutAutoDiscoveryTest < ActionController::TestCase def test_third_party_template_library_auto_discovers_layout @controller = ThirdPartyTemplateLibraryController.new get :hello - assert_equal 'layouts/third_party_template_library.mab', @controller.active_layout(true).to_s - assert_equal 'layouts/third_party_template_library', @response.layout + assert @controller.active_layout(true).identifier.include?('layouts/third_party_template_library.mab') + assert @response.layout.include?('layouts/third_party_template_library') assert_response :success assert_equal 'Mab', @response.body end @@ -72,7 +72,7 @@ class LayoutAutoDiscoveryTest < ActionController::TestCase def test_namespaced_controllers_auto_detect_layouts @controller = MultipleExtensions.new get :hello - assert_equal 'layouts/multiple_extensions.html.erb', @controller.active_layout(true).to_s + assert @controller.active_layout(true).identifier.include?('layouts/multiple_extensions.html.erb') assert_equal 'multiple_extensions.html.erb hello.rhtml', @response.body.strip end end @@ -116,22 +116,24 @@ class RendersNoLayoutController < LayoutTest end class LayoutSetInResponseTest < ActionController::TestCase + include ActionView::TemplateHandlers + def test_layout_set_when_using_default_layout @controller = DefaultLayoutController.new get :hello - assert_equal 'layouts/layout_test', @response.layout + assert @response.layout.include?('layouts/layout_test') end def test_layout_set_when_set_in_controller @controller = HasOwnLayoutController.new get :hello - assert_equal 'layouts/item', @response.layout + assert @response.layout.include?('layouts/item') end def test_layout_only_exception_when_included @controller = OnlyLayoutController.new get :hello - assert_equal 'layouts/item', @response.layout + assert @response.layout.include?('layouts/item') end def test_layout_only_exception_when_excepted @@ -143,7 +145,7 @@ class LayoutSetInResponseTest < ActionController::TestCase def test_layout_except_exception_when_included @controller = ExceptLayoutController.new get :hello - assert_equal 'layouts/item', @response.layout + assert @response.layout.include?('layouts/item') end def test_layout_except_exception_when_excepted @@ -155,7 +157,7 @@ class LayoutSetInResponseTest < ActionController::TestCase def test_layout_set_when_using_render @controller = SetsLayoutInRenderController.new get :hello - assert_equal 'layouts/third_party_template_library', @response.layout + assert @response.layout.include?('layouts/third_party_template_library') end def test_layout_is_not_set_when_none_rendered @@ -165,14 +167,14 @@ class LayoutSetInResponseTest < ActionController::TestCase end def test_exempt_from_layout_honored_by_render_template - ActionController::Base.exempt_from_layout :rhtml + ActionController::Base.exempt_from_layout :erb @controller = RenderWithTemplateOptionController.new get :hello assert_equal "alt/hello.rhtml", @response.body.strip ensure - ActionController::Base.exempt_from_layout.delete(/\.rhtml$/) + ActionController::Base.exempt_from_layout.delete(ERB) end def test_layout_is_picked_from_the_controller_instances_view_path @@ -232,7 +234,7 @@ unless RUBY_PLATFORM =~ /(:?mswin|mingw|bccwin)/ @controller = LayoutSymlinkedTest.new get :hello assert_response 200 - assert_equal "layouts/symlinked/symlinked_layout", @response.layout + assert @response.layout.include?("layouts/symlinked/symlinked_layout") end end end |