namespace :test do
  desc "Test the core plugins and the main application"  
  task :the_lot do
      had_errors = false

      # DEFAULT_PLUGINS.each do |p|
      #   test_name = "test_#{p}"
      #   # This nasty-ass eval hack is necessary as the tests need to run within their own little env to prevent the test_helpers etc from clobbering one another
      #   eval <<-CODE
      #     Rake::TestTask.new(:#{test_name} => :environment) do |t|
      #       t.libs << "test"
      #       t.verbose = true
      #       t.pattern = "vendor/plugins/#{p}/test/**/*.rb"
      #     end
      #   CODE
      #   Rake::Task[test_name].invoke rescue had_errors = true
      # end

      Rake::Task["spec"].invoke rescue had_errors = true
      # Rake::Task["test"].invoke rescue had_errors = true


      raise "There were test failures" if had_errors
  end
end