Commit 6ccec5a40e56ef352d76802d1e8a3214ec06d47f
1 parent
313f8a54
Exists in
master
and in
29 other branches
Plugins test tasks
* Fixing 'available' task. This task was running only the enabled plugins. Now, before running this task, all plugins are enabled and after, the ones that were disabled are disabled again. * Running plugins tests on noosfero rake with all other tests.
Showing
2 changed files
with
22 additions
and
2 deletions
Show diff stats
lib/tasks/plugins_tests.rake
1 | +@disabled_plugins = Dir.glob(File.join(Rails.root, 'plugins', '*')).map { |file| File.basename(file)} - Dir.glob(File.join(Rails.root, 'config', 'plugins', '*')).map { |file| File.basename(file)} | |
2 | +@disabled_plugins.delete('template') | |
3 | + | |
1 | 4 | def define_task(test, plugins_folder='plugins', plugin = '*') |
2 | 5 | test_files = Dir.glob(File.join(Rails.root, plugins_folder, plugin, 'test', test[:folder], '**', '*_test.rb')) |
3 | 6 | desc 'Runs ' + (plugin != '*' ? plugin : 'plugins') + ' ' + test[:name] + ' tests' |
... | ... | @@ -43,10 +46,27 @@ namespace :test do |
43 | 46 | task plugin_name => dependencies |
44 | 47 | end |
45 | 48 | |
49 | + task :temp_enable_plugins do | |
50 | + system('./script/noosfero-plugins enableall') | |
51 | + end | |
52 | + | |
53 | + task :rollback_temp_enable_plugins do | |
54 | + @disabled_plugins.each { |plugin| system('./script/noosfero-plugins disable ' + plugin)} | |
55 | + end | |
56 | + | |
46 | 57 | task :units => 'available:units' |
47 | 58 | task :functionals => 'available:functionals' |
48 | 59 | task :integration => 'available:integration' |
49 | - task :available => [:units, :functionals, :integration] | |
60 | + task :available do | |
61 | + Rake::Task['test:noosfero_plugins:temp_enable_plugins'].invoke | |
62 | + begin | |
63 | + Rake::Task['test:noosfero_plugins:units'].invoke | |
64 | + Rake::Task['test:noosfero_plugins:functionals'].invoke | |
65 | + Rake::Task['test:noosfero_plugins:integration'].invoke | |
66 | + rescue | |
67 | + end | |
68 | + Rake::Task['test:noosfero_plugins:rollback_temp_enable_plugins'].invoke | |
69 | + end | |
50 | 70 | task :enabled => ['enabled:units', 'enabled:functionals', 'enabled:integration'] |
51 | 71 | |
52 | 72 | end | ... | ... |
lib/tasks/test.rake
... | ... | @@ -7,7 +7,7 @@ else |
7 | 7 | end |
8 | 8 | |
9 | 9 | task :test do |
10 | - errors = %w(test:units test:functionals test:integration cucumber selenium).collect do |task| | |
10 | + errors = %w(test:units test:functionals test:integration cucumber selenium test:noosfero_plugins).collect do |task| | |
11 | 11 | begin |
12 | 12 | Rake::Task[task].invoke |
13 | 13 | nil | ... | ... |