Class: Matchy::Expectations::ExcludeExpectation

Inherits:
Base
  • Object
show all
Defined in:
lib/matchy/built_in/enumerable_expectations.rb

Instance Method Summary collapse

Methods inherited from Base

#fail!, #initialize, #pass!

Constructor Details

This class inherits a constructor from Matchy::Expectations::Base

Instance Method Details

#failure_messageObject



32
33
34
# File 'lib/matchy/built_in/enumerable_expectations.rb', line 32

def failure_message
  "Expected #{@receiver.inspect} to exclude #{@expected.inspect}."
end

#matches?(receiver) ⇒ Boolean

Returns:

  • (Boolean)


23
24
25
26
27
28
29
30
# File 'lib/matchy/built_in/enumerable_expectations.rb', line 23

def matches?(receiver)
  @receiver = receiver
  @expected.each do |o|
    return false unless !receiver.include?(o)
  end
  
  true
end

#negative_failure_messageObject



36
37
38
# File 'lib/matchy/built_in/enumerable_expectations.rb', line 36

def negative_failure_message
  "Expected #{@receiver.inspect} to not exclude #{@expected.inspect}."
end