aboutsummaryrefslogtreecommitdiffstats
path: root/railties/test/application
diff options
context:
space:
mode:
authorGenadi Samokovarov <gsamokovarov@gmail.com>2015-12-12 14:25:00 +0100
committerGenadi Samokovarov <gsamokovarov@gmail.com>2015-12-16 10:30:09 +0100
commit2067fff9e38df4e37bdbfc021cd6bb0c2d393a2a (patch)
tree18c5067747cc422aed35dce0417f14ddf36346a7 /railties/test/application
parente73fe1dd8c2740ae29e7a7f48d71a62b46e6b49d (diff)
downloadrails-2067fff9e38df4e37bdbfc021cd6bb0c2d393a2a.tar.gz
rails-2067fff9e38df4e37bdbfc021cd6bb0c2d393a2a.tar.bz2
rails-2067fff9e38df4e37bdbfc021cd6bb0c2d393a2a.zip
Introduce ApplicationRecord, an Active Record layer supertype
It's pretty common for folks to monkey patch `ActiveRecord::Base` to work around an issue or introduce extra functionality. Instead of shoving even more stuff in `ActiveRecord::Base`, `ApplicationRecord` can hold all those custom work the apps may need. Now, we don't wanna encourage all of the application models to inherit from `ActiveRecord::Base`, but we can encourage all the models that do, to inherit from `ApplicationRecord`. Newly generated applications have `app/models/application_record.rb` present by default. The model generators are smart enough to recognize that newly generated models have to inherit from `ApplicationRecord`, but only if it's present.
Diffstat (limited to 'railties/test/application')
-rw-r--r--railties/test/application/configuration_test.rb1
-rw-r--r--railties/test/application/rake_test.rb2
2 files changed, 2 insertions, 1 deletions
diff --git a/railties/test/application/configuration_test.rb b/railties/test/application/configuration_test.rb
index 25e749ac14..87e28288ee 100644
--- a/railties/test/application/configuration_test.rb
+++ b/railties/test/application/configuration_test.rb
@@ -228,6 +228,7 @@ module ApplicationTests
end
test "the application can be eager loaded even when there are no frameworks" do
+ FileUtils.rm_rf("#{app_path}/app/models/application_record.rb")
FileUtils.rm_rf("#{app_path}/config/environments")
add_to_config <<-RUBY
config.eager_load = true
diff --git a/railties/test/application/rake_test.rb b/railties/test/application/rake_test.rb
index 0da0928b48..1b009e0742 100644
--- a/railties/test/application/rake_test.rb
+++ b/railties/test/application/rake_test.rb
@@ -98,7 +98,7 @@ module ApplicationTests
end
def test_code_statistics_sanity
- assert_match "Code LOC: 7 Test LOC: 0 Code to Test Ratio: 1:0.0",
+ assert_match "Code LOC: 10 Test LOC: 0 Code to Test Ratio: 1:0.0",
Dir.chdir(app_path){ `bin/rake stats` }
end