Yes, I test the initialize method.
Let’s get a few things out of the way. Number one, don’t delete tests ever. Why? They were relevant at the time and even when you think you’re covering everything, you might have forget that one edge case which one of your tests is remembering for you.
Two. Having that test for the initialize method (I’m talking to Ruby developers like me), serves a purpose. It gives you feedback when you first start out with your class that you’re requiring the right file, you’re returning the right object. If you’re testing instance variables, it might not be necessary to test that Ruby is able to assign a value to it. However, if you’re picking values out of a Hash, a test might prompt you to think about how that impacts the class.
Three. Don’t do any ‘work’ other than assignment in the constructor. Can that work be done in a factory...
Continue reading →