public
Created

  • Download Gist
spec_helper.rb
Ruby
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56
require 'rubygems'
require 'spork'
 
ENV["RAILS_ENV"] ||= 'test'
 
Spork.prefork do
require 'rails/application'
Spork.trap_method(Rails::Application, :reload_routes!)
Spork.trap_method(Rails::Application::RoutesReloader, :reload!)
 
require File.expand_path("../../config/environment", __FILE__)
 
require 'rspec/rails'
require 'capybara/rspec'
require 'factory_girl_rails'
 
if RUBY_PLATFORM !~ /java/
require 'simplecov'
require 'simplecov-rcov'
SimpleCov.formatter = SimpleCov::Formatter::RcovFormatter
SimpleCov.start 'rails'
end
 
Dir[Rails.root.join("spec/support/**/*.rb")].each { |f| require f }
 
RSpec.configure do |config|
config.mock_with :rspec
config.use_transactional_fixtures = true
config.infer_base_class_for_anonymous_controllers = false
 
config.treat_symbols_as_metadata_keys_with_true_values = true
config.include Devise::TestHelpers, :type => :controller
config.include Devise::TestHelpers, :type => :view
config.include MailerMacros
config.include LoginMacros
config.before(:each) { reset_email }
 
config.before(:suite) do
DatabaseCleaner.strategy = :transaction
DatabaseCleaner.clean_with(:truncation)
end
 
config.before(:each) do
DatabaseCleaner.start
end
 
config.after(:each) do
DatabaseCleaner.clean
end
 
end
end
 
Spork.each_run do
FactoryGirl.reload
end

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.