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

Zach Dennis zach.dennis at gmail.com
Tue Apr 1 17:29:01 EDT 2008

I've got model helpers which perform reflection on associations to
ensure a relationship exists as expected. It doesn't test the
association (I think Rails does a pretty good job of ensuring the
association works). I'm looking for feedback on if folks (and the
rspec team =) would accept such a patch.


describe SomeModel do
  it_has_many :widgets, :destroy => :null, :class_name => "BaseWidget"
  it_has_one :fuzzbucket
  it_belongs_to :another_model

it relies on the top level describe's description_type to determine
what model to reflect on. It removes a lot of boilerplate code for
spec'ing standard associations.


Zach Dennis

More information about the rspec-devel mailing list