aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorkennyj <kennyj@gmail.com>2012-06-26 02:40:06 +0900
committerkennyj <kennyj@gmail.com>2012-06-26 04:06:45 +0900
commit0ebd4f22c52c32564dddfd4c867925e8aa6b25e1 (patch)
treec677ea48ac4fd1c3becc3b921364e01cb891b21e
parent9ab805d8809c11e6bc1d8db30f839e8c66dc66c0 (diff)
downloadrails-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.rake2
-rw-r--r--railties/test/application/rake_test.rb9
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