[rspec-devel] rspec_on_rails, speccing models, adding it helpers...

Pat Maddox pergesu at gmail.com
Tue Apr 1 18:38:54 EDT 2008

On Tue, Apr 1, 2008 at 3:09 PM, David Chelimsky <dchelimsky at gmail.com> wrote:
>  >  Example:
>  >
>  >  describe SomeModel do
>  >   it_has_many :widgets, :destroy => :null, :class_name => "BaseWidget"
>  >   it_has_one :fuzzbucket
>  >   it_belongs_to :another_model
>  >  end
>  I see more and more structures appearing like this. I have very mixed
>  feelings about them. This is about structure, not behaviour. Even if
>  the underlying code is actually approaching this in a more behavioural
>  way, it's still expressing structure at the high level.

I don't have mixed feelings about this.  I think this type of spec is
terrible.  It completely duplicates the implementation.  It's not even
testing anything.

This is not a value judgment against you though, Zach.  I think when
people do stuff like this they genuinely have good intentions.  It's
just that it seems to be quite difficult to test highly declarative
stuff like AR associations.

Now that I've given my rather harsh opinion, I have to get back to
work :)  I'll try follow up later with something more helpful like
thoughts on how to write better specs.


More information about the rspec-devel mailing list