Created
December 23, 2008 08:38
-
-
Save kommen/39288 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module Mocha | |
module ObjectMethods | |
def stub_path(path) | |
path = path.split('.') if path.is_a? String | |
raise "Invalid Argument" if path.empty? | |
part = path.shift | |
mock = Mocha::Mockery.instance.named_mock(part) | |
exp = self.stubs(part) | |
if path.length > 0 | |
exp.returns(mock) | |
return mock.stub_path(path) | |
else | |
return exp | |
end | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment