Skip to content

Instantly share code, notes, and snippets.

@jesscanady
Created October 11, 2011 21:16

Revisions

  1. jesscanady created this gist Oct 11, 2011.
    19 changes: 19 additions & 0 deletions test.rake
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,19 @@
    # Rails.root/lib/tasks/test.rake

    Rake.application.remove_task 'db:test:prepare'

    namespace :db do
    namespace :test do
    task :set_env do
    end

    task :prepare => [:set_env, :environment] do |t|
    # this would normally drop the entire DB.
    # Let's make sure we're connected to the test db and then only truncate the tables we want.
    ActiveRecord::Base.establish_connection(ActiveRecord::Base.configurations['test'])
    Form.delete_all
    Question.delete_all
    Option.delete_all
    end
    end
    end