March 29th, 2007

RSpec on Rails Matchers

While at the Mountain West Ruby Conf Matt and I implemented the first pass at the following rails matchers for rspec:

  • should belong_to(association)
  • should have_many(association)
  • should validate_confirmation_of(attribute)
  • should validate_format_of(attribute, valid => [], invalid => [])
  • should validate_length_of(attribute, range)
  • should validate_presence_of(attribute)
  • should validate_uniqueness_of(attribute)

Plugin available here: http://svn.integrumtech.com/public/plugins/rspecon_railsmatchers/

I haven’t had a chance to get the README done, or any rdoc, but there are specs for the majority of the matchers.

Comments / Suggestions Welcome!