class ActiveOperation::Matcher::Execution::Base

Attributes

input[R]
message[R]
operation[R]
result[R]

Public Instance Methods

and_return(result) click to toggle source
# File lib/active_operation/matcher/execution.rb, line 5
def and_return(result)
  @result = result
  self
end
failure_message() click to toggle source
# File lib/active_operation/matcher/execution.rb, line 15
def failure_message
  raise NotImplementedError, "Expected #{self.class} to implement ##{__callee__}"
end
failure_message_when_negated() click to toggle source
# File lib/active_operation/matcher/execution.rb, line 19
def failure_message_when_negated
  raise NotImplementedError, "Expected #{self.class} to implement ##{__callee__}"
end
Also aliased as: negative_failure_message
negative_failure_message()
when_initialized_with(*input) click to toggle source
# File lib/active_operation/matcher/execution.rb, line 10
def when_initialized_with(*input)
  @input = input
  self
end

Protected Instance Methods

halted?() click to toggle source
# File lib/active_operation/matcher/execution.rb, line 41
def halted?
  operation.halted?
end
input_as_text() click to toggle source
# File lib/active_operation/matcher/execution.rb, line 55
def input_as_text
  humanize(*input)
end
message_as_expected?() click to toggle source
# File lib/active_operation/matcher/execution.rb, line 50
def message_as_expected?
  return true unless message
  operation.message == message
end
operation=(operation) click to toggle source
# File lib/active_operation/matcher/execution.rb, line 31
def operation=(operation)
  operation = operation.new(*input) if operation.kind_of?(Class)
  operation.perform
  @operation = operation
end
result_as_expected?() click to toggle source
# File lib/active_operation/matcher/execution.rb, line 45
def result_as_expected?
  return true unless result
  operation.output == result
end
result_as_text() click to toggle source
# File lib/active_operation/matcher/execution.rb, line 59
def result_as_text
  humanize(result)
end
succeeded?() click to toggle source
# File lib/active_operation/matcher/execution.rb, line 37
def succeeded?
  operation.succeeded?
end

Private Instance Methods

humanize(*args) click to toggle source
# File lib/active_operation/matcher/execution.rb, line 65
def humanize(*args)
  args = args.map(&:inspect)
  last_element = args.pop
  args.length > 0 ? [args.join(", "), last_element].join(" and ") : last_element
end