Commit a028360f5d20ec8435a600113374004b709450ac

Authored by Antonio Terceiro
1 parent 9480ef03

Apply migrations from all plugins before tests

Showing 1 changed file with 6 additions and 1 deletions   Show diff stats
lib/tasks/plugins_tests.rake
... ... @@ -4,13 +4,18 @@
4 4 def define_task(test, plugins_folder='plugins', plugin = '*')
5 5 test_files = Dir.glob(File.join(Rails.root, plugins_folder, plugin, 'test', test[:folder], '**', '*_test.rb'))
6 6 desc 'Runs ' + (plugin != '*' ? plugin : 'plugins') + ' ' + test[:name] + ' tests'
7   - Rake::TestTask.new(test[:name].to_sym => 'db:test:prepare') do |t|
  7 + Rake::TestTask.new(test[:name].to_sym => 'db:test:plugins:prepare') do |t|
8 8 t.libs << 'test'
9 9 t.test_files = test_files
10 10 t.verbose = true
11 11 end
12 12 end
13 13  
  14 +task 'db:test:plugins:prepare' do
  15 + Rake::Task['db:test:prepare'].invoke
  16 + sh 'rake db:migrate RAILS_ENV=test SCHEMA=/dev/null'
  17 +end
  18 +
14 19 namespace :test do
15 20 namespace :noosfero_plugins do
16 21 tasks = [
... ...