Commit 654b1e0fab767398a139272218760ba89119bb61
1 parent
a162da01
Exists in
master
and in
29 other branches
Load Solr for subtasks (test:units, cucumber, etc)
Showing
1 changed file
with
23 additions
and
6 deletions
Show diff stats
lib/tasks/test.rake
... | ... | @@ -6,11 +6,32 @@ else |
6 | 6 | t.instance_variable_get('@actions').clear |
7 | 7 | end |
8 | 8 | |
9 | +desc 'Runs Seleniun acceptance tests' | |
10 | +task :selenium do | |
11 | + sh "xvfb-run -a cucumber -p selenium --format #{ENV['CUCUMBER_FORMAT'] || 'progress'}" | |
12 | +end | |
13 | + | |
14 | +TestTasks = %w(test:units test:functionals test:integration) | |
15 | +CucumberTasks = %w(cucumber selenium) | |
16 | +NoosferoTasks = %w(test:noosfero_plugins) | |
17 | +AllTasks = TestTasks + CucumberTasks + NoosferoTasks | |
18 | + | |
19 | +namespace :test do | |
20 | + TestTasks.each do |test_task| | |
21 | + test_task = test_task.to_s.gsub(/^test:/, '').to_sym #remove namespace :test | |
22 | + ENV['RAILS_ENV'] = 'test' | |
23 | + override_task test_task => ['solr:start', "#{test_task}:original", "solr:stop"] | |
24 | + end | |
25 | +end | |
26 | +(CucumberTasks + NoosferoTasks).each do |test_task| | |
27 | + ENV['RAILS_ENV'] = 'test' | |
28 | + override_task test_task => ['solr:start', "#{test_task}:original", "solr:stop"] | |
29 | +end | |
30 | + | |
9 | 31 | task :test do |
10 | 32 | ENV['RAILS_ENV'] = 'test' |
11 | - Rake::Task['solr:stop'].invoke | |
12 | 33 | Rake::Task['solr:start'].invoke |
13 | - errors = %w(test:units test:functionals test:integration cucumber selenium test:noosfero_plugins).collect do |task| | |
34 | + errors = AllTasks.collect do |task| | |
14 | 35 | begin |
15 | 36 | Rake::Task[task].invoke |
16 | 37 | nil |
... | ... | @@ -22,7 +43,3 @@ task :test do |
22 | 43 | abort "Errors running #{errors.to_sentence}!" if errors.any? |
23 | 44 | end |
24 | 45 | |
25 | -desc 'Runs Seleniun acceptance tests' | |
26 | -task :selenium do | |
27 | - sh "xvfb-run -a cucumber -p selenium --format #{ENV['CUCUMBER_FORMAT'] || 'progress'}" | |
28 | -end | ... | ... |