[rspec-users] testing behaviour or testing code?
Scott Taylor
mailing_lists at railsnewbie.com
Mon Sep 3 03:59:28 EDT 2007
On Sep 3, 2007, at 3:48 AM, Pat Maddox wrote:
> On 9/3/07, Peter Marklund <peter_marklund at fastmail.fm> wrote:
>>> There's a very useful guideline in TDD that says "test YOUR code,
>>> not
>>> everyone elses." The validation library we're testing here is
>>> ActiveRecord's. It's already tested (we hope!).
>>
>> Personally, I don't have the courage to assume Rails code is always
>> working. I know from experience it doesn't always work although it is
>> quite solid in general.
I think there are also a lot of leaky abstractions when it comes to
rails code. It's tempting to think that rails is just doing a bunch
of stuff automatically for you (and it is) - but there are edge
cases, and unless you know *exactly* what rails is doing under the
cover, testing the behaviour seems to be a good idea. I've already
run into one bug in the last week (when doing something rather
dynamic in a model class) which I wouldn't have expected.
Scott
More information about the rspec-users
mailing list