Class: Operandi::RSpec::Matchers::ExecuteStepMatcher

Inherits:
Object
  • Object
show all
Defined in:
lib/operandi/rspec/matchers/execute_step.rb

Instance Method Summary collapse

Constructor Details

#initialize(name) ⇒ ExecuteStepMatcher

Returns a new instance of ExecuteStepMatcher.



42
43
44
# File 'lib/operandi/rspec/matchers/execute_step.rb', line 42

def initialize(name)
  @name = name
end

Instance Method Details

#descriptionObject



66
67
68
# File 'lib/operandi/rspec/matchers/execute_step.rb', line 66

def description
  "execute step :#{@name}"
end

#failure_messageObject



55
56
57
58
59
60
# File 'lib/operandi/rspec/matchers/execute_step.rb', line 55

def failure_message
  return tracking_not_available_message unless service_tracks_steps?

  "expected service to execute step :#{@name}, " \
    "but executed steps were: #{executed_steps.inspect}"
end

#failure_message_when_negatedObject



62
63
64
# File 'lib/operandi/rspec/matchers/execute_step.rb', line 62

def failure_message_when_negated
  "expected service not to execute step :#{@name}"
end

#matches?(service) ⇒ Boolean

Returns:

  • (Boolean)


46
47
48
49
50
51
52
53
# File 'lib/operandi/rspec/matchers/execute_step.rb', line 46

def matches?(service)
  @service = service

  return false unless service_tracks_steps?
  return false unless step_executed?

  true
end