Class: Matchy::Expectations::ExistExpectation

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

Instance Method Summary collapse

Methods inherited from Base

#fail!, #pass!

Constructor Details

#initialize(test_case) ⇒ ExistExpectation

Returns a new instance of ExistExpectation.



57
58
59
# File 'lib/matchy/built_in/truth_expectations.rb', line 57

def initialize(test_case)
  @test_case = test_case
end

Instance Method Details

#failure_messageObject



66
67
68
# File 'lib/matchy/built_in/truth_expectations.rb', line 66

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

#matches?(receiver) ⇒ Boolean

Returns:

  • (Boolean)


61
62
63
64
# File 'lib/matchy/built_in/truth_expectations.rb', line 61

def matches?(receiver)
  @receiver = receiver
  receiver.exist?
end

#negative_failure_messageObject



70
71
72
# File 'lib/matchy/built_in/truth_expectations.rb', line 70

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