Commit 1782ed45f750440dd9bb96de4a766bd7271d0f53
1 parent
9f56ecfe
Exists in
master
and in
29 other branches
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 ...
Showing
2 changed files
with
1 additions
and
3 deletions
Show diff stats
lib/tasks/plugins.rake
1 | -ActiveRecord::SchemaDumper.ignore_tables << /_plugin_/ | ||
2 | - | ||
3 | namespace :noosfero do | 1 | namespace :noosfero do |
4 | namespace :plugins do | 2 | namespace :plugins do |
5 | plugin_migration_dirs = Dir.glob(File.join(Rails.root, 'plugins', '*', 'db', 'migrate')) | 3 | plugin_migration_dirs = Dir.glob(File.join(Rails.root, 'plugins', '*', 'db', 'migrate')) |
lib/tasks/plugins_tests.rake
@@ -4,7 +4,7 @@ | @@ -4,7 +4,7 @@ | ||
4 | def define_task(test, plugins_folder='plugins', plugin = '*') | 4 | def define_task(test, plugins_folder='plugins', plugin = '*') |
5 | test_files = Dir.glob(File.join(Rails.root, plugins_folder, plugin, 'test', test[:folder], '**', '*_test.rb')) | 5 | test_files = Dir.glob(File.join(Rails.root, plugins_folder, plugin, 'test', test[:folder], '**', '*_test.rb')) |
6 | desc 'Runs ' + (plugin != '*' ? plugin : 'plugins') + ' ' + test[:name] + ' tests' | 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 | t.test_files = test_files | 8 | t.test_files = test_files |
9 | t.verbose = true | 9 | t.verbose = true |
10 | end | 10 | end |