Module: RSpec::Expectations::ExpectationTarget::InstanceMethods
- Included in:
- RSpec::Expectations::ExpectationTarget
- Defined in:
- lib/rspec/expectations/expectation_target.rb
Overview
Defines instance RSpec::Expectations::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.
Instance Method Summary collapse
-
#not_to(matcher = nil, message = nil, &block) ⇒ Boolean
(also: #to_not)
Runs the given expectation, passing if
matcher
returns false. -
#to(matcher = nil, message = nil, &block) ⇒ Boolean
Runs the given expectation, passing if
matcher
returns true.
Instance Method Details
#not_to(matcher = nil, message = nil, &block) ⇒ Boolean Also known as: to_not
Runs the given expectation, passing if matcher
returns false.
76 77 78 79 |
# File 'lib/rspec/expectations/expectation_target.rb', line 76 def not_to(matcher=nil, =nil, &block) prevent_operator_matchers(:not_to) unless matcher RSpec::Expectations::NegativeExpectationHandler.handle_matcher(target, matcher, , &block) end |
#to(matcher = nil, message = nil, &block) ⇒ Boolean
Runs the given expectation, passing if matcher
returns true.
63 64 65 66 |
# File 'lib/rspec/expectations/expectation_target.rb', line 63 def to(matcher=nil, =nil, &block) prevent_operator_matchers(:to) unless matcher RSpec::Expectations::PositiveExpectationHandler.handle_matcher(target, matcher, , &block) end |