ENV["RAILS_ENV"] ||= 'test' require 'spec_helper' require File.expand_path("../dummy/config/environment", __FILE__) require 'rspec/rails' require 'shoulda-matchers' require 'factory_girl_rails' require 'database_cleaner' ActiveRecord::Migration.maintain_test_schema! RSpec.configure do |config| config.include FactoryGirl::Syntax::Methods config.use_transactional_fixtures = false config.infer_spec_type_from_file_location! config.include(Shoulda::Matchers::ActiveModel, type: :model) config.include(Shoulda::Matchers::ActiveRecord, type: :model) config.before(:suite) do DatabaseCleaner.strategy = :transaction DatabaseCleaner.clean_with(:truncation) end config.before(:each) do |example| DatabaseCleaner.start end config.after(:each) do |example| DatabaseCleaner.clean end end