aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack
diff options
context:
space:
mode:
authorJosé Valim <jose.valim@gmail.com>2011-09-23 00:42:20 +0200
committerJosé Valim <jose.valim@gmail.com>2011-09-23 00:42:20 +0200
commit48d27363f2d6f20a7178dc9bd0d664bc4e60212d (patch)
tree3c2d4f3a57c93184d3a3d4c33fa440ef8026dd37 /actionpack
parent552df29cc849500b6e2cbc4186e23c330909ae8e (diff)
downloadrails-48d27363f2d6f20a7178dc9bd0d664bc4e60212d.tar.gz
rails-48d27363f2d6f20a7178dc9bd0d664bc4e60212d.tar.bz2
rails-48d27363f2d6f20a7178dc9bd0d664bc4e60212d.zip
Fix failing tests and add tests for :formats on partial.
Diffstat (limited to 'actionpack')
-rw-r--r--actionpack/test/template/render_test.rb15
1 files changed, 10 insertions, 5 deletions
diff --git a/actionpack/test/template/render_test.rb b/actionpack/test/template/render_test.rb
index 5637f3f42e..0ef3239f83 100644
--- a/actionpack/test/template/render_test.rb
+++ b/actionpack/test/template/render_test.rb
@@ -34,14 +34,14 @@ module RenderTestCases
# Test if :formats, :locale etc. options are passed correctly to the resolvers.
def test_render_file_with_format
- assert_equal "<h1>No Comment</h1>", @view.render(:file => "comments/empty", :formats => [:html])
- assert_equal "<error>No Comment</error>", @view.render(:file => "comments/empty", :formats => [:xml])
- assert_equal "<error>No Comment</error>", @view.render(:file => "comments/empty", :formats => :xml)
+ assert_match "<h1>No Comment</h1>", @view.render(:file => "comments/empty", :formats => [:html])
+ assert_match "<error>No Comment</error>", @view.render(:file => "comments/empty", :formats => [:xml])
+ assert_match "<error>No Comment</error>", @view.render(:file => "comments/empty", :formats => :xml)
end
def test_render_template_with_format
- assert_equal "<h1>No Comment</h1>", @view.render(:template => "comments/empty", :formats => [:html])
- assert_equal "<error>No Comment</error>", @view.render(:template => "comments/empty", :formats => [:xml])
+ assert_match "<h1>No Comment</h1>", @view.render(:template => "comments/empty", :formats => [:html])
+ assert_match "<error>No Comment</error>", @view.render(:template => "comments/empty", :formats => [:xml])
end
def test_render_file_with_locale
@@ -110,6 +110,11 @@ module RenderTestCases
assert_equal 'partial html', @view.render(:partial => 'test/partial')
end
+ def test_render_partial_with_selected_format
+ assert_equal 'partial html', @view.render(:partial => 'test/partial', :formats => :html)
+ assert_equal 'partial js', @view.render(:partial => 'test/partial', :formats => [:js])
+ end
+
def test_render_partial_at_top_level
# file fixtures/_top_level_partial_only (not fixtures/test)
assert_equal 'top level partial', @view.render(:partial => '/top_level_partial_only')