Class: BoltSpec::Plans::TaskDouble
- Inherits:
-
Object
- Object
- BoltSpec::Plans::TaskDouble
- Defined in:
- lib/bolt_spec/plans/mock_executor.rb
Overview
Nothing in the TaskDouble is ‘public’
Instance Method Summary collapse
- #add_stub ⇒ Object
- #assert_called(taskname) ⇒ Object
-
#initialize ⇒ TaskDouble
constructor
A new instance of TaskDouble.
- #process(targets, task, arguments, options) ⇒ Object
Constructor Details
#initialize ⇒ TaskDouble
Returns a new instance of TaskDouble.
14 15 16 |
# File 'lib/bolt_spec/plans/mock_executor.rb', line 14 def initialize @stubs = [] end |
Instance Method Details
#add_stub ⇒ Object
31 32 33 34 35 |
# File 'lib/bolt_spec/plans/mock_executor.rb', line 31 def add_stub stub = TaskStub.new @stubs.unshift stub stub end |
#assert_called(taskname) ⇒ Object
27 28 29 |
# File 'lib/bolt_spec/plans/mock_executor.rb', line 27 def assert_called(taskname) @stubs.each { |s| s.assert_called(taskname) } end |
#process(targets, task, arguments, options) ⇒ Object
18 19 20 21 22 23 24 25 |
# File 'lib/bolt_spec/plans/mock_executor.rb', line 18 def process(targets, task, arguments, ) # TODO: should we bother matching at all? or just call each # stub until one works? matches = @stubs.select { |s| s.matches(targets, task, arguments, ) } unless matches.empty? matches[0].call(targets, task, arguments, ) end end |