in reply to Re: RFC Mocking an Accessor with Test::MockObject
in thread RFC Mocking an Accessor with Test::MockObject
Yeah well every case is different IMHO. This test code is for a specific component a relatively complex Catalyst Model (that is modeled as an aggregate), so I wanted to test very specific classes that receive complex objects and Catalyst Model instances as well. Creating the actual objects would have been a real pain and I wanted to write unit tests for every single component. I looked into Test::MockObject::Extends but it was more than I needed (and virtually impossible and useless to instantiate the whole model to test such a small class), so I settled for the solution above.
Do you think it's worth a tutorial? Is the title appropriate? I could start the article with your caveat above ;-) ("If you have to mock an accessor, you're probably mocking too much.")