[rspec-users] More on collection proxies

Jay Levitt lists-rspec at shopwatch.org
Wed Jan 24 10:54:18 EST 2007

David Chelimsky wrote:
> On 1/24/07, Jay Levitt <lists-rspec at shopwatch.org> wrote:
>> validates_presence_of is a bad example, because the two methods are
>> practically interchangeable.  But consider a validation that uses a
>> regex to verify a legal IP address.  Do you want your specs to repeat
>> the regex, or do you want to test various legal and illegal IP-address
>> strings and see what breaks?  To me, it's the second one that's actually
>> testing the behavior of the application.
> Another view would be that the Regexp is a separate component that
> you'd want to test separately from the use of that component. So the
> test that your model validates_format_of using a Regexp uses the right
> one and then have other tests just for that Regexp.

Hmm.. I can see your argument, but I'm not convinced.  Perhaps more 
experience will convince me :)


More information about the rspec-users mailing list