Commit 1782ed45f750440dd9bb96de4a766bd7271d0f53

Authored by Antonio Terceiro
1 parent 9f56ecfe

Make plugins tests run correctly

The fact that tables matching /_plugin_/ were being excluded from
db/schema.rb broke the tests, because the test database was being
created without the necessary tables. And db/schema.rb was already not
left untouched anyway, since several plugins add columns to existing
Noosfero tables ...
lib/tasks/plugins.rake
1   -ActiveRecord::SchemaDumper.ignore_tables << /_plugin_/
2   -
3 1 namespace :noosfero do
4 2 namespace :plugins do
5 3 plugin_migration_dirs = Dir.glob(File.join(Rails.root, 'plugins', '*', 'db', 'migrate'))
... ...
lib/tasks/plugins_tests.rake
... ... @@ -4,7 +4,7 @@
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) do |t|
  7 + Rake::TestTask.new(test[:name].to_sym => 'db:test:prepare') do |t|
8 8 t.test_files = test_files
9 9 t.verbose = true
10 10 end
... ...