From ff7ab3bc78abc3e8439a57ef7d755c5aa5b069f4 Mon Sep 17 00:00:00 2001 From: Jon Leighton Date: Sun, 29 Dec 2013 11:05:04 +0000 Subject: Automatically maintain test database schema * Move check from generated helper to test_help.rb, so that all applications can benefit * Rather than just raising when the test schema has pending migrations, try to load in the schema and only raise if there are pending migrations afterwards * Opt out of the check by setting config.active_record.maintain_test_schema = false * Deprecate db:test:* tasks. The test helper is now fully responsible for maintaining the test schema, so we don't need rake tasks for this. This is also a speed improvement since we're no longer reloading the test database on every call to "rake test". --- railties/test/application/rake/dbs_test.rb | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'railties/test/application/rake') diff --git a/railties/test/application/rake/dbs_test.rb b/railties/test/application/rake/dbs_test.rb index 3dce315d3a..66d3137df0 100644 --- a/railties/test/application/rake/dbs_test.rb +++ b/railties/test/application/rake/dbs_test.rb @@ -174,6 +174,15 @@ module ApplicationTests require "#{app_path}/config/environment" db_test_load_structure end + + test 'db:test deprecation' do + require "#{app_path}/config/environment" + Dir.chdir(app_path) do + output = `bundle exec rake db:migrate db:test:prepare 2>&1` + assert_equal "WARNING: db:test:prepare is deprecated. The Rails test helper now maintains " \ + "your test schema automatically, see the release notes for details.\n", output + end + end end end end -- cgit v1.2.3