diff options
author | David Heinemeier Hansson <david@loudthinking.com> | 2016-02-10 17:23:30 +0100 |
---|---|---|
committer | David Heinemeier Hansson <david@loudthinking.com> | 2016-02-10 17:23:30 +0100 |
commit | 437a7a406c408f106a6ae5d89a5d012106a74e39 (patch) | |
tree | 98566250c3afaf73ace317533c04dcdfad96eeac /railties/test/generators | |
parent | 31778a34a8c6e1d186c1e807491c1f44c5f07357 (diff) | |
parent | 00c64e8ae2c312139e5a242331d3919fe139b87c (diff) | |
download | rails-437a7a406c408f106a6ae5d89a5d012106a74e39.tar.gz rails-437a7a406c408f106a6ae5d89a5d012106a74e39.tar.bz2 rails-437a7a406c408f106a6ae5d89a5d012106a74e39.zip |
Merge pull request #23512 from y-yagi/set_association_name_to_fixture
set association name to generated fixtures if attribute is reference
Diffstat (limited to 'railties/test/generators')
-rw-r--r-- | railties/test/generators/model_generator_test.rb | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/railties/test/generators/model_generator_test.rb b/railties/test/generators/model_generator_test.rb index 814f4c050e..c8c8f0aa3b 100644 --- a/railties/test/generators/model_generator_test.rb +++ b/railties/test/generators/model_generator_test.rb @@ -298,18 +298,18 @@ class ModelGeneratorTest < Rails::Generators::TestCase def test_fixtures_use_the_references_ids run_generator ["LineItem", "product:references", "cart:belongs_to"] - assert_file "test/fixtures/line_items.yml", /product: \n cart: / + assert_file "test/fixtures/line_items.yml", /product: one\n cart: one/ assert_generated_fixture("test/fixtures/line_items.yml", - {"one"=>{"product"=>nil, "cart"=>nil}, "two"=>{"product"=>nil, "cart"=>nil}}) + {"one"=>{"product"=>"one", "cart"=>"one"}, "two"=>{"product"=>"two", "cart"=>"two"}}) 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: \n product_type: Product\n cart: / + assert_file "test/fixtures/line_items.yml", /product: one\n product_type: Product\n cart: one/ assert_generated_fixture("test/fixtures/line_items.yml", - {"one"=>{"product"=>nil, "product_type"=>"Product", "cart"=>nil}, - "two"=>{"product"=>nil, "product_type"=>"Product", "cart"=>nil}}) + {"one"=>{"product"=>"one", "product_type"=>"Product", "cart"=>"one"}, + "two"=>{"product"=>"two", "product_type"=>"Product", "cart"=>"two"}}) end def test_fixtures_respect_reserved_yml_keywords |