Last active
December 16, 2015 02:59
-
-
Save jhirn/5366196 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'rubygems' | |
require 'spork' | |
#GC.disable | |
Spork.prefork do | |
ENV["RAILS_ENV"] ||= 'test' | |
require File.expand_path("../../config/environment", __FILE__) | |
require 'rspec/rails' | |
require 'rspec/autorun' | |
require 'capybara/rspec' | |
require 'capybara/poltergeist' | |
require 'carrierwave/test/matchers' | |
require 'capybara-screenshot/rspec' | |
Dir[Rails.root.join("spec/support/**/*.rb")].each {|f| require f} | |
Capybara.javascript_driver = :poltergeist | |
AvatarUploader.root = "./tmp" | |
RSpec.configure do |config| | |
config.filter_run_excluding :js => true unless ENV['ALL_TESTS'] | |
config.use_transactional_fixtures = false | |
config.infer_base_class_for_anonymous_controllers = false | |
config.order = "random" | |
config.before(:suite) do | |
DatabaseCleaner.clean_with(:truncation) | |
end | |
config.before(:all, js: true) do | |
Authenticator = FakeAuthenticator unless defined?(Authenticator) | |
Search = FakeSearch unless defined?(Search) | |
end | |
config.before(:each) do | |
DatabaseCleaner.strategy = :transaction | |
end | |
config.before(:each, js:true) do | |
DatabaseCleaner.strategy = :truncation | |
end | |
config.before(:each) do | |
DatabaseCleaner.start | |
end | |
config.after(:each) do | |
DatabaseCleaner.clean | |
end | |
config.include SpecHelpers::IntegrationTestHelpers | |
end | |
end | |
Spork.each_run do | |
FactoryGirl.reload | |
FileUtils.rm_rf("./tmp/uploads") | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment