spec/markaby/rails_spec.rb in markaby-0.7.0 vs spec/markaby/rails_spec.rb in markaby-0.7.1

- old
+ new

@@ -151,10 +151,18 @@ end render :layout => "layout.mab", :template => "markaby/double_output" end + + def renders_form_for_with_erb_body + @obj = Object.new + + def @obj.foo + "bar" + end + end end class MarkabyOnRailsTest < ActionController::TestCase def setup Markaby::Builder.restore_defaults! @@ -252,11 +260,11 @@ def test_routes_work get :routes assert_response :success - expected_output = "<a href=\"/users/new\">Foo</a>" + expected_output = '<a href="/users/new">Foo</a>' assert_equal expected_output, @response.body end def test_commented_out_template_cant_raise_errors get :commented_out_template @@ -278,23 +286,23 @@ def test_renders_form_for_with_fields_for get :render_form_for_with_fields assert_response :success - assert_equal "<form action=\"/markaby/render_form_for_with_fields\" method=\"post\"><input id=\"foo_foo\" name=\"foo[foo]\" size=\"30\" type=\"text\" /></form>", + assert_equal '<form action="/markaby/render_form_for_with_fields" method="post"><input id="foo_foo" name="foo[foo]" size="30" type="text" /></form>', @response.body end def test_renders_form_for_with_multiple_fields get :render_form_for_with_multiple_fields assert_response :success - expected_output = "<form action=\"/markaby/render_form_for_with_multiple_fields\" method=\"post\">" - expected_output << "<input id=\"foo_foo\" name=\"foo[foo]\" size=\"30\" type=\"text\" />" - expected_output << "<input id=\"foo_baz\" name=\"foo[baz]\" size=\"30\" type=\"text\" />" - expected_output << "</form>" + expected_output = '<form action="/markaby/render_form_for_with_multiple_fields" method="post">' + expected_output << '<input id="foo_foo" name="foo[foo]" size="30" type="text" />' + expected_output << '<input id="foo_baz" name="foo[baz]" size="30" type="text" />' + expected_output << '</form>' assert_equal expected_output, @response.body end @@ -347,9 +355,20 @@ expected_output << '</p>' expected_output << '</form>' expected_output << '</div>' assert_equal expected_output, @response.body + end + + def test_renders_form_for_with_erb_render_in_body + get :renders_form_for_with_erb_body + assert_response :success + + str = '<form action="/markaby/renders_form_for_with_erb_body" method="post">' + str << '<input id="foo_foo" name="foo[foo]" size="30" type="text" />' + str << '</form>' + + assert_equal str, @response.body end end end describe "rails version" do