From 654b1e0fab767398a139272218760ba89119bb61 Mon Sep 17 00:00:00 2001 From: Rafael Martins Date: Fri, 9 Mar 2012 11:07:35 -0300 Subject: [PATCH] Load Solr for subtasks (test:units, cucumber, etc) --- lib/tasks/test.rake | 29 +++++++++++++++++++++++------ 1 file changed, 23 insertions(+), 6 deletions(-) diff --git a/lib/tasks/test.rake b/lib/tasks/test.rake index e31e3fd..37f70b1 100644 --- a/lib/tasks/test.rake +++ b/lib/tasks/test.rake @@ -6,11 +6,32 @@ else t.instance_variable_get('@actions').clear end +desc 'Runs Seleniun acceptance tests' +task :selenium do + sh "xvfb-run -a cucumber -p selenium --format #{ENV['CUCUMBER_FORMAT'] || 'progress'}" +end + +TestTasks = %w(test:units test:functionals test:integration) +CucumberTasks = %w(cucumber selenium) +NoosferoTasks = %w(test:noosfero_plugins) +AllTasks = TestTasks + CucumberTasks + NoosferoTasks + +namespace :test do + TestTasks.each do |test_task| + test_task = test_task.to_s.gsub(/^test:/, '').to_sym #remove namespace :test + ENV['RAILS_ENV'] = 'test' + override_task test_task => ['solr:start', "#{test_task}:original", "solr:stop"] + end +end +(CucumberTasks + NoosferoTasks).each do |test_task| + ENV['RAILS_ENV'] = 'test' + override_task test_task => ['solr:start', "#{test_task}:original", "solr:stop"] +end + task :test do ENV['RAILS_ENV'] = 'test' - Rake::Task['solr:stop'].invoke Rake::Task['solr:start'].invoke - errors = %w(test:units test:functionals test:integration cucumber selenium test:noosfero_plugins).collect do |task| + errors = AllTasks.collect do |task| begin Rake::Task[task].invoke nil @@ -22,7 +43,3 @@ task :test do abort "Errors running #{errors.to_sentence}!" if errors.any? end -desc 'Runs Seleniun acceptance tests' -task :selenium do - sh "xvfb-run -a cucumber -p selenium --format #{ENV['CUCUMBER_FORMAT'] || 'progress'}" -end -- libgit2 0.21.2