Class: Catechism::Matchers::Equal

Inherits:
Struct
  • Object
show all
Defined in:
lib/catechism/matchers/equal.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#expectationObject

Returns the value of attribute expectation

Returns:

  • (Object)

    the current value of expectation



3
4
5
# File 'lib/catechism/matchers/equal.rb', line 3

def expectation
  @expectation
end

#negatedObject

Returns the value of attribute negated

Returns:

  • (Object)

    the current value of negated



3
4
5
# File 'lib/catechism/matchers/equal.rb', line 3

def negated
  @negated
end

#subjectObject

Returns the value of attribute subject

Returns:

  • (Object)

    the current value of subject



3
4
5
# File 'lib/catechism/matchers/equal.rb', line 3

def subject
  @subject
end

Instance Method Details

#equal?Boolean

Returns:

  • (Boolean)


4
5
6
# File 'lib/catechism/matchers/equal.rb', line 4

def equal?
  subject == expectation
end

#failure_messageObject



12
13
14
15
16
17
18
# File 'lib/catechism/matchers/equal.rb', line 12

def failure_message
  if negated
    "#{subject} equals #{expected}"
  else
    "#{subject} does not equal #{expected}"
  end
end

#valid?Boolean

Returns:

  • (Boolean)


8
9
10
# File 'lib/catechism/matchers/equal.rb', line 8

def valid?
  equal? ^ negated
end