daily pastebin goal
15%
SHARE
TWEET

Untitled

a guest Dec 9th, 2018 59 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. require 'spork'
  2.  
  3. Spork.prefork do
  4.   # Loading more in this block will cause your tests to run faster. However,
  5.   # if you change any configuration or code from libraries loaded here, you'll
  6.   # need to restart spork for it take effect.
  7.  
  8.   # This file is copied to spec/ when you run 'rails generate rspec:install'
  9.   ENV["RAILS_ENV"] ||= 'test'
  10.   require File.expand_path("../../config/environment", __FILE__)
  11.   require 'rspec/rails'
  12.   require 'rspec/autorun'
  13.  
  14.   require 'shoulda/matchers/integrations/rspec'
  15.  
  16.   require "rails/application"
  17.   Spork.trap_method(Rails::Application::RoutesReloader, :reload!)
  18.  
  19.   # Requires supporting ruby files with custom matchers and macros, etc,
  20.   # in spec/support/ and its subdirectories.
  21.   Dir[Rails.root.join("spec/support/**/*.rb")].each {|f| require f}
  22.  
  23.   RSpec.configure do |config|
  24.     config.mock_with :rspec
  25.  
  26.     require 'database_cleaner'
  27.     config.before(:suite) do
  28.      DatabaseCleaner.strategy = :transaction
  29.      # DatabaseCleaner.clean_with(:truncation)
  30.     end
  31.  
  32.     config.before(:each) do
  33.      DatabaseCleaner.start
  34.     end
  35.  
  36.     config.after(:each) do
  37.      DatabaseCleaner.clean
  38.     end
  39.  
  40.     config.after(:suite) do
  41.      DatabaseCleaner.clean_with(:truncation)
  42.     end
  43.  
  44.   end
  45.  
  46. end
  47.  
  48. Spork.each_run do
  49.  
  50.   I18n.backend.reload!
  51.  
  52.   Dir[Rails.root.join('spec/support/**/*.rb')].each { |f| require f }
  53.  
  54.   require 'factory_girl'
  55.  
  56.   FactoryGirl.definition_file_paths = [File.join(Rails.root, 'spec', 'factories')]
  57.   FactoryGirl.find_definitions
  58.  
  59. end
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top