[rspec-users] a better "should have valid associations"

aslak hellesoy aslak.hellesoy at gmail.com
Sat Mar 31 14:09:15 EDT 2007


On 3/31/07, Dave Astels <dastels at daveastels.com> wrote:
>
>
> On 29-Mar-07, at 1:02 PM, aslak hellesoy wrote:
>
>
> On 3/29/07, Josh Knowles <joshknowles at gmail.com> wrote:
>
>
>
>
>
>
>
>
> On 3/29/07, David Chelimsky <dchelimsky at gmail.com> wrote:
>
>
> AWESOME! I'm so psyched to see a plugin emerging for this.
>
>
>
>
>
>
>
> I second that.
> I'll play devils-advocate.. what does all this have to do with specifying
> behaviour?
>

Probably not much, but can't we say that about most of RSpec's
built-in matchers? Like for example:

foo.should match(/bar/)

What does that have to do with behaviour?

> From a specification point of view, do I care that there's a valiadtor for a
> field?  I don't think so... I'm more concerned with what happens when I try
> to use a bad value for that field.  That there's a validator for it in the
> model is an implementation detail.
>
> That said, it's great stuff for a plugin.
>

I've been thinking - would it make sense to modify the rspec_resource
generator to generate specs that use the matchers provided by Josh's
plugin? It would be possible to infer from foreign key fields passed
as arguments to the generator (name:string project_id:integer) etc.

Aslak

> Dave
>
>
> _______________________________________________
> rspec-users mailing list
> rspec-users at rubyforge.org
> http://rubyforge.org/mailman/listinfo/rspec-users
>


More information about the rspec-users mailing list