Permalink
Browse files

Fix that label_tag doesn't take a symbol for a name. [#719 state:reso…

…lved]

Signed-off-by: Pratik Naik <pratiknaik@gmail.com>
  • Loading branch information...
1 parent 2cf161a commit 7aaf1689dda863b72623f0e52ad87e2b739cb22b @DefV DefV committed with lifo Jul 29, 2008
@@ -129,7 +129,7 @@ def text_field_tag(name, value = nil, options = {})
# label_tag 'name', nil, :class => 'small_label'
# # => <label for="name" class="small_label">Name</label>
def label_tag(name, text = nil, options = {})
- content_tag :label, text || name.humanize, { "for" => name }.update(options.stringify_keys)
+ content_tag :label, text || name.to_s.humanize, { "for" => name }.update(options.stringify_keys)
end
# Creates a hidden form input field used to transmit data that would be lost due to HTTP's statelessness or
@@ -190,6 +190,12 @@ def test_label_tag_without_text
assert_dom_equal expected, actual
end
+ def test_label_tag_with_symbol
+ actual = label_tag :title
+ expected = %(<label for="title">Title</label>)
+ assert_dom_equal expected, actual
+ end
+
def test_label_tag_with_text
actual = label_tag "title", "My Title"
expected = %(<label for="title">My Title</label>)

0 comments on commit 7aaf168

Please sign in to comment.