diff options
author | kennyj <kennyj@gmail.com> | 2012-06-26 02:40:06 +0900 |
---|---|---|
committer | kennyj <kennyj@gmail.com> | 2012-06-26 04:06:45 +0900 |
commit | 0ebd4f22c52c32564dddfd4c867925e8aa6b25e1 (patch) | |
tree | c677ea48ac4fd1c3becc3b921364e01cb891b21e | |
parent | 9ab805d8809c11e6bc1d8db30f839e8c66dc66c0 (diff) | |
download | rails-0ebd4f22c52c32564dddfd4c867925e8aa6b25e1.tar.gz rails-0ebd4f22c52c32564dddfd4c867925e8aa6b25e1.tar.bz2 rails-0ebd4f22c52c32564dddfd4c867925e8aa6b25e1.zip |
Change the behavior of db:test:prepare task when schema_format is sql for consistency.
-rw-r--r-- | activerecord/lib/active_record/railties/databases.rake | 2 | ||||
-rw-r--r-- | railties/test/application/rake_test.rb | 9 |
2 files changed, 10 insertions, 1 deletions
diff --git a/activerecord/lib/active_record/railties/databases.rake b/activerecord/lib/active_record/railties/databases.rake index da6ba6eae2..7d683519b7 100644 --- a/activerecord/lib/active_record/railties/databases.rake +++ b/activerecord/lib/active_record/railties/databases.rake @@ -399,7 +399,7 @@ db_namespace = namespace :db do # desc 'Check for pending migrations and load the test schema' task :prepare => 'db:abort_if_pending_migrations' do unless ActiveRecord::Base.configurations.blank? - db_namespace[{ :sql => 'test:clone_structure', :ruby => 'test:load' }[ActiveRecord::Base.schema_format]].invoke + db_namespace['test:load'].invoke end end end diff --git a/railties/test/application/rake_test.rb b/railties/test/application/rake_test.rb index 7e33c80a12..6bb50fea19 100644 --- a/railties/test/application/rake_test.rb +++ b/railties/test/application/rake_test.rb @@ -153,6 +153,15 @@ module ApplicationTests assert_match(/Execute db:test:clone_structure/, output) end + def test_db_test_prepare_when_using_sql_format + add_to_config "config.active_record.schema_format = :sql" + output = Dir.chdir(app_path) do + `rails generate scaffold user username:string; + bundle exec rake db:migrate db:test:clone 2>&1 --trace` + end + assert_match(/Execute db:test:load_structure/, output) + end + def test_rake_dump_structure_should_respect_db_structure_env_variable Dir.chdir(app_path) do # ensure we have a schema_migrations table to dump |