Skip to content

Commit

Permalink
make then signature more explicit, simplify impl
Browse files Browse the repository at this point in the history
  • Loading branch information
nitishr committed Nov 25, 2019
1 parent d128e6a commit 4c888da
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions lib/mocha/expectation.rb
Original file line number Diff line number Diff line change
Expand Up @@ -443,11 +443,8 @@ def throws(tag, object = nil)
# radio.expects(:select_channel).with('BBC World Service').when(power.is('on'))
# radio.expects(:adjust_volume).with(-5).when(power.is('on'))
# radio.expects(:switch_off).then(power.is('off'))
def then(*parameters)
if parameters.length == 1
state = parameters.first
add_side_effect(ChangeStateSideEffect.new(state))
end
def then(state = nil)
add_side_effect(ChangeStateSideEffect.new(state)) if state
self
end

Expand Down

0 comments on commit 4c888da

Please sign in to comment.