Permalink
Browse files

Added a testing task which clears the database before generating the …

…application for DBs such as s mysql or postgres where the tables may already exist and therefore fail at life.
  • Loading branch information...
1 parent 436cc09 commit 1945d8180139b8fef54e25ec03ed3814ce1f3a6d @parndt parndt committed Apr 20, 2012
Showing with 11 additions and 1 deletion.
  1. +11 −1 testing/lib/refinery/tasks/testing.rake
View
12 testing/lib/refinery/tasks/testing.rake
@@ -17,6 +17,9 @@ namespace :refinery do
Refinery::DummyGenerator.start params
+ # Ensure the database is not there from a previous run.
+ Rake::Task['refinery:testing:drop_dummy_app_database'].invoke
+
Refinery::CmsGenerator.start %w[--quiet --fresh-installation]
Dir.chdir Refinery::Testing::Railtie.target_extension_path
@@ -39,12 +42,19 @@ namespace :refinery do
desc "Remove the dummy app used for testing"
task :clean_dummy_app do
+ Rake::Task['refinery:testing:drop_dummy_app_database'].invoke
dummy_app_path.rmtree if dummy_app_path.exist?
end
+ desc "Remove the dummy app's database."
+ task :drop_dummy_app_database do
+ load 'rails/tasks/engine.rake'
+ Rake::Task['app:db:drop'].invoke
+ end
+
task :init_test_database do
load 'rails/tasks/engine.rake'
- Rake::Task["app:db:test:prepare"].invoke
+ Rake::Task['app:db:test:prepare'].invoke
end
def dummy_app_path

0 comments on commit 1945d81

Please sign in to comment.