Ruby on Rails Monday, July 21, 2014

On Jul 21, 2014, at 10:53 AM, Roelof Wobben <rwobben@hotmail.com> wrote:

> Hello,
>
> I checked and double checked it but it looks allright to me.
>
> I even copy/paste it to my files but still no luck.
>
> The problem must be somewhere here:
>
> describe "with a password that's too short" do
> before { @user.password = @user.password_confirmation = "a" * 5 }
> it { should be_invalid }
> end
>
> describe "return value of authenticate method" do
> before { @user.save }
> let(:found_user) { User.find_by(email: @user.email) }
>
> describe "with valid password" do
> it { should eq found_user.authenticate(@user.password) }
> end
>
> describe "with invalid password" do
> let(:user_for_invalid_password) { found_user.authenticate("invalid") }
>
> it { should_not eq user_for_invalid_password }
> specify { expect(user_for_invalid_password).to be_false }
> end
> end
> end

So... You really can't figure out any reason why found_user would be nil? (Actually, there's lots here that looks suspect. But one step at a time, focus on your current problem.)

--
Scott Ribe
scott_ribe@elevated-dev.com
http://www.elevated-dev.com/
(303) 722-0567 voice




--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/9A38B5AE-6684-41FC-85A4-53E35EA14648%40elevated-dev.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment