On Oct 20, 2007, at 4:29 PM, David Chelimsky wrote: > On 10/20/07, Scott Taylor <[EMAIL PROTECTED]> wrote: >>> These two specs are basically the same, and I can tell you that I >>> would likely NOT write the first one, but I would very likely write >>> the second one. This means that my decision is based on the >>> implementation, which might bug our purist BDD sensibilities. >> >>> >>> Which brings us to an important point. As is software in general, >>> BDD >>> is all about balance. It requires thought. It requires weighing >>> opposing forces and making a practical decision. >>> >> >> Doesn't bug me, at all. What bugs me is that this sort of mocking is >> not in some other mock library or plugin, which would do this pattern >> for me. > > How would such a library know whether you want to store your > FooCollection's Foos in an Array or submit it to a FooService? How > would it know the APIs of all potention FooServices? > > Perhaps there are solutions for specific libraries - e.g. > ActiveRecord, but even then you're going to have to specify structure > in advance (has_many vs has_many through) and consequently change your > specs when you decide to change your model.
Sure - I'm only advocating a solution to AR, not a more a general one. How many other (ruby) apps are built on top of a giant DSL? A has_many call is a macro - it generates 9 methods. I don't see a big problem with changing it in one place. It's a much bigger deal if you have to change the custom stubs you've created for that one macro is 9 specs. > >> These common patterns (for Rails) should be abstracted away >> (as some have been doing with Rails' association proxy). There is no >> reason that all of those implementation details *of another library* >> need to be crowding the intention of my specs. Until this happens, I >> need to know all of these details about how another library works, >> which, for me, is too far off the scale (no balance there)... > > We're all looking forward to your matcher libraries :) Not going to happen soon, because I don't care to dig into the internals of ActiveRecord. Maybe if I get really frustrate, it will happen, but for now I'm hoping someone else in the community with more AR experience will come up with something like this. Scott _______________________________________________ rspec-users mailing list rspec-users@rubyforge.org http://rubyforge.org/mailman/listinfo/rspec-users