Re: Strange Little Problem

Rob Biedenharn
Wed, 26 Sep 2007 19:51:48 -0000

On Sep 26, 2007, at 2:44 PM, Bob Showalter wrote:
> On 9/26/07, Rob Biedenharn
<Rob-GBZH0y1GwQfnZcttdmLDtcI/UQi/AW5J@public.gmane.org> wrote:
>> However, all you''re doing is testing that the
validates_uniqueness_of
>> works.
>
> Rob, is that *all* he''s doing? The test is too elaborate, but a
case
> could be made that this is a regression test for the business rule
> that "Member numbers must be unique".
>
> It would protect him from coming along later and inadvertently
> removing that validation rule.
>
> I agree that we shouldn''t be testing Rails itself.

Stu Halloway addressed this at erubycon in Columbus,OH this summer.

Blog:	http://relevancellc.com/2007/7/17/posted-slides-how-not-to-test-
validations
Slides:	http://relevancellc.com/assets/2007/7/17/KeepingTestsDry.pdf

If you''re interested in a test to alert you when/if a validation is
removed accidentally, then you should be devising a test for *that*
(presence) and letting Rails make sure that validates_*_of does the
right thing.

-Rob

Rob Biedenharn		http://agileconsultingllc.com
Rob-xa9cJyRlE0mWcWVYNo9pwxS2lgjeYSpx@public.gmane.org