discourse/spec/support/mocks.rb

21 lines
743 B
Ruby
Vendored
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# frozen_string_literal: true
# Mock framework setup: rspec-mocks and Mocha used together via rspec-multi-mock.
# To avoid erasing `any_instance` from Mocha
require "rspec/mocks/syntax"
RSpec::Mocks::Syntax.singleton_class.define_method(:enable_should) { |*| nil }
RSpec::Mocks::Syntax.singleton_class.define_method(:disable_should) { |*| nil }
RSpec::Mocks::ArgumentMatchers.remove_method(:hash_including) # Were currently relying on the version from Webmock
RSpec.configure do |config|
config.mock_with :rspec do |mocks|
mocks.verify_partial_doubles = true
mocks.verify_doubled_constant_names = true
mocks.syntax = :expect
end
config.mock_with MultiMock::Adapter.for(:mocha, :rspec)
config.include Mocha::API
end