Re: assert_equal Test - how to test updates

vihrao
Tue, 02 Feb 2010 19:37:47 -0000

On Feb 2, 5:55 pm, vihrao <vih...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
wrote:
>
> Then I run it again by changing the method argument like this to update
> the
> sesison token
>  assert_equal  @bob1,
Guser.update_token("b...-pbC8P9QkocYAvxtiuMwx3w@public.gmane.org",
"bob",
> "77a138")
> It still gives a success message: 1 tests, 1 assertions, 0 failures, 0
> errors, 0 skips
>
> The new value of session token is never updated in the table column from
> ''77a38''  to ''77a138'' . Can you please
tell me how to update the sesison
> token
> if my glogin and login fields are found to match

assert_equal uses the == method to compare the two objects, and  == on
activerecord doesn''t compare attributes: it only compares the id of
the object (ie do the compared objects represent the same row in the
database)

Fred

--
Thank you.
To perform an update I have to find if the existing attribute(database
column) value is equal to new value that I pass, and then overwrite it if it
does not match. How can I test this situation - can you please tell me?


--
View this message in context: