26 lines
689 B
Ruby
26 lines
689 B
Ruby
require 'active_record'
|
|
require 'action_mailer'
|
|
#require 'jam_db'
|
|
require 'capybara'
|
|
require 'selenium/webdriver'
|
|
|
|
require File.expand_path('../../../spec/spec_db', __FILE__)
|
|
|
|
# put this in a class, so that multiple loads of this file
|
|
# don't cause the database to be recreated multiple times
|
|
class BeforeCucumber
|
|
def initialize
|
|
# recreate test database and migrate it
|
|
db_config = YAML::load(File.open('config/database.yml'))["cucumber"]
|
|
# initialize ActiveRecord's db connection
|
|
|
|
SpecDb::recreate_database(db_config)
|
|
ActiveRecord::Base.establish_connection(db_config)
|
|
|
|
|
|
# put ActionMailer into test mode
|
|
ActionMailer::Base.delivery_method = :test
|
|
end
|
|
end
|
|
|