Class: ComposableOperations::Matcher::Execution::FailToPerform

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

Instance Method Summary collapse

Methods inherited from Base

#and_return, #when_initialized_with

Instance Method Details

#because(message) ⇒ Object



107
108
109
110
# File 'lib/composable_operations/matcher/execution.rb', line 107

def because(message)
  @message = message
  self
end

#descriptionObject



112
113
114
115
116
117
118
# File 'lib/composable_operations/matcher/execution.rb', line 112

def description
  description = "fail to perform"
  description += " because #{message}" if message
  description += " when initialized with custom input (#{input_as_text})" if input
  description += " and return the expected result (#{result_as_text})" if result
  description
end

#failure_messageObject



120
121
122
# File 'lib/composable_operations/matcher/execution.rb', line 120

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

#failure_message_when_negatedObject Also known as: negative_failure_message



124
125
126
# File 'lib/composable_operations/matcher/execution.rb', line 124

def failure_message_when_negated
  "the operation failed unexpectedly"
end

#matches?(operation) ⇒ Boolean

Returns:

  • (Boolean)


102
103
104
105
# File 'lib/composable_operations/matcher/execution.rb', line 102

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