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 should properly specify my model.
Heres the model code:
class Location < ActiveRecord::Base
validates_as_uk_postcode :post_code
end
In my model spec I want something like this (assume @location has been setup
as a new Location instance):
it "should be invalid if the post code is incorrectly formatted" do
@location.post_code => 'Q1 1QQ'
@location.should_not be_valid
@location.should have(1).error_on(:post_code)
end
But there are many examples of invalid post codes and they are already
tested in the plugin's own test cases. I only really want to test my code,
rather than retest the plugin.
So my question is how should I write the specification so that it doesn't
duplicate the tests in the plugin but at the same time expresses the correct
behaviour of the Location model?
Thanks in advance,
Rob
--
View this message in context:
http://www.nabble.com/Spec-for-validation-plugin-tf4152378.html#a11812924
Sent from the rspec-users mailing list archive at Nabble.com.
_______________________________________________
rspec-users mailing list
[email protected]
http://rubyforge.org/mailman/listinfo/rspec-users