diff options
Diffstat (limited to 'railties/test/generators/model_generator_test.rb')
-rw-r--r-- | railties/test/generators/model_generator_test.rb | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/railties/test/generators/model_generator_test.rb b/railties/test/generators/model_generator_test.rb index 0c7ff0ebe7..70e080a8ab 100644 --- a/railties/test/generators/model_generator_test.rb +++ b/railties/test/generators/model_generator_test.rb @@ -273,6 +273,16 @@ class ModelGeneratorTest < Rails::Generators::TestCase assert_file "test/fixtures/accounts.yml", /name: MyString/, /age: 1/ end + def test_fixtures_use_the_references_ids + run_generator ["LineItem", "product:references", "cart:belongs_to"] + assert_file "test/fixtures/line_items.yml", /product_id: \n cart_id: / + end + + def test_fixtures_use_the_references_ids_and_type + run_generator ["LineItem", "product:references{polymorphic}", "cart:belongs_to"] + assert_file "test/fixtures/line_items.yml", /product_id: \n product_type: Product\n cart_id: / + end + def test_fixture_is_skipped run_generator ["account", "--skip-fixture"] assert_no_file "test/fixtures/accounts.yml" |