diff options
Diffstat (limited to 'railties/test')
-rw-r--r-- | railties/test/generators/resource_generator_test.rb | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/railties/test/generators/resource_generator_test.rb b/railties/test/generators/resource_generator_test.rb index 456e6ff3ea..53e9a1e817 100644 --- a/railties/test/generators/resource_generator_test.rb +++ b/railties/test/generators/resource_generator_test.rb @@ -86,6 +86,20 @@ class ResourceGeneratorTest < GeneratorsTestCase end end + def test_plural_names_are_singularized + content = run_generator ["accounts"] + assert_file "app/models/account.rb", /class Account < ActiveRecord::Base/ + assert_file "test/unit/account_test.rb", /class AccountTest/ + assert_match /Plural version of the model detected, using singularized version. Override with --force-plural./, content + end + + def test_plural_names_can_be_forced + content = run_generator ["accounts", "--force-plural"] + assert_file "app/models/accounts.rb", /class Accounts < ActiveRecord::Base/ + assert_file "test/unit/accounts_test.rb", /class AccountsTest/ + assert_no_match /Plural version of the model detected/, content + end + protected def run_generator(args=["account"]) |