[rspec-users] Spec for validation plugin

2007-07-26 Thread rob_twf
Hi, I'm writing a specification for a model called Location which has a post_code attribute which should be a valid UK postcode. I'm using the http://svn.designbyfront.com/rails/plugins/validates_as_uk_postcode/ validates_as_uk_postcode plugin to handle the validation but I'm not sure how I sho

Re: [rspec-users] Spec for validation plugin

2007-07-27 Thread rob_twf
David Chelimsky-2 wrote: > > > Here are some interesting thoughts on that: > > http://blog.jayfields.com/2006/12/rails-unit-testing-activerecord.html > > Just apply the same thinking to rspec. > > Thanks for the pointer, here's what I've done: In spec_helper.rb: class << ActiveRecord::Ba

Re: [rspec-users] Spec for validation plugin

2007-07-27 Thread rob_twf
rob_twf wrote: > > > it "should validate that the postcode is correctly formatted" do > > Location.should_receive(:validates_as_uk_postcode).once.with(:post_code) > load Location.source_file > end > > That works nicely. > > Looks l