[rspec-users] Assumption tests

David Chelimsky dchelimsky at gmail.com
Sat Oct 20 13:29:19 EDT 2007

On 10/20/07, Scott Taylor <mailing_lists at railsnewbie.com> wrote:
> Another idea of Dave Astels which I think has been lost, is that each
> spec should not map one-to-on onto each implementation file (If you
> rename the file, do you rename the spec? If you create tiny inner-
> classes, or start delegating to other classes, do you create other
> spec files, or include it in the current one?).  Honestly, this is
> another one of those ideas which seems it should be some sort of
> mantra, but I've never seen it on this mailing list.  Or maybe it's
> just the state of Autotest.

I've actually come round on this one. I still believe firmly that
there should never be a 1-1 mapping of examples to methods, but I've
come to appreciate the ease of navigation afforded by mapping a single
spec file (with potentially many specs) to a single production code

I'm not recommending 1-1 spec file/code file as an absolute guideline.
I'm certainly not there 100% myself. In another thread going on today
I described how I sometimes use shared behaviours to deal with
partials (instead of mocking the partial calls). There is, in a sense,
a 1-1 mapping there, but the shared behaviour is only indirectly
mapped to the partial.

And mapping files 1-1 doesn't just aid human navigation. It supports
Autotest, as you point out, and it enables tools like TextMate to
support single command navigation between a spec and the code it is

All of that said, I must reiterate my very strong belief the mapping
one example to one method is the kiss of death.


More information about the rspec-users mailing list