From f47421f2a058a5ca845969e8d15be2028c3e6972 Mon Sep 17 00:00:00 2001 From: Eric Steele Date: Sat, 15 Mar 2014 21:49:04 -0400 Subject: Extend fixture label replacement to allow string interpolation Allows fixtures to use their $LABEL as part of a string instead of limiting use to the entire value. mark: first_name: $LABEL username: $LABEL1973 email: $LABEL@$LABELmail.com users(:mark).first_name # => mark users(:mark).username # => mark1973 users(:mark).email # => mark@markmail.com --- activerecord/test/cases/fixtures_test.rb | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'activerecord/test/cases/fixtures_test.rb') diff --git a/activerecord/test/cases/fixtures_test.rb b/activerecord/test/cases/fixtures_test.rb index 37c6af74da..1147418815 100644 --- a/activerecord/test/cases/fixtures_test.rb +++ b/activerecord/test/cases/fixtures_test.rb @@ -782,6 +782,10 @@ class FoxyFixturesTest < ActiveRecord::TestCase assert_equal("frederick", parrots(:frederick).name) end + def test_supports_label_string_interpolation + assert_equal("X marks the spot!", pirates(:mark).catchphrase) + end + def test_supports_polymorphic_belongs_to assert_equal(pirates(:redbeard), treasures(:sapphire).looter) assert_equal(parrots(:louis), treasures(:ruby).looter) -- cgit v1.2.3