1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00

rake:db:test:prepare falls back to original environment after execution.

This commit is contained in:
markevich 2013-05-02 18:09:59 +03:00
parent ca2bc303a9
commit 56445c9075
2 changed files with 11 additions and 3 deletions

View file

@ -35,5 +35,9 @@
* Abort a rake task when missing db/structure.sql like `db:schema:load` task.
*kennyj*
* rake:db:test:prepare falls back to original environment after execution.
*Slava Markevich*
Please check [4-0-stable](https://github.com/rails/rails/blob/4-0-stable/activerecord/CHANGELOG.md) for previous changes.

View file

@ -319,9 +319,13 @@ db_namespace = namespace :db do
# desc "Recreate the test database from an existent schema.rb file"
task :load_schema => 'db:test:purge' do
ActiveRecord::Base.establish_connection(ActiveRecord::Base.configurations['test'])
ActiveRecord::Schema.verbose = false
db_namespace["schema:load"].invoke
begin
ActiveRecord::Base.establish_connection(ActiveRecord::Base.configurations['test'])
ActiveRecord::Schema.verbose = false
db_namespace["schema:load"].invoke
ensure
ActiveRecord::Base.establish_connection(ActiveRecord::Base.configurations[Rails.env])
end
end
# desc "Recreate the test database from an existent structure.sql file"