I'm not sure how much test data I should be using in my specs. I'm
writing specs for the Property model in my Rails app. Its "address"
attribute is going to be validated with this regex:
/\A\d+[a-z]? [-', a-z]{2,128}\Z/i
At the moment, my plan is to spec out the following possibilities. A
property is invalid if its address:
1) doesn't begin with a digit;
2) is shorter than 2 characters;
3) is longer than 128 characters;
I should also test that certain characters, such as ! @ # $ etc,
invalidate a property.
However, all of that seems like blacklisting, and achieves poor
coverage of the regular expression.
Should I create a list of valid and invalid addresses to test against
the regex? That seems like a decent idea, but seems synonymous with
fixtures. What would you guys recommend?
Cheers,
Nick
_______________________________________________
rspec-users mailing list
rspec-users@rubyforge.org
http://rubyforge.org/mailman/listinfo/rspec-users