class ActiveOperation::Matcher::Execution::HaltWhilePerforming

Public Instance Methods

because(message) click to toggle source
# File lib/active_operation/matcher/execution.rb, line 115
def because(message)
  @message = message
  self
end
description() click to toggle source
# 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_message() click to toggle source
# 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_negated() click to toggle source
# File lib/active_operation/matcher/execution.rb, line 132
def failure_message_when_negated
  "the operation was halted unexpectedly"
end
matches?(operation) click to toggle source
# File lib/active_operation/matcher/execution.rb, line 110
def matches?(operation)
  self.operation = operation
  halted? && result_as_expected? && message_as_expected?
end

Protected Instance Methods

failure_reasons() click to toggle source
# File lib/active_operation/matcher/execution.rb, line 138
def failure_reasons
  reasons = []
  reasons << "it did not halt at all" unless halted?
  reasons << "its message was not as expected" unless message_as_expected?
  unless result_as_expected?
    reasons << [
      "it did not return the expected result",
      "Expected: #{result.inspect}",
      "Got: #{operation.result.inspect}"
    ].join("\n\t  ")
  end
  reasons.map { |r| "\t- #{r}" }.join("\n")
end