• When RSpec meets Validatable
    Jay Fields writes an excellent module called Validatable to provide a class who include the module the ActiveRecord like behavior. For example, you can say validates_presence_of :attribute etc. This page has the RDoc of the module. When I write RSpec for a Validatable class, I ended up writing a stattement like this: @email.validate_only("presence_of/body") @email.errors.on(:body).should_not be_nil Which is basically testing body is a required field. It works, but it looks complicated and hard to understand. The RSpec on Rails plugin provides a...
    read more
  • Permalink: Monday, November 12, 2007 10:36 AM
    Posted by ywen | 0 Comments
    Filed under , ,