From dec1ee7422417c38cdcbea428d922c67eb3e708f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Valim?= Date: Tue, 30 Jun 2009 08:49:25 +0200 Subject: Started with scaffold controller and added remove_hook_for. --- railties/test/generators/resource_generator_test.rb | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'railties/test') 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"]) -- cgit v1.2.3