Permalink
Browse files

fix tests for rails 3.0.0 final

  • Loading branch information...
1 parent 24a7ca0 commit e27c36f189099d6fa20a5a211c633cb8ea27fd87 @svenfuchs committed Sep 29, 2010
Showing with 13 additions and 22 deletions.
  1. +0 −9 test/beautify_test.rb
  2. +12 −12 test/template_test.rb
  3. +1 −1 test/translated_tags_test.rb
View
9 test/beautify_test.rb
@@ -1,9 +0,0 @@
-require File.expand_path('../test_helper', __FILE__)
-
-class BeautifyTest < Test::Unit::TestCase
- test "beautify does not touch the content-type meta tag" do
- html = '<html><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"></head></html>'
- html = Minimal::Template::BeautifyHtml.tidy(html)
- assert html.include?('<meta http-equiv="Content-Type" content="text/html; charset=utf-8">')
- end
-end
View
24 test/template_test.rb
@@ -45,7 +45,7 @@ def template
template << 'bar'
'baz'
end
- assert_equal '<div>foobar</div>', view.output_buffer
+ assert_equal '<div>foobar</div>', view.output_buffer.gsub("\n", '')
end
test "call_view calling a concating helper with a block" do
@@ -55,11 +55,11 @@ def template
'baz'
end
html = '<form accept-charset="UTF-8" action="/foo" method="post">' +
- '<div style="margin:0;padding:0;display:inline"><input name="_snowman" type="hidden" value="&#9731;" /></div>' +
+ '<div style="margin:0;padding:0;display:inline"><input name="utf8" type="hidden" value="&#x2713;" /></div>' +
'<input id="foo_foo" name="foo[foo]" size="30" type="text" />' +
'<input id="foo_bar" name="foo[bar]" size="30" type="text" />' +
'</form>'
- assert_equal html, view.output_buffer
+ assert_equal html, view.output_buffer.gsub("\n", '')
end
# test "does not buffer but returns a helper's result when :capture => true was passed'" do
@@ -70,42 +70,42 @@ def template
test "simple render with local assigns" do
html = '<html><head></head><body><h1>plain</h1><p>local</p><div><div>nested</div></div></body></html>'
- assert_equal html, view.render(:file => 'foo/simple', :locals => { :local => 'local' })
+ assert_equal html, view.render(:file => 'foo/simple', :locals => { :local => 'local' }).gsub("\n", '')
end
test "partial rendering" do
html = '<div><p>foo</p><p>bar</p></div><p>baz</p>'
- assert_equal html, view.render(:file => 'foo/partial')
+ assert_equal html, view.render(:file => 'foo/partial').gsub("\n", '')
end
test "table" do
html = '<table><tr><td>foo</td><td>bar</td><td>baz</td></tr></table>'
- assert_equal html, view.render(:file => 'foo/table')
+ assert_equal html, view.render(:file => 'foo/table').gsub("\n", '')
end
test "form_tag with input_tags" do
html = '<div>foo</div>' +
'<form accept-charset="UTF-8" action="/foo" method="post">' +
- '<div style="margin:0;padding:0;display:inline"><input name="_snowman" type="hidden" value="&#9731;" /></div>' +
+ '<div style="margin:0;padding:0;display:inline"><input name="utf8" type="hidden" value="&#x2713;" /></div>' +
'<div><input id="bar" name="bar" type="text" /></div>' +
'<input id="baz" name="baz" type="text" />' +
'</form>'
- assert_equal html, view.render(:file => 'foo/form_tag')
+ assert_equal html, view.render(:file => 'foo/form_tag').gsub("\n", '')
end
test "form_for" do
html = '<div>foo</div>' +
'<form accept-charset="UTF-8" action="/foo" method="post">' +
- '<div style="margin:0;padding:0;display:inline"><input name="_snowman" type="hidden" value="&#9731;" /></div>' +
+ '<div style="margin:0;padding:0;display:inline"><input name="utf8" type="hidden" value="&#x2713;" /></div>' +
'<div><input id="foo_bar" name="foo[bar]" size="30" type="text" /></div>' +
'<input id="foo_baz" name="foo[baz]" size="30" type="text" />' +
'</form>'
- assert_equal html, view.render(:file => 'foo/form_for')
+ assert_equal html, view.render(:file => 'foo/form_for').gsub("\n", '')
end
test "form_for with nested fields_for" do
html = '<form accept-charset="UTF-8" action="/foo" method="post">' +
- '<div style="margin:0;padding:0;display:inline"><input name="_snowman" type="hidden" value="&#9731;" /></div>' +
+ '<div style="margin:0;padding:0;display:inline"><input name="utf8" type="hidden" value="&#x2713;" /></div>' +
'<select id="form_foo" name="form[foo]"><option value="1">1</option></select>' +
'<select id="form_outer_bar" name="form[outer][bar]"><option value="1">1</option></select>' +
'<select id="form_outer_inner_baz" name="form[outer][inner][baz]"><option value="1">1</option></select>' +
@@ -130,7 +130,7 @@ def template
test "yielding in layouts works" do
html = '<html><head></head><body><div>content</div><div>sidebar</div></body></html>'
- assert_equal html, view.render(:file => 'foo/content', :layout => 'foo/layout')
+ assert_equal html, view.render(:file => 'foo/content', :layout => 'foo/layout').gsub("\n", '')
end
test "responds to methods the view responds to" do
View
2 test/translated_tags_test.rb
@@ -17,6 +17,6 @@ def template
end
test "keys given as content will be translated" do
- assert_equal '<p>FOO</p>', view.render(:file => 'foo/translated')
+ assert_equal '<p>FOO</p>', view.render(:file => 'foo/translated').gsub("\n", '')
end
end

0 comments on commit e27c36f

Please sign in to comment.