Wednesday, March 9, 2011

[Rails] Re: authlogic's password field is not required in rspec?

Anyboby know why? I am waiting online!

On 3月10日, 上午10时16分, "James H." <tcs...@gmail.com> wrote:
> Hello,
>
> I am using authlogic and rspec in our project. I steup the authlogic
> as the offical example. But when i run my rspec, it tells me that
> password field is not required. My spec file is as following:
>
> require 'spec_helper'
>
> describe User do
> before(:each) do
> @valid_attributes = {
> :email => 'tcs...@gmail.com',
> :password => "aaaaaa",
> :password_confirmation => "aaaaaa"
> }
> @user = User.new(@valid_attributes)
> end
>
> ......
>
> it "should not be valid without a password" do
> @user.password = nil
> @user.should_not be_valid
> end
> ........
> end
>
> the rspec show me "expected valid? to return false, got true". but
> when I run the application in firefox, and if I leave the password
> field empty, the form will give errors. I also run irb: @user =
> User.new( :email => "g...@gag.com", :password =
> nil, :password_confirmation = 'a' * 10), the @user.valid? returned
> false.
>
> Why the rspec got true?
> .

--
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 rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate