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 4, 2019
1 parent 201cfaa commit 2840411
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 2840411

Please sign in to comment.