2011-02-08 12:16:35 -05:00
|
|
|
# Configure Rails Envinronment
|
|
|
|
ENV["RAILS_ENV"] = "test"
|
2009-05-27 11:21:20 -04:00
|
|
|
|
2011-02-08 12:16:35 -05:00
|
|
|
require File.expand_path("../dummy/config/environment.rb", __FILE__)
|
|
|
|
require "rails/test_help"
|
2009-05-27 11:21:20 -04:00
|
|
|
|
2011-04-01 05:37:36 -04:00
|
|
|
begin
|
|
|
|
require 'turn'
|
|
|
|
rescue LoadError
|
|
|
|
# noop
|
|
|
|
end
|
|
|
|
|
2011-02-08 12:16:35 -05:00
|
|
|
#ActionMailer::Base.delivery_method = :test
|
|
|
|
#ActionMailer::Base.perform_deliveries = true
|
|
|
|
#ActionMailer::Base.default_url_options[:host] = "test.com"
|
2009-05-27 11:21:20 -04:00
|
|
|
|
2011-02-08 12:16:35 -05:00
|
|
|
Rails.backtrace_cleaner.remove_silencers!
|
2009-05-27 11:21:20 -04:00
|
|
|
|
2011-02-08 12:16:35 -05:00
|
|
|
require 'shoulda'
|
2009-05-27 11:21:20 -04:00
|
|
|
|
2011-02-08 12:16:35 -05:00
|
|
|
# Configure capybara for integration testing
|
|
|
|
require "capybara/rails"
|
|
|
|
Capybara.default_driver = :rack_test
|
|
|
|
Capybara.default_selector = :css
|
2009-05-27 11:21:20 -04:00
|
|
|
|
2011-02-08 12:16:35 -05:00
|
|
|
# Run any available migration
|
|
|
|
ActiveRecord::Migrator.migrate File.expand_path("../dummy/db/migrate/", __FILE__)
|
2010-03-18 14:02:55 -04:00
|
|
|
|
2011-02-08 12:16:35 -05:00
|
|
|
# Load support files
|
|
|
|
Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each { |f| require f }
|
|
|
|
|
2011-04-06 20:21:57 -04:00
|
|
|
# global setup block resetting Thread.current
|
|
|
|
class ActiveSupport::TestCase
|
|
|
|
teardown do
|
|
|
|
Thread.current[:paper_trail] = nil
|
|
|
|
end
|
|
|
|
end
|
2011-02-08 12:16:35 -05:00
|
|
|
|
|
|
|
#
|
|
|
|
# Helpers
|
|
|
|
#
|
2010-03-18 14:02:55 -04:00
|
|
|
|
2011-02-08 12:16:35 -05:00
|
|
|
def change_schema
|
|
|
|
ActiveRecord::Migration.verbose = false
|
|
|
|
ActiveRecord::Schema.define do
|
|
|
|
remove_column :widgets, :sacrificial_column
|
2010-03-19 14:53:49 -04:00
|
|
|
end
|
2011-02-08 12:16:35 -05:00
|
|
|
ActiveRecord::Migration.verbose = true
|
2010-03-19 14:53:49 -04:00
|
|
|
end
|