require "rails/all" require "nulogy_message_bus_producer" Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].sort.each { |f| require f } RSpec.configure do |config| config.expect_with(:rspec) do |expectations| # This is generally recommended, and will default to `true` in RSpec 4. expectations.include_chain_clauses_in_custom_matcher_descriptions = true end config.mock_with(:rspec) do |mocks| # This is generally recommended, and will default to `true` in RSpec 4. mocks.verify_partial_doubles = true end # This option will default to `:apply_to_host_groups` in RSpec 4 (and will # have no way to turn it off -- the option exists only for backwards # compatibility in RSpec 3). It causes shared context metadata to be # inherited by the metadata hash of host groups and examples, rather than # triggering implicit auto-inclusion in groups with matching metadata. config.shared_context_metadata_behavior = :apply_to_host_groups config.filter_run_when_matching(:focus) # Allows RSpec to persist some state between runs in order to support # the `--only-failures` and `--next-failure` CLI options. We recommend # you configure your source control system to ignore this file. config.example_status_persistence_file_path = "tmp/examples.txt" config.disable_monkey_patching! config.default_formatter = "doc" config.order = :random # Seed global randomization in this process using the `--seed` CLI option. # Setting this allows you to use `--seed` to deterministically reproduce # test failures related to randomization by passing the same `--seed` value # as the one that triggered the failure. Kernel.srand(config.seed) config.around do |example| if example.metadata[:subscriptions] old_config = NulogyMessageBusProducer.config NulogyMessageBusProducer.config = NulogyMessageBusProducer::Config.new NulogyMessageBusProducer.config.register_schema( schema: "NulogyMessageBusProducer::Specs::TestSchema", key: "test" ) example.run NulogyMessageBusProducer.config = old_config else example.run end end config.include(SubscriptionHelpers) config.extend(Skip) end