[Rails] Re: Unit test failure - nil object?

Luke Redpath
Wed, 22 Feb 2006 17:08:46 -0000

The error probably relates to you calling join() on
@user.errors.full_messages, not the save call.

Before that line, add a new assertion

assert_instance_of Array, @user.errors.full_messages

If that fails, then that is your problem.

On 2/22/06, Lindsay Boyd <lindsay.boyd@ntlworld.com>
wrote:
> Arrgh! Here''s the actual code I''m testing:
>
> >   def test_update
> >     assert_equal "jack@smiths.com", @user.email
> >     @user.email = "jack@smiths.org"
> >     assert @user.save, @user.errors.full_messages.join("; ")
> >     @user.reload
> >     assert_equal @user.email, "jack@smiths.org"
> >   end
>
> So, email jack@smiths.com -> jack@smiths.org, but as I say, the error is
> with the save method.
>
>
> --
> Posted via http://www.ruby-forum.com/.
> _______________________________________________
> Rails mailing list
> Rails@lists.rubyonrails.org
> http://lists.rubyonrails.org/mailman/listinfo/rails
>


--
Cheers,
Luke Redpath