Created
July 25, 2011 22:49
-
-
Save zspencer/1105462 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
# I want to inject a dependency, but I don't want to pass it in the constructor.... | |
# Basically testing around it was getting fairly bulky and ungainly, so I extracted the functionality | |
module ThatHadTooMuchComplexityInItsConstructor | |
def initialize(stuff) | |
@stuff = stuff | |
a = ThatBetterConformsToSRP.new | |
b = a.yea_do_your_thing stuff | |
end | |
end | |
class ThatBetterConformsToSRP | |
end | |
describe ThatHadTooMuchCOmplexityInItsConstructor | |
context "All the stuff that was extracted into the new class" | |
end | |
context "the classes current responsibility" | |
end | |
end |
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
# I want to inject a dependency, but I don't want to pass it in the constructor.... | |
module ThatHadTooMuchComplexityInItsConstructor | |
def initialize(stuff) | |
@stuff = stuff | |
a = ThatBetterConformsToSRP.new | |
b = a.yea_do_your_thing(@stuff) | |
end | |
end | |
module ThatBetterConformsToSRP | |
end | |
describe ThatHadTooMuchComplexityInItsConstructor | |
context "ahhh, only the stuff this class does! isolation FTW!" | |
end | |
end | |
describe ThatBetterConformsToSRP | |
context "actually is more appropriate now" | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment