Permalink
Browse files

Change the behavior of db:test:prepare task when schema_format is sql…

… for consistency.
  • Loading branch information...
1 parent 9ab805d commit 0ebd4f22c52c32564dddfd4c867925e8aa6b25e1 @kennyj kennyj committed Jun 25, 2012
@@ -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
@@ -153,6 +153,15 @@ def test_db_test_clone_when_using_sql_format
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

0 comments on commit 0ebd4f2

Please sign in to comment.