Module: RSpec::Expectations::ExpectationHelper
- Defined in:
- lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/rspec-expectations-3.12.2/lib/rspec/expectations/handler.rb
Class Method Summary collapse
- .check_message(msg) ⇒ Object
- .handle_failure(matcher, message, failure_message_method) ⇒ Object
-
.modern_matcher_from(matcher) ⇒ Object
Returns an RSpec-3+ compatible matcher, wrapping a legacy one in an adapter if necessary.
- .with_matcher(handler, matcher, message) ⇒ Object
Class Method Details
.check_message(msg) ⇒ Object
5 6 7 8 9 10 11 12 13 |
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/rspec-expectations-3.12.2/lib/rspec/expectations/handler.rb', line 5 def self.(msg) unless msg.nil? || msg.respond_to?(:to_str) || msg.respond_to?(:call) ::Kernel.warn [ "WARNING: ignoring the provided expectation message argument (", msg.inspect, ") since it is not a string or a proc." ].join end end |
.handle_failure(matcher, message, failure_message_method) ⇒ Object
33 34 35 36 37 38 39 40 41 42 |
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/rspec-expectations-3.12.2/lib/rspec/expectations/handler.rb', line 33 def self.handle_failure(matcher, , ) = .call if .respond_to?(:call) ||= matcher.__send__() if matcher.respond_to?(:diffable?) && matcher.diffable? ::RSpec::Expectations.fail_with , matcher.expected, matcher.actual else ::RSpec::Expectations.fail_with end end |
.modern_matcher_from(matcher) ⇒ Object
Returns an RSpec-3+ compatible matcher, wrapping a legacy one in an adapter if necessary.
19 20 21 22 |
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/rspec-expectations-3.12.2/lib/rspec/expectations/handler.rb', line 19 def self.modern_matcher_from(matcher) LegacyMatcherAdapter::RSpec2.wrap(matcher) || LegacyMatcherAdapter::RSpec1.wrap(matcher) || matcher end |
.with_matcher(handler, matcher, message) ⇒ Object
24 25 26 27 28 29 30 31 |
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/rspec-expectations-3.12.2/lib/rspec/expectations/handler.rb', line 24 def self.with_matcher(handler, matcher, ) () matcher = modern_matcher_from(matcher) yield matcher ensure ::RSpec::Matchers.last_expectation_handler = handler ::RSpec::Matchers.last_matcher = matcher end |