Skip to content

Commit

Permalink
[Refactor] inline method error_if_frozen
Browse files Browse the repository at this point in the history
  • Loading branch information
nitishr committed Dec 2, 2019
1 parent 4a86bfb commit 1da001a
Showing 1 changed file with 1 addition and 5 deletions.
6 changes: 1 addition & 5 deletions lib/mocha/object_methods.rb
Original file line number Diff line number Diff line change
Expand Up @@ -144,14 +144,10 @@ def unstub(*method_names)
private

def anticipates(expected_methods_vs_return_values, &block)
error_if_frozen
mocha.anticipates(expected_methods_vs_return_values, caller, self, &block)
end

def error_if_frozen
if frozen?
raise StubbingError.new("can't stub method on frozen object: #{mocha_inspect}", caller)
end
mocha.anticipates(expected_methods_vs_return_values, caller, self, &block)
end
end
end

0 comments on commit 1da001a

Please sign in to comment.