diff options
author | Rafael França <rafaelmfranca@gmail.com> | 2015-12-16 14:37:57 -0200 |
---|---|---|
committer | Rafael França <rafaelmfranca@gmail.com> | 2015-12-16 14:37:57 -0200 |
commit | 1d7d8062b2576f835f5475e4adad0bb79e53f8ad (patch) | |
tree | 87bbbc5278ccb4ea69b2cf1bb21dbfab203abc52 /railties/test/generators | |
parent | 371e357065edf362144af7f44b7ff0755d1b0165 (diff) | |
parent | 2067fff9e38df4e37bdbfc021cd6bb0c2d393a2a (diff) | |
download | rails-1d7d8062b2576f835f5475e4adad0bb79e53f8ad.tar.gz rails-1d7d8062b2576f835f5475e4adad0bb79e53f8ad.tar.bz2 rails-1d7d8062b2576f835f5475e4adad0bb79e53f8ad.zip |
Merge pull request #22567 from gsamokovarov/introduce-application-record
Introduce ApplicationRecord, an Active Record layer supertype
Diffstat (limited to 'railties/test/generators')
-rw-r--r-- | railties/test/generators/app_generator_test.rb | 1 | ||||
-rw-r--r-- | railties/test/generators/model_generator_test.rb | 11 |
2 files changed, 12 insertions, 0 deletions
diff --git a/railties/test/generators/app_generator_test.rb b/railties/test/generators/app_generator_test.rb index dd2e931c5c..3f2ac3d2b6 100644 --- a/railties/test/generators/app_generator_test.rb +++ b/railties/test/generators/app_generator_test.rb @@ -334,6 +334,7 @@ class AppGeneratorTest < Rails::Generators::TestCase run_generator [destination_root, "--skip-active-record"] assert_no_file "config/database.yml" assert_no_file "config/initializers/active_record_belongs_to_required_by_default.rb" + assert_no_file "app/models/application_record.rb" assert_file "config/application.rb", /#\s+require\s+["']active_record\/railtie["']/ assert_file "test/test_helper.rb" do |helper_content| assert_no_match(/fixtures :all/, helper_content) diff --git a/railties/test/generators/model_generator_test.rb b/railties/test/generators/model_generator_test.rb index e1722b84b3..fb502ec0c5 100644 --- a/railties/test/generators/model_generator_test.rb +++ b/railties/test/generators/model_generator_test.rb @@ -35,6 +35,17 @@ class ModelGeneratorTest < Rails::Generators::TestCase assert_no_migration "db/migrate/create_accounts.rb" end + def test_model_with_existent_application_record + mkdir_p "#{destination_root}/app/models" + touch "#{destination_root}/app/models/application_record.rb" + + Dir.chdir(destination_root) do + run_generator ["account"] + end + + assert_file "app/models/account.rb", /class Account < ApplicationRecord/ + end + def test_plural_names_are_singularized content = run_generator ["accounts".freeze] assert_file "app/models/account.rb", /class Account < ActiveRecord::Base/ |