Turgs wrote in post #1019574:
>
>   test "Password must be long enough" do
>     user = User.new(:email             => "[email protected]",
>                     :name              => "Adam",
>                     :security_question => "What's my name?",
>                     :security_answer   => "Adam")
>
>     user.password = "1234567"
>     assert user.invalid?
>     assert_equal "should be between 8 and 2000 characters",
> user.errors[:password].join('; ')
>
>     user.password = "12345678"
>     assert user.valid? # this assertion is failing


Is the mobile phone number between 8 and 30 characters?

You can write the length validations more succinctly:

 validates :password,  :presence => true,
                        :length => 8..2000

And to form the strings to test against, I hope you are not writing them 
out by hand:

    user.password = ("123456790" * 200).chop
    assert user.valid? # this assertion is failing

    user.password = "1234567890" * 200


    user.password = ("1234567890" * 200) + '1'
    assert user.invalid?
    #assert_equal 'should be between 8

-- 
Posted via http://www.ruby-forum.com/.

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.

Reply via email to