diff options
author | Yehuda Katz <wycats@yehuda-katzs-macbookpro41.local> | 2009-05-23 00:39:32 -0700 |
---|---|---|
committer | Yehuda Katz <wycats@yehuda-katzs-macbookpro41.local> | 2009-05-23 00:39:32 -0700 |
commit | e22a3d893ef8441fb52320315c5e348c6c208b69 (patch) | |
tree | efdbc4f2bece84bf500284a4a8dce9a7ef839324 /actionpack/test/new_base/render_layout_test.rb | |
parent | 3ac6d8f8b01fb04b8d6d35d75d802b41f4c256c9 (diff) | |
download | rails-e22a3d893ef8441fb52320315c5e348c6c208b69.tar.gz rails-e22a3d893ef8441fb52320315c5e348c6c208b69.tar.bz2 rails-e22a3d893ef8441fb52320315c5e348c6c208b69.zip |
Slightly modify things to get content type matching working without breaking other code
Diffstat (limited to 'actionpack/test/new_base/render_layout_test.rb')
-rw-r--r-- | actionpack/test/new_base/render_layout_test.rb | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/actionpack/test/new_base/render_layout_test.rb b/actionpack/test/new_base/render_layout_test.rb index 76bd5175a3..f32c60d683 100644 --- a/actionpack/test/new_base/render_layout_test.rb +++ b/actionpack/test/new_base/render_layout_test.rb @@ -66,4 +66,36 @@ module ControllerLayouts assert_response "hai(layout_false.html.erb)" end end + + class MismatchFormatController < ::ApplicationController + self.view_paths = [ActionView::Template::FixturePath.new( + "layouts/application.html.erb" => "<html><%= yield %></html>", + "controller_layouts/mismatch_format/index.js.rjs" => "page[:test].omg", + "controller_layouts/mismatch_format/implicit.rjs" => "page[:test].omg" + )] + + def explicit + render :layout => "application" + end + end + + class MismatchFormatTest < SimpleRouteCase + testing ControllerLayouts::MismatchFormatController + + test "if JS is selected, an HTML template is not also selected" do + get :index + assert_response "$(\"test\").omg();" + end + + test "if JS is implicitly selected, an HTML template is not also selected" do + get :implicit + assert_response "$(\"test\").omg();" + end + + test "if an HTML template is explicitly provides for a JS template, an error is raised" do + assert_raises ActionView::MissingTemplate do + get :explicit, {}, "action_dispatch.show_exceptions" => false + end + end + end end
\ No newline at end of file |