Skip to content

Instantly share code, notes, and snippets.

@dcaliri
Created August 25, 2010 20:41
Show Gist options
  • Save dcaliri/550250 to your computer and use it in GitHub Desktop.
Save dcaliri/550250 to your computer and use it in GitHub Desktop.
def test_form_for_deprecated
assert_deprecated do
form_for(:post, @post, :html => { :id => 'create-post' }) do |f|
concat f.label(:title) { "The Title" }
concat f.text_field(:title)
concat f.text_area(:body)
concat f.check_box(:secret)
concat f.submit('Create post')
end
end
expected =
"<form accept-charset='UTF-8' action='http://www.example.com' id='create-post' method='post'>" +
snowman +
"<label for='post_title'>The Title</label>" +
"<input name='post[title]' size='30' type='text' id='post_title' value='Hello World' />" +
"<textarea name='post[body]' id='post_body' rows='20' cols='40'>Back to the hill and over it again!</textarea>" +
"<input name='post[secret]' type='hidden' value='0' />" +
"<input name='post[secret]' checked='checked' type='checkbox' id='post_secret' value='1' />" +
"<input name='commit' id='post_submit' type='submit' value='Create post' />" +
"</form>"
assert_dom_equal expected, output_buffer
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment