-
-
Save regedarek/980fed2e82aadf566291 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' | |
Spork.prefork do | |
ENV["RAILS_ENV"] ||= 'test' | |
require File.expand_path("../../config/environment", __FILE__) | |
require 'rspec/rails' | |
require 'webmock/rspec' | |
require "shoulda/matchers" # Explicitly including shoulda-matchers after rspec | |
# require 'rspec/autorun' # check if that is necessary | |
require 'factory_girl_rails' | |
require 'pry-remote' | |
Dir[Rails.root.join("spec/support/**/*.rb")].each {|f| require f} | |
RSpec.configure do |config| | |
config.mock_with :rspec | |
config.use_transactional_fixtures = false | |
config.include LoginHelper, :type => :controller | |
config.before(:suite) do | |
DatabaseCleaner.clean_with(:truncation) | |
end | |
config.before do | |
# default strategy | |
DatabaseCleaner.strategy = :transaction | |
end | |
config.before :truncation => true do | |
DatabaseCleaner.strategy = :truncation | |
end | |
config.before type: :request do | |
# use truncation for request specs because we are running in two processes | |
DatabaseCleaner.strategy = :truncation | |
Resque.inline = true | |
end | |
config.before do | |
DatabaseCleaner.start | |
WebMock.disable_net_connect!(:allow_localhost => true) | |
end | |
config.after do | |
DatabaseCleaner.clean | |
Resque.inline = false | |
end | |
config.infer_base_class_for_anonymous_controllers = false | |
config.include FactoryGirl::Syntax::Methods | |
config.filter_run :focus => true | |
config.run_all_when_everything_filtered = true | |
config.treat_symbols_as_metadata_keys_with_true_values = true | |
end | |
end | |
Spork.each_run do | |
load "#{Rails.root}/config/routes.rb" | |
FactoryGirl.reload | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment