class ActiveOperation::Matcher::Execution::SucceedToPerform

Public Instance Methods

description() click to toggle source
# File lib/active_operation/matcher/execution.rb, line 78
def description
  description = "succeed to perform"
  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 85
def failure_message
  "the operation failed to perform 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 89
def failure_message_when_negated
  "the operation succeeded unexpectedly"
end
matches?(operation) click to toggle source
# File lib/active_operation/matcher/execution.rb, line 73
def matches?(operation)
  self.operation = operation
  succeeded? && result_as_expected?
end

Private Instance Methods

failure_reasons() click to toggle source
# File lib/active_operation/matcher/execution.rb, line 95
def failure_reasons
  reasons = []
  reasons << "it did not succeed at all" unless succeeded?
  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