Sha256: 5f450e57a9029063bac7c4315f78e13f62fa8c032008f3231cbd39b600ec1597
Contents?: true
Size: 1.15 KB
Versions: 9
Compression:
Stored size: 1.15 KB
Contents
module Spec module Expectations class InvalidMatcherError < ArgumentError; end class ExpectationMatcherHandler def self.handle_matcher(actual, matcher, &block) ::Spec::Matchers.last_should = :should ::Spec::Matchers.last_matcher = matcher return ::Spec::Matchers::PositiveOperatorMatcher.new(actual) if matcher.nil? match = matcher.matches?(actual, &block) ::Spec::Expectations.fail_with(matcher.failure_message) unless match match end end class NegativeExpectationMatcherHandler def self.handle_matcher(actual, matcher, &block) ::Spec::Matchers.last_should = :should_not ::Spec::Matchers.last_matcher = matcher return ::Spec::Matchers::NegativeOperatorMatcher.new(actual) if matcher.nil? match = if matcher.respond_to?(:does_not_match?) !matcher.does_not_match?(actual, &block) else matcher.matches?(actual, &block) end ::Spec::Expectations.fail_with(matcher.negative_failure_message) if match match end end end end
Version data entries
9 entries across 9 versions & 1 rubygems