Permalink
Browse files

Clear test database before running rake spec

  • Loading branch information...
1 parent df8bfe8 commit e8820ca2c470d4277443b935500dfb310068c3dc @ebeigarts ebeigarts committed Oct 31, 2012
Showing with 13 additions and 0 deletions.
  1. +13 −0 Rakefile
View
@@ -33,6 +33,19 @@ RSpec::Core::RakeTask.new(:rcov) do |t|
t.rcov_opts = ['--exclude', '/Library,spec/']
end
+desc "Clear test database"
+task :clear do
+ require "./spec/spec_helper"
+ ActiveRecord::Base.establish_connection(CONNECTION_PARAMS)
+ require "active_support/core_ext"
+ ActiveRecord::Base.connection.execute_structure_dump(ActiveRecord::Base.connection.full_drop)
+ ActiveRecord::Base.connection.execute("PURGE RECYCLEBIN") rescue nil
+end
+
+# Clear test database before running spec and rcov
+task :spec => :clear
+task :rcov => :clear
+
task :default => :spec
require 'rdoc/task'

0 comments on commit e8820ca

Please sign in to comment.