[rspec-users] have_one and have_present
jerry.west at ntlworld.com
Tue May 8 10:28:39 EDT 2007
I have to agree, Nick. Specs should be about behaviour and not
implementation, though the two will inevitably overlap. Even specifying
associations (another recent discussion) might be too much - what the
client is really interested in is the behaviour associations offer (or
rather the problem-specific solutions that behaviour allows you to
offer). So long as one regards such a spec as being shorthand for the
end behaviour there should be no problem, but if we are too specific in
our specifications we might end up dictating implementation choices
which are neither necessary nor, perhaps desirable.
I like your valid/invalid syntax too.
PS: "Independent" confirmation of an implementation detail ('did I type
it right?') can be very helpful and I know I have used tests & specs for
exactly that purpose, but in my case I suspect it's really a lack of
confidence in my own abilities and understanding! Is it really the role
of a spec to double check that the coder has typed the right thing?
More information about the rspec-users