I keep coming up against this situation over and over in testing.
MyClass>>doSomethingWorthTesting
...
now := DateAndTime now.
...
I want to control DateAndTime class>>now to make this test determinate and
simulate interesting edge cases, but can't figure out a good way. In Ruby, I
could easily stub it because it's not a live system (or use dependency
injection), but here I don't want to mess with the real DateAndTime class in
case something goes wrong and leaves my system dirty.
I really hate using dependency injection for this kind of thing (especially
without Ruby's default parameter values). I've been creating MyClass>>now
and stubbing that. Am I being paranoid, should I just hijack the real class
and fix it when I'm done? What's the best way to do this?
Thanks.
Sean
--
View this message in context:
http://forum.world.st/Stubbing-class-side-methods-tp3674065p3674065.html
Sent from the Pharo Smalltalk mailing list archive at Nabble.com.