class Saharspec::Matchers::Not
@private
Public Class Methods
new(*)
click to toggle source
Calls superclass method
# File lib/saharspec/matchers/dont.rb, line 7 def initialize(*) super @delegator = Delegator.new end
Public Instance Methods
description()
click to toggle source
# File lib/saharspec/matchers/dont.rb, line 12 def description "not #{@matcher.description}" end
failure_message()
click to toggle source
# File lib/saharspec/matchers/dont.rb, line 31 def failure_message @matcher.failure_message_when_negated end
match(_expected, actual)
click to toggle source
# File lib/saharspec/matchers/dont.rb, line 16 def match(_expected, actual) @matcher or fail ArgumentError, '`dont` matcher used without any matcher to negate. '\ 'Usage: dont.other_matcher(args)' # https://www.rubydoc.info/github/rspec/rspec-expectations/RSpec%2FMatchers%2FMatcherProtocol:does_not_match%3F # In a negative expectation such as `expect(x).not_to foo`, RSpec will call # `foo.does_not_match?(x)` if this method is defined. If it's not defined it # will fall back to using `!foo.matches?(x)`. if @matcher.respond_to?(:does_not_match?) @matcher.does_not_match?(actual) else !@matcher.matches?(actual) end end
method_missing(m, *a, &b)
click to toggle source
# File lib/saharspec/matchers/dont.rb, line 39 def method_missing(m, *a, &b) # rubocop:disable Lint/MissingSuper if @matcher @matcher.send(m, *a, &b) else @matcher = @delegator.send(m, *a, &b) end self end
respond_to_missing?(method, include_private = false)
click to toggle source
# File lib/saharspec/matchers/dont.rb, line 49 def respond_to_missing?(method, include_private = false) # rubocop:disable Lint/MissingSuper if @matcher @matcher.respond_to?(method, include_private) else @delegator.respond_to_missing?(method, include_private) end end
supports_block_expectations?()
click to toggle source
# File lib/saharspec/matchers/dont.rb, line 35 def supports_block_expectations? @matcher.supports_block_expectations? end