Merge pull request #18358 from prathamesh-sonpatki/add-test-for-non-string-labeled-fixtures
Fix lookup of fixtures with non-string(like Fixnum) label
This commit is contained in:
commit
dd54b518ce
@ -1,3 +1,7 @@
|
||||
* Fix accessing of fixtures having non-string labels like Fixnum.
|
||||
|
||||
*Prathamesh Sonpatki*
|
||||
|
||||
* Remove deprecated support to preload instance-dependent associations.
|
||||
|
||||
*Yves Senn*
|
||||
|
@ -882,7 +882,7 @@ def setup_fixture_accessors(fixture_set_names = nil)
|
||||
@fixture_cache[fs_name] ||= {}
|
||||
|
||||
instances = fixture_names.map do |f_name|
|
||||
f_name = f_name.to_s
|
||||
f_name = f_name.to_s if f_name.is_a?(Symbol)
|
||||
@fixture_cache[fs_name].delete(f_name) if force_reload
|
||||
|
||||
if @loaded_fixtures[fs_name][f_name]
|
||||
|
@ -792,6 +792,10 @@ def test_supports_label_string_interpolation
|
||||
assert_equal("X marks the spot!", pirates(:mark).catchphrase)
|
||||
end
|
||||
|
||||
def test_supports_label_interpolation_for_fixnum_label
|
||||
assert_equal("#1 pirate!", pirates(1).catchphrase)
|
||||
end
|
||||
|
||||
def test_supports_polymorphic_belongs_to
|
||||
assert_equal(pirates(:redbeard), treasures(:sapphire).looter)
|
||||
assert_equal(parrots(:louis), treasures(:ruby).looter)
|
||||
|
3
activerecord/test/fixtures/pirates.yml
vendored
3
activerecord/test/fixtures/pirates.yml
vendored
@ -10,3 +10,6 @@ redbeard:
|
||||
|
||||
mark:
|
||||
catchphrase: "X $LABELs the spot!"
|
||||
|
||||
1:
|
||||
catchphrase: "#$LABEL pirate!"
|
||||
|
Loading…
Reference in New Issue
Block a user