This post originated from an RSS feed registered with Ruby Buzz
by Matthew Bass.
Original Post: Validation assertion added to test_spec_on_rails
Feed Title: Pelargir
Feed URL: http://feeds.feedburner.com/pelargir/
Feed Description: Musings on software and life from Matthew Bass. Regular posts on new web products, tips and tricks, etc.
I’ve added a new assertion to test_spec_on_rails that enables verification that validates_presence_of is being called correctly on your ActiveRecord models. For example, say you have a model like this:
class User < ActiveRecord::Base
validates_presence_of :first_name, :last_name
end
You would typically test this validation by leaving a field blank, calling valid? or save on the instance, and checking the errors [...]