module RSpec::Mocks::Syntax
def self.enable_expect(syntax_host = ::RSpec::Mocks::ExampleMethods)
- Api: - private
def self.enable_expect(syntax_host = ::RSpec::Mocks::ExampleMethods) return if expect_enabled?(syntax_host) syntax_host.class_exec do def receive(method_name, &block) Matchers::Receive.new(method_name, block) end def receive_messages(message_return_value_hash) matcher = Matchers::ReceiveMessages.new(message_return_value_hash) matcher.warn_about_block if block_given? matcher end def receive_message_chain(*messages, &block) Matchers::ReceiveMessageChain.new(messages, &block) end def allow(target) AllowanceTarget.new(target) end def expect_any_instance_of(klass) AnyInstanceExpectationTarget.new(klass) end def allow_any_instance_of(klass) AnyInstanceAllowanceTarget.new(klass) end end RSpec::Mocks::ExampleMethods::ExpectHost.class_exec do def expect(target) ExpectationTarget.new(target) end end end