[rspec-users] [OT] Object Mother vs Test Data Builder (was Jay Fields' blog on developer testing)
scott at railsnewbie.com
Thu Feb 5 14:36:30 EST 2009
> Nat points out that problems with Object Mother arise when people
> start adding factory methods to deal with the edge cases, such as
> ObjectMother.new_invoice_with_no_postal_code. I totally agree that
> this would be a problem since such abstraction results in hard to
> follow tests (this is why I hate fixtures actually). From the
> projects I have worked on I haven't seen the Object Mother libs
> abused this way and they are used more like a Test Data Builder.
> The only difference I see is in implementation, meaning the ruby
> libs tend to group all the factory methods on one object or module
> just like Object Mother, while the pattern Nat describes uses a
> separate builder class for each object. I think this is really just
> details though and results from Ruby's differences from Java.
> Any thoughts? Are Ruby's Object Mothers really Test Data Builders?
Yeah, at least FixtureReplacement takes that stance, which is why I
didn't call "Object Mother"
More information about the rspec-users