lib/parallel_tests/tasks.rb in parallel_tests-0.15.1 vs lib/parallel_tests/tasks.rb in parallel_tests-0.15.2
- old
+ new
@@ -36,13 +36,15 @@
command
end
end
def check_for_pending_migrations
- abort_migrations = "db:abort_if_pending_migrations"
- if Rake::Task.task_defined?(abort_migrations)
- Rake::Task[abort_migrations].invoke
+ ["db:abort_if_pending_migrations", "app:db:abort_if_pending_migrations"].each do |abort_migrations|
+ if Rake::Task.task_defined?(abort_migrations)
+ Rake::Task[abort_migrations].invoke
+ break
+ end
end
end
# parallel:spec[:count, :pattern, :options]
def parse_args(args)
@@ -82,10 +84,11 @@
Rake::Task['db:schema:dump'].invoke
Rake::Task['parallel:load_schema'].invoke(args[:count])
else
# there is no separate dump / load for schema_format :sql -> do it safe and slow
args = args.to_hash.merge(:non_parallel => true) # normal merge returns nil
- ParallelTests::Tasks.run_in_parallel('rake db:test:prepare --trace', args)
+ taskname = Rake::Task.task_defined?('db:test:prepare') ? 'db:test:prepare' : 'app:db:test:prepare'
+ ParallelTests::Tasks.run_in_parallel("rake #{taskname} --trace", args)
end
end
# when dumping/resetting takes too long
desc "update test databases via db:migrate --> parallel:migrate[num_cpus]"