Class: BoltSpec::Plans::ActionDouble
- Inherits:
-
Object
- Object
- BoltSpec::Plans::ActionDouble
- Defined in:
- lib/bolt_spec/plans/action_stubs.rb
Overview
Nothing in the ActionDouble is ‘public’
Instance Method Summary collapse
- #add_stub ⇒ Object
- #assert_called(object) ⇒ Object
-
#initialize(action_stub) ⇒ ActionDouble
constructor
A new instance of ActionDouble.
- #process(*args) ⇒ Object
Constructor Details
#initialize(action_stub) ⇒ ActionDouble
Returns a new instance of ActionDouble.
10 11 12 13 |
# File 'lib/bolt_spec/plans/action_stubs.rb', line 10 def initialize(action_stub) @stubs = [] @action_stub = action_stub end |
Instance Method Details
#add_stub ⇒ Object
26 27 28 29 30 |
# File 'lib/bolt_spec/plans/action_stubs.rb', line 26 def add_stub stub = Plans.const_get(@action_stub).new @stubs.unshift stub stub end |
#assert_called(object) ⇒ Object
22 23 24 |
# File 'lib/bolt_spec/plans/action_stubs.rb', line 22 def assert_called(object) @stubs.each { |s| s.assert_called(object) } end |
#process(*args) ⇒ Object
15 16 17 18 19 20 |
# File 'lib/bolt_spec/plans/action_stubs.rb', line 15 def process(*args) matches = @stubs.select { |s| s.matches(*args) } unless matches.empty? matches[0].call(*args) end end |