lib/parallel_rspec/tasks.rake in parallel_rspec-1.2.0 vs lib/parallel_rspec/tasks.rake in parallel_rspec-2.0.0

- old
+ new

@@ -20,11 +20,15 @@ task :load_schema => %w(db:parallel:purge) do should_reconnect = ActiveRecord::Base.connection_pool.active_connection? begin ParallelRSpec::Workers.new.run_test_workers do |worker| ActiveRecord::Schema.verbose = false - ActiveRecord::Tasks::DatabaseTasks.load_schema_for ActiveRecord::Base.configurations['test'], :ruby, ENV['SCHEMA'] + if ActiveRecord::Tasks::DatabaseTasks.respond_to?(:load_schema_current) + ActiveRecord::Tasks::DatabaseTasks.load_schema_current :ruby, ENV['SCHEMA'], 'test' + else + ActiveRecord::Tasks::DatabaseTasks.load_schema_for ActiveRecord::Base.configurations['test'], :ruby, ENV['SCHEMA'] + end end ensure if should_reconnect ActiveRecord::Base.establish_connection(ActiveRecord::Base.configurations['test']) end @@ -32,10 +36,14 @@ end # desc "Recreate the test database from an existent structure.sql file" task :load_structure => %w(db:parallel:purge) do ParallelRSpec::Workers.new.run_test_workers do |worker| - ActiveRecord::Tasks::DatabaseTasks.load_schema_for ActiveRecord::Base.configurations['test'], :sql, ENV['SCHEMA'] + if ActiveRecord::Tasks::DatabaseTasks.respond_to?(:load_schema_current) + ActiveRecord::Tasks::DatabaseTasks.load_schema_current :sql, ENV['SCHEMA'], 'test' + else + ActiveRecord::Tasks::DatabaseTasks.load_schema_for ActiveRecord::Base.configurations['test'], :sql, ENV['SCHEMA'] + end end end # desc "Recreate the test database from the current schema" task :load do