ENV['RAILS_ENV'] = 'test' if ENV['CODACY_PROJECT_TOKEN'] require 'simplecov' require 'codacy-coverage' SimpleCov.formatter = SimpleCov::Formatter::MultiFormatter.new([SimpleCov::Formatter::HTMLFormatter, Codacy::Formatter]) Codacy::Reporter.start do add_filter '/spec/' add_filter '/test/' add_filter '/config/' add_filter 'vendor/**/*' end end require 'rubygems' require 'aws-sdk-ec2' require 'mongoid' require 'delayed_job_mongoid' require 'email_format' require 'liquid' require 'jwt' require 'rest-client' require 'twilio-ruby' require_relative 'rails_setup' require 'rails/test_help' require 'test/unit' require 'mocha/minitest' require 'shoulda' require 'minitest/rails/capybara' require 'minitest/reporters' require 'factory_bot' require 'webmock/minitest' require 'database_cleaner' Mongoid.logger.level = Logger::ERROR Mongo::Logger.logger.level = Logger::ERROR DatabaseCleaner.strategy = :truncation if ENV['CODACY_PROJECT_TOKEN'] Minitest::Reporters.use!(Minitest::Reporters::DefaultReporter.new) else Minitest::Reporters.use!(Minitest::Reporters::RubyMineReporter.new) end require_relative 'test_models_helper' module ActiveSupport class TestCase FactoryBot.find_definitions Shoulda.autoload_macros Rails.root.to_s Mongoid.load!('./test/fixtures/mongoid.yml') DatabaseCleaner.strategy = :truncation setup do mocha_setup DatabaseCleaner.clean DatabaseCleaner.start Rails.cache.clear SystemConfiguration.configuration.update!(base_url: 'http://localhost:3000') WebMock.enable! end teardown do DatabaseCleaner.clean Mail::TestMailer.deliveries.clear mocha_teardown WebMock.disable! WebMock.reset! end end end module ActionDispatch class IntegrationTest # include Devise::Test::IntegrationHelpers Shoulda.autoload_macros Rails.root.to_s DatabaseCleaner.strategy = :truncation Mongoid.load!('./test/fixtures/mongoid.yml') setup do mocha_setup DatabaseCleaner.clean DatabaseCleaner.start Rails.cache.clear SystemConfiguration.configuration.update!(base_url: 'http://localhost:3000') WebMock.enable! end teardown do DatabaseCleaner.clean Mail::TestMailer.deliveries.clear mocha_teardown WebMock.disable! WebMock.reset! end end end