module RSpec::Expectations::Syntax
def default_should_host
- Api: - private
def default_should_host @default_should_host ||= ::Object.ancestors.last end
def disable_expect(syntax_host = ::RSpec::Matchers)
- Api: - private
def disable_expect(syntax_host = ::RSpec::Matchers) return unless expect_enabled?(syntax_host) syntax_host.module_eval do undef expect end ::RSpec::Expectations::ExpectationTarget.disable_deprecated_should end
def disable_should(syntax_host = default_should_host)
- Api: - private
def disable_should(syntax_host = default_should_host) return unless should_enabled?(syntax_host) syntax_host.module_eval do undef should undef should_not end ::RSpec::Expectations::ExpectationTarget.disable_deprecated_should end
def enable_expect(syntax_host = ::RSpec::Matchers)
- 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 ::RSpec::Expectations::ExpectationTarget.enable_deprecated_should if should_enabled? end
def enable_should(syntax_host = default_should_host)
- Api: - private
def enable_should(syntax_host = default_should_host) return if should_enabled?(syntax_host) syntax_host.module_eval do def should(matcher=nil, message=nil, &block) ::RSpec::Expectations::PositiveExpectationHandler.handle_matcher(self, matcher, message, &block) end def should_not(matcher=nil, message=nil, &block) ::RSpec::Expectations::NegativeExpectationHandler.handle_matcher(self, matcher, message, &block) end end ::RSpec::Expectations::ExpectationTarget.enable_deprecated_should if expect_enabled? 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)
- Api: - private
def expect_enabled?(syntax_host = ::RSpec::Matchers) syntax_host.method_defined?(:expect) end
def expression_generator
- Api: - private
def expression_generator if expect_enabled? ExpectExpressionGenerator else ShouldExpressionGenerator end end
def negative_expression(target_expression, matcher_expression)
- Api: - private
def negative_expression(target_expression, matcher_expression) expression_generator.negative_expression(target_expression, matcher_expression) end
def positive_expression(target_expression, matcher_expression)
- Api: - private
def positive_expression(target_expression, matcher_expression) expression_generator.positive_expression(target_expression, matcher_expression) end
def should(matcher=nil, message=nil, &block)
def should(matcher=nil, message=nil, &block) ::RSpec::Expectations::PositiveExpectationHandler.handle_matcher(self, matcher, message, &block) end
def should_enabled?(syntax_host = default_should_host)
- 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::NegativeExpectationHandler.handle_matcher(self, matcher, message, &block) end