# This file is copied to spec/ when you run 'rails generate rspec:install' ENV['RAILS_ENV'] ||= 'test' require 'spec_helper' require File.expand_path('../dummy/config/environment', __FILE__) require 'rspec/rails' require 'rails-controller-testing' require 'factory_girl_rails' require 'database_cleaner' require 'shoulda-matchers' require 'faker' ActiveRecord::Migration.maintain_test_schema! # Adding support files # Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each { |f| require f } Dir[Exposition::Engine.root.join("spec/support/**/*.rb")].each { |f| require f } RSpec.configure do |config| config.use_transactional_fixtures = true config.infer_spec_type_from_file_location! config.include FactoryGirl::Syntax::Methods config.use_transactional_fixtures = false config.expect_with :rspec do |expectations| expectations.include_chain_clauses_in_custom_matcher_descriptions = true end config.mock_with :rspec do |mocks| mocks.verify_partial_doubles = true end config.before(:suite) do DatabaseCleaner.clean_with(:truncation) end config.before(:each) do |example| DatabaseCleaner.strategy= example.metadata[:js] ? :truncation : :transaction DatabaseCleaner.start end config.after(:each) do DatabaseCleaner.clean end # Delete test files from paperclip config.after(:suite) do FileUtils.rm_rf(Dir["#{Rails.root}/spec/test_files/"]) end [:controller, :view, :request].each do |type| config.include ::Rails::Controller::Testing::TestProcess, :type => type config.include ::Rails::Controller::Testing::TemplateAssertions, :type => type config.include ::Rails::Controller::Testing::Integration, :type => type end end