Well I get error as such:<br><br>1)<br>NoMethodError in 'Person should require a password within the range of 5..40 characters'<br>undefined method `range' for "ruby_tuesday":String<br>./spec/models/person_spec.rb:43:
<br><br>and I have a feeling that they're right when they say string doesn't have a range method.<br><br>I thought this would work:<br>person.password.length.should == (5..40)<br><br>but doesn't look so<br><br>
1)<br>ArgumentError in 'Person should require a password within the range of 5..40 characters'<br>wrong number of arguments (1 for 2)<br>./spec/models/person_spec.rb:43:in `initialize'<br>./spec/models/person_spec.rb:43:in `new'
<br>./spec/models/person_spec.rb:43:<br><br><br><br><div><span class="gmail_quote">On 5/27/07, <b class="gmail_sendername">David Chelimsky</b> <<a href="mailto:dchelimsky@gmail.com">dchelimsky@gmail.com</a>> wrote:</span>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">On 5/27/07, David Chelimsky <<a href="mailto:dchelimsky@gmail.com">dchelimsky@gmail.com</a>
> wrote:<br>> On 5/27/07, Andrew WC Brown <<a href="mailto:omen.king@gmail.com">omen.king@gmail.com</a>> wrote:<br>> > how would you check for a range using rspec?<br>> ><br>> > person.password.range.should
== Range.new(5..40) <- this doesn't work<br>><br>> The correct ruby syntax is Range.new(5, 40). So this should work:<br>><br>> person.password.range.should == Range.new(5, 40)<br><br>OR ....<br><br>person.password.range.should
== (5..40) #shortcut for Range.new(5, 40)<br><br><br>><br>> Cheers,<br>> David<br>><br>_______________________________________________<br>rspec-users mailing list<br><a href="mailto:rspec-users@rubyforge.org">
rspec-users@rubyforge.org</a><br><a href="http://rubyforge.org/mailman/listinfo/rspec-users">http://rubyforge.org/mailman/listinfo/rspec-users</a><br></blockquote></div><br>