diff options
author | Rafael França <rafaelmfranca@gmail.com> | 2019-04-15 18:11:55 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-04-15 18:11:55 -0400 |
commit | fbb8b68403ff8663a561b20746e9da7719eeb83e (patch) | |
tree | 37dbbe6f90573b0b1b443a228b70abcdb2b7eea1 /railties | |
parent | ddf471a163e96e52e1a1cc507bde5a0cfe9f643f (diff) | |
parent | 76c1528c5fd372af080081873b1ba02582c51f25 (diff) | |
download | rails-fbb8b68403ff8663a561b20746e9da7719eeb83e.tar.gz rails-fbb8b68403ff8663a561b20746e9da7719eeb83e.tar.bz2 rails-fbb8b68403ff8663a561b20746e9da7719eeb83e.zip |
Merge pull request #35977 from prathamesh-sonpatki/rm-required-in-generators
Remove `required: true` from the model generator template
Diffstat (limited to 'railties')
-rw-r--r-- | railties/test/generators/model_generator_test.rb | 15 |
1 files changed, 2 insertions, 13 deletions
diff --git a/railties/test/generators/model_generator_test.rb b/railties/test/generators/model_generator_test.rb index c97cd17ec6..1b86e509ee 100644 --- a/railties/test/generators/model_generator_test.rb +++ b/railties/test/generators/model_generator_test.rb @@ -414,23 +414,12 @@ class ModelGeneratorTest < Rails::Generators::TestCase end end - def test_required_belongs_to_adds_required_association - run_generator ["account", "supplier:references{required}"] - - expected_file = <<~FILE - class Account < ApplicationRecord - belongs_to :supplier, required: true - end - FILE - assert_file "app/models/account.rb", expected_file - end - def test_required_polymorphic_belongs_to_generages_correct_model run_generator ["account", "supplier:references{required,polymorphic}"] expected_file = <<~FILE class Account < ApplicationRecord - belongs_to :supplier, polymorphic: true, required: true + belongs_to :supplier, polymorphic: true end FILE assert_file "app/models/account.rb", expected_file @@ -441,7 +430,7 @@ class ModelGeneratorTest < Rails::Generators::TestCase expected_file = <<~FILE class Account < ApplicationRecord - belongs_to :supplier, polymorphic: true, required: true + belongs_to :supplier, polymorphic: true end FILE assert_file "app/models/account.rb", expected_file |