module RSpec::Expectations::Syntax

def default_should_host

Other tags:
    Api: - private
def default_should_host
  @default_should_host ||= ::Object.ancestors.last
end

def disable_expect(syntax_host=::RSpec::Matchers)

Other tags:
    Api: - private
def disable_expect(syntax_host=::RSpec::Matchers)
  return unless expect_enabled?(syntax_host)
  syntax_host.module_exec do
    undef expect
  end
end

def disable_should(syntax_host=default_should_host)

Other tags:
    Api: - private
def disable_should(syntax_host=default_should_host)
  return unless should_enabled?(syntax_host)
  syntax_host.module_exec do
    undef should
    undef should_not
  end
end

def enable_expect(syntax_host=::RSpec::Matchers)

Other tags:
    Api: - private
def enable_expect(syntax_host=::RSpec::Matchers)
  return if expect_enabled?(syntax_host)
  syntax_host.module_exec do
    def expect(value=::RSpec::Expectations::ExpectationTarget::UndefinedValue, &block)
      ::RSpec::Expectations::ExpectationTarget.for(value, block)
    end
  end
end

def enable_should(syntax_host=default_should_host)

Other tags:
    Api: - private
def enable_should(syntax_host=default_should_host)
  @warn_about_should = false if syntax_host == default_should_host
  return if should_enabled?(syntax_host)
  syntax_host.module_exec do
    def should(matcher=nil, message=nil, &block)
      ::RSpec::Expectations::Syntax.warn_about_should_unless_configured(::Kernel.__method__)
      ::RSpec::Expectations::PositiveExpectationHandler.handle_matcher(self, matcher, message, &block)
    end
    def should_not(matcher=nil, message=nil, &block)
      ::RSpec::Expectations::Syntax.warn_about_should_unless_configured(::Kernel.__method__)
      ::RSpec::Expectations::NegativeExpectationHandler.handle_matcher(self, matcher, message, &block)
    end
  end
end

def expect(value=::RSpec::Expectations::ExpectationTarget::UndefinedValue, &block)

def expect(value=::RSpec::Expectations::ExpectationTarget::UndefinedValue, &block)
  ::RSpec::Expectations::ExpectationTarget.for(value, block)
end

def expect_enabled?(syntax_host=::RSpec::Matchers)

Other tags:
    Api: - private
def expect_enabled?(syntax_host=::RSpec::Matchers)
  syntax_host.method_defined?(:expect)
end

def should(matcher=nil, message=nil, &block)

def should(matcher=nil, message=nil, &block)
  ::RSpec::Expectations::Syntax.warn_about_should_unless_configured(::Kernel.__method__)
  ::RSpec::Expectations::PositiveExpectationHandler.handle_matcher(self, matcher, message, &block)
end

def should_enabled?(syntax_host=default_should_host)

Other tags:
    Api: - private
def should_enabled?(syntax_host=default_should_host)
  syntax_host.method_defined?(:should)
end

def should_not(matcher=nil, message=nil, &block)

def should_not(matcher=nil, message=nil, &block)
  ::RSpec::Expectations::Syntax.warn_about_should_unless_configured(::Kernel.__method__)
  ::RSpec::Expectations::NegativeExpectationHandler.handle_matcher(self, matcher, message, &block)
end

def warn_about_should!

Other tags:
    Api: - private
def warn_about_should!
  @warn_about_should = true
end

def warn_about_should_unless_configured(method_name)

Other tags:
    Api: - private
def warn_about_should_unless_configured(method_name)
  return unless @warn_about_should
  RSpec.deprecate(
    "Using `#{method_name}` from rspec-expectations' old `:should` syntax without explicitly enabling the syntax",
    :replacement => "the new `:expect` syntax or explicitly enable `:should` with `config.expect_with(:rspec) { |c| c.syntax = :should }`"
  )
  @warn_about_should = false
end