Class: ActiveOperation::Matcher::Execution::HaltWhilePerforming

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

Instance Method Summary collapse

Methods inherited from Base

#and_return, #when_initialized_with

Instance Method Details

#because(message) ⇒ Object



115
116
117
118
# File 'lib/active_operation/matcher/execution.rb', line 115

def because(message)
  @message = message
  self
end

#descriptionObject



120
121
122
123
124
125
126
# File 'lib/active_operation/matcher/execution.rb', line 120

def description
  description = "halt while performing"
  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



128
129
130
# File 'lib/active_operation/matcher/execution.rb', line 128

def failure_message
  "the operation did not halt while performing for the following reason(s):\n#{failure_reasons}"
end

#failure_message_when_negatedObject



132
133
134
# File 'lib/active_operation/matcher/execution.rb', line 132

def failure_message_when_negated
  "the operation was halted unexpectedly"
end

#matches?(operation) ⇒ Boolean

Returns:

  • (Boolean)


110
111
112
113
# File 'lib/active_operation/matcher/execution.rb', line 110

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