diff options
author | Godfrey Chan <godfreykfc@gmail.com> | 2014-02-22 23:44:08 -0800 |
---|---|---|
committer | Godfrey Chan <godfreykfc@gmail.com> | 2014-02-22 23:44:08 -0800 |
commit | f8dcc485175d7e5ac3c5d2819b3a04cd2e5d4982 (patch) | |
tree | 556a0bd6459640c83a542759950e278331a04765 /railties/test | |
parent | 624f8557b70b3ef2e12f6264938a95bdd97c8355 (diff) | |
parent | de8bef98785a78332db037b1cd6f602b2a30026d (diff) | |
download | rails-f8dcc485175d7e5ac3c5d2819b3a04cd2e5d4982.tar.gz rails-f8dcc485175d7e5ac3c5d2819b3a04cd2e5d4982.tar.bz2 rails-f8dcc485175d7e5ac3c5d2819b3a04cd2e5d4982.zip |
Merge pull request #13515 from kuldeepaggarwal/f-model-generation
Added warning when user tried to create model with pluralize name.
Diffstat (limited to 'railties/test')
-rw-r--r-- | railties/test/generators/model_generator_test.rb | 7 | ||||
-rw-r--r-- | railties/test/generators/resource_generator_test.rb | 2 |
2 files changed, 8 insertions, 1 deletions
diff --git a/railties/test/generators/model_generator_test.rb b/railties/test/generators/model_generator_test.rb index 01ab77ee20..cf307d23e1 100644 --- a/railties/test/generators/model_generator_test.rb +++ b/railties/test/generators/model_generator_test.rb @@ -34,6 +34,13 @@ class ModelGeneratorTest < Rails::Generators::TestCase assert_no_migration "db/migrate/create_accounts.rb" end + def test_plural_names_are_singularized + content = run_generator ["accounts".freeze] + assert_file "app/models/account.rb", /class Account < ActiveRecord::Base/ + assert_file "test/models/account_test.rb", /class AccountTest/ + assert_match(/Plural version of the model detected, using singularized version. Override with --force-plural or setup custom inflection rules for this noun before running the generator./, content) + end + def test_model_with_underscored_parent_option run_generator ["account", "--parent", "admin/account"] assert_file "app/models/account.rb", /class Account < Admin::Account/ diff --git a/railties/test/generators/resource_generator_test.rb b/railties/test/generators/resource_generator_test.rb index 3d4e694361..297cf99998 100644 --- a/railties/test/generators/resource_generator_test.rb +++ b/railties/test/generators/resource_generator_test.rb @@ -63,7 +63,7 @@ class ResourceGeneratorTest < Rails::Generators::TestCase content = run_generator ["accounts".freeze] assert_file "app/models/account.rb", /class Account < ActiveRecord::Base/ assert_file "test/models/account_test.rb", /class AccountTest/ - assert_match(/Plural version of the model detected, using singularized version. Override with --force-plural./, content) + assert_match(/Plural version of the model detected, using singularized version. Override with --force-plural or setup custom inflection rules for this noun before running the generator./, content) end def test_plural_names_can_be_forced |