diff options
author | Andrew White <andyw@pixeltrix.co.uk> | 2010-04-11 09:27:45 +0100 |
---|---|---|
committer | José Valim <jose.valim@gmail.com> | 2010-04-12 10:57:27 +0200 |
commit | 788d9238931bb36ed2af78d34c84562dc3a4848c (patch) | |
tree | d3ce4f2535226bcbb273b0cc024b60b2d12beea8 /railties/test | |
parent | b9b9f9ee15e2282e9c765d86cb8b6120e2bdb1b9 (diff) | |
download | rails-788d9238931bb36ed2af78d34c84562dc3a4848c.tar.gz rails-788d9238931bb36ed2af78d34c84562dc3a4848c.tar.bz2 rails-788d9238931bb36ed2af78d34c84562dc3a4848c.zip |
Generate module file for namespaced models [#4230 state:resolved]
Signed-off-by: José Valim <jose.valim@gmail.com>
Diffstat (limited to 'railties/test')
-rw-r--r-- | railties/test/generators/model_generator_test.rb | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/railties/test/generators/model_generator_test.rb b/railties/test/generators/model_generator_test.rb index f5cfd8eeca..ef415a4fed 100644 --- a/railties/test/generators/model_generator_test.rb +++ b/railties/test/generators/model_generator_test.rb @@ -27,6 +27,14 @@ class ModelGeneratorTest < Rails::Generators::TestCase assert_file "app/models/account.rb", /class Account < Admin::Account/ end + def test_model_with_namespace + run_generator ["admin/account"] + assert_file "app/models/admin.rb", /module Admin/ + assert_file "app/models/admin.rb", /def self\.table_name_prefix/ + assert_file "app/models/admin.rb", /'admin_'/ + assert_file "app/models/admin/account.rb", /class Admin::Account < ActiveRecord::Base/ + end + def test_migration run_generator assert_migration "db/migrate/create_accounts.rb", /class CreateAccounts < ActiveRecord::Migration/ |