Class: Spectre::Assertion::AndWrapper

Inherits:
ValueWrapper show all
Defined in:
lib/spectre/assertion.rb

Instance Method Summary collapse

Methods inherited from ValueWrapper

wrap

Constructor Details

#initialize(first, second) ⇒ AndWrapper

Returns a new instance of AndWrapper.



45
46
47
48
49
# File 'lib/spectre/assertion.rb', line 45

def initialize first, second
  super(first)
  @first = ValueWrapper.wrap(first)
  @second = ValueWrapper.wrap(second)
end

Instance Method Details

#evaluate?(predicate, actual, negate) ⇒ Boolean

Returns:

  • (Boolean)


51
52
53
# File 'lib/spectre/assertion.rb', line 51

def evaluate? predicate, actual, negate
  @first.evaluate?(predicate, actual, negate) and @second.evaluate?(predicate, actual, negate)
end

#to_sObject

:nodoc:



56
57
58
# File 'lib/spectre/assertion.rb', line 56

def to_s
  "#{@first} and #{@second}"
end