module RSpec::Expectations::ExpectationTarget::InstanceMethods
Defines instance {ExpectationTarget} instance methods. These are defined in a module so we can include it in ‘Minitest::Expectation` when `rspec/expectations/minitest_integration` is loaded in order to support usage with Minitest.
Public Instance Methods
Runs the given expectation, passing if ‘matcher` returns false. @example
expect(value).not_to eq(5)
@param [Matcher]
matcher
@param [String, Proc] message optional message to display when the expectation fails @return [Boolean] false if the negative expectation succeeds (else raises) @see RSpec::Matchers
# File rspec-expectations/lib/rspec/expectations/expectation_target.rb, line 76 def not_to(matcher=nil, message=nil, &block) prevent_operator_matchers(:not_to) unless matcher RSpec::Expectations::NegativeExpectationHandler.handle_matcher(target, matcher, message, &block) end
Runs the given expectation, passing if ‘matcher` returns true. @example
expect(value).to eq(5) expect { perform }.to raise_error
@param [Matcher]
matcher
@param [String, Proc] message optional message to display when the expectation fails @return [Boolean] true if the expectation succeeds (else raises) @see RSpec::Matchers
# File rspec-expectations/lib/rspec/expectations/expectation_target.rb, line 63 def to(matcher=nil, message=nil, &block) prevent_operator_matchers(:to) unless matcher RSpec::Expectations::PositiveExpectationHandler.handle_matcher(target, matcher, message, &block) end