mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
Change the behavior of db:test:prepare task when schema_format is sql for consistency.
This commit is contained in:
parent
9ab805d880
commit
0ebd4f22c5
2 changed files with 10 additions and 1 deletions
|
@ -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 @@ 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
|
||||
|
|
Loading…
Reference in a new issue