Class: ComposableOperations::Matcher::SucceedToPerform::Matcher

Inherits:
Object
  • Object
show all
Defined in:
lib/composable_operations/matcher/succeed_to_perform.rb

Instance Method Summary collapse

Instance Method Details

#and_return(result) ⇒ Object



11
12
13
14
# File 'lib/composable_operations/matcher/succeed_to_perform.rb', line 11

def and_return(result)
  @result = result
  self
end

#descriptionObject



16
17
18
19
20
# File 'lib/composable_operations/matcher/succeed_to_perform.rb', line 16

def description
  description = "succeed to perform"
  description += " and return the expected result" if result
  description
end

#failure_messageObject



22
23
24
# File 'lib/composable_operations/matcher/succeed_to_perform.rb', line 22

def failure_message
  "the operation failed to perform for the following reason(s):\n#{failure_reasons}"
end

#matches?(operation) ⇒ Boolean

Returns:

  • (Boolean)


6
7
8
9
# File 'lib/composable_operations/matcher/succeed_to_perform.rb', line 6

def matches?(operation)
  self.operation = operation
  succeeded? && result_as_expected?
end

#negative_failure_messageObject



26
27
28
# File 'lib/composable_operations/matcher/succeed_to_perform.rb', line 26

def negative_failure_message
  "the operation succeeded unexpectedly"
end