require "bundler/setup" require "rspec/json_expectations" ENV["RAILS_ENV"] ||= "test" require File.expand_path("dummy/config/environment", __dir__) abort("The Rails environment is running in production mode!") if Rails.env.production? require "rspec/rails" require "dotenv" env_file = ENV["CI"] == "true" ? ".env.ci" : ".env.local" raise "Expected #{env_file}" unless File.exist?(env_file) Dotenv.load(env_file) # Load RSpec helpers. ENGINE_ROOT ||= File.expand_path("..", __dir__) Dir[File.join(ENGINE_ROOT, "spec/support/**/*.rb")].sort.each { |f| require f } # Load migrations from the dummy app. # ActiveRecord::Migrator.migrations_paths = File.join(ENGINE_ROOT, 'spec/dummy/db/migrate') begin ActiveRecord::Migration.maintain_test_schema! rescue ActiveRecord::PendingMigrationError => e puts e.to_s.strip exit 1 end RSpec.configure do |config| config.example_status_persistence_file_path = ".rspec_status" # Disable RSpec exposing methods globally on `Module` and `main` config.disable_monkey_patching! config.use_transactional_fixtures = true config.expect_with :rspec do |c| c.syntax = :expect c.include_chain_clauses_in_custom_matcher_descriptions = true end config.mock_with :rspec do |mocks| mocks.verify_partial_doubles = true end config.shared_context_metadata_behavior = :apply_to_host_groups config.filter_rails_from_backtrace! config.use_transactional_fixtures = true config.include(Kafka) config.extend(Skip) end