Permalink
Browse files

Fix failing tests and add tests for :formats on partial.

  • Loading branch information...
1 parent 552df29 commit 48d27363f2d6f20a7178dc9bd0d664bc4e60212d @josevalim josevalim committed Sep 22, 2011
Showing with 10 additions and 5 deletions.
  1. +10 −5 actionpack/test/template/render_test.rb
@@ -34,14 +34,14 @@ def test_render_file_without_specific_extension
# 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 @@ def test_render_partial_with_format
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')

0 comments on commit 48d2736

Please sign in to comment.