X-Git-Url: https://git.arvados.org/arvados.git/blobdiff_plain/9c5fbffbcbb1301572b3de3fb45d11de58d93212..39a1340d56f7acbddb771f6bef36b68ee9076885:/services/api/Rakefile diff --git a/services/api/Rakefile b/services/api/Rakefile index c4b921745f..22b25313a5 100644 --- a/services/api/Rakefile +++ b/services/api/Rakefile @@ -4,21 +4,31 @@ require File.expand_path('../config/application', __FILE__) +begin + ok = PgPower +rescue + abort "Hm, pg_power is missing. Make sure you use 'bundle exec rake ...'" +end + Server::Application.load_tasks -# http://www.pervasivecode.com/blog/2007/09/22/making-rails-raketest-not-drop-your-pgsql-database/ -# -# don't drop the test database; migrate it back to 0 -Rake::TaskManager.class_eval do - def delete_task(task_name) - @tasks.delete(task_name.to_s) - end - Rake.application.delete_task("db:test:purge") -end -namespace :db do - namespace :test do - task :purge do - ActiveRecord::Migrator.migrate("db/migrate/", 0) - end +namespace :test do + task(:run).clear + # Copied from the definition in Rails 3.2. + # This may need to be updated if we upgrade Rails. + task :run do + errors = %w(test:units test:functionals test:integration test:tasks).collect do |task| + begin + Rake::Task[task].invoke + nil + rescue => e + { :task => task, :exception => e } + end + end.compact + + if errors.any? + puts errors.map { |e| "Errors running #{e[:task]}! #{e[:exception].inspect}" }.join("\n") + abort end + end end