mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
added failing test for fields_for with a record object that inherits from Hash
Signed-off-by: Andrew White <andyw@pixeltrix.co.uk>
This commit is contained in:
parent
74818a3543
commit
dff73dec22
1 changed files with 19 additions and 0 deletions
|
@ -1,6 +1,12 @@
|
|||
require 'abstract_unit'
|
||||
require 'tzinfo'
|
||||
|
||||
class Map < Hash
|
||||
def category
|
||||
"<mus>"
|
||||
end
|
||||
end
|
||||
|
||||
TZInfo::Timezone.cattr_reader :loaded_zones
|
||||
|
||||
class FormOptionsHelperTest < ActionView::TestCase
|
||||
|
@ -394,6 +400,19 @@ class FormOptionsHelperTest < ActionView::TestCase
|
|||
)
|
||||
end
|
||||
|
||||
def test_fields_for_with_record_inherited_from_hash
|
||||
map = Map.new
|
||||
|
||||
output_buffer = fields_for :map, map do |f|
|
||||
concat f.select(:category, %w( abe <mus> hest))
|
||||
end
|
||||
|
||||
assert_dom_equal(
|
||||
"<select id=\"map_category\" name=\"map[category]\"><option value=\"abe\">abe</option>\n<option value=\"<mus>\" selected=\"selected\"><mus></option>\n<option value=\"hest\">hest</option></select>",
|
||||
output_buffer
|
||||
)
|
||||
end
|
||||
|
||||
def test_select_under_fields_for_with_index
|
||||
@post = Post.new
|
||||
@post.category = "<mus>"
|
||||
|
|
Loading…
Reference in a new issue