Created
April 8, 2011 23:58
-
-
Save eyston/910952 to your computer and use it in GitHub Desktop.
Please help this ruby idiot mock something
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
def MPQ path | |
path | |
end | |
class ReplayFile | |
def initailize path | |
@archive = MPQ(path) | |
end | |
end | |
# how do I mock MPQ in the context of ReplayFile's initializer? | |
# is trying to do this obviously stupid? | |
# this works (needs bang version), but not inside the initializer | |
# stub!(:MPQ).and_return("stub says hi") | |
# in a static language I would change the code to: | |
# class ReplayFile | |
# def initialize archive | |
# @archive = archive | |
# end | |
# end | |
# but like, my god, its ruby, I want to bend the universe to my will |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
:\ dependency injection. do you hear about it? m>