aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/test
diff options
context:
space:
mode:
authorYehuda Katz <wycats@yehuda-katzs-macbookpro41.local>2009-05-23 00:39:32 -0700
committerYehuda Katz <wycats@yehuda-katzs-macbookpro41.local>2009-05-23 00:39:32 -0700
commite22a3d893ef8441fb52320315c5e348c6c208b69 (patch)
treeefdbc4f2bece84bf500284a4a8dce9a7ef839324 /actionpack/test
parent3ac6d8f8b01fb04b8d6d35d75d802b41f4c256c9 (diff)
downloadrails-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')
-rw-r--r--actionpack/test/fixtures/test/greeting.html.erb (renamed from actionpack/test/fixtures/test/greeting.erb)0
-rw-r--r--actionpack/test/new_base/render_layout_test.rb32
-rw-r--r--actionpack/test/new_base/test_helper.rb2
3 files changed, 33 insertions, 1 deletions
diff --git a/actionpack/test/fixtures/test/greeting.erb b/actionpack/test/fixtures/test/greeting.html.erb
index 62fb0293f0..62fb0293f0 100644
--- a/actionpack/test/fixtures/test/greeting.erb
+++ b/actionpack/test/fixtures/test/greeting.html.erb
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
diff --git a/actionpack/test/new_base/test_helper.rb b/actionpack/test/new_base/test_helper.rb
index 89c1290063..d92029df7f 100644
--- a/actionpack/test/new_base/test_helper.rb
+++ b/actionpack/test/new_base/test_helper.rb
@@ -67,7 +67,7 @@ class Rack::TestCase < ActionController::IntegrationTest
def get(thing, *args)
if thing.is_a?(Symbol)
- super("#{self.class.testing}/#{thing}")
+ super("#{self.class.testing}/#{thing}", *args)
else
super
end