[rspec-users] Checking for Range

Josh Knowles joshknowles at gmail.com
Sun May 27 17:40:21 EDT 2007


On 5/27/07, David Chelimsky <dchelimsky at gmail.com> wrote:
>
>
>
> How does that verify that a person will reject a password length of 4 or
> 41?



I have compiled a collection of rspec matchers to be used when testing rails
validations:
http://svn.integrumtech.com/public/plugins/rspec_on_rails_matchers

If you use this library then you would spec out the password length as
follows:

it do
  @user.should validate_length_of(:password, 5..40)
end

Behind the scenes this matcher attempts to set the password to a value
outside of the range and then calls valid?

I obviously need to finish this plugin, and get it properly documented, but
in the mean time comments/suggestions welcome/

Josh




-- 
Josh Knowles
joshknowles at gmail.com
http://joshknowles.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://rubyforge.org/pipermail/rspec-users/attachments/20070527/085c9e16/attachment-0001.html 


More information about the rspec-users mailing list