# Run Coverage report require 'simplecov' SimpleCov.start do add_filter 'spec/dummy' add_group 'Controllers', 'app/controllers' add_group 'Helpers', 'app/helpers' add_group 'Mailers', 'app/mailers' add_group 'Models', 'app/models' add_group 'Views', 'app/views' add_group 'Libraries', 'lib' end # Configure Rails Environment ENV['RAILS_ENV'] = 'test' require File.expand_path('../dummy/config/environment.rb', __FILE__) require 'dotenv' Dotenv.load require 'rspec/rails' require 'database_cleaner' require 'ffaker' require 'shoulda/matchers' require 'capybara-screenshot/rspec' require 'spree/testing_support/preferences' require 'spree/testing_support/authorization_helpers' require 'spree/testing_support/capybara_ext' require 'spree/testing_support/controller_requests' require 'spree/testing_support/factories' require 'spree/testing_support/url_helpers' require 'spree/testing_support/order_walkthrough' Capybara.save_and_open_page_path = ENV['CIRCLE_ARTIFACTS'] if ENV['CIRCLE_ARTIFACTS'] if ENV['WEBDRIVER'] == 'accessible' require 'capybara/accessible' Capybara.javascript_driver = :accessible end Dir[File.join(File.dirname(__FILE__), 'factories/*.rb')].each { |f| require f } Dir[File.join(File.dirname(__FILE__), 'support/**/*.rb')].each { |f| require f } RSpec.configure do |config| config.infer_spec_type_from_file_location! config.mock_with :rspec config.color = true config.fixture_path = "#{::Rails.root}/spec/fixtures" config.use_transactional_fixtures = false config.fail_fast = ENV['FAIL_FAST'] || false config.order = "random" config.include FactoryGirl::Syntax::Methods config.include Spree::TestingSupport::Preferences config.include Spree::TestingSupport::UrlHelpers config.include Spree::TestingSupport::ControllerRequests, type: :controller if ENV['WEBDRIVER'] == 'accessible' config.around(:each, :inaccessible => true) do |example| Capybara::Accessible.skip_audit { example.run } end end config.before :suite do DatabaseCleaner.strategy = :transaction DatabaseCleaner.clean_with :truncation end config.before :each do DatabaseCleaner.strategy = RSpec.current_example.metadata[:js] ? :truncation : :transaction DatabaseCleaner.start MyConfigPreferences.set_preferences end config.after :each do DatabaseCleaner.clean end end