Topic: Finding out what's invalid

I'm having a problem with an isvalid? unit test that is failing. How do I find out the reason that it's invalid.

I've tried doing:

assert d.errors.invalid?('task')

where task is the thing I think is causing the problem, but no matter what I put instead of task I can't seem to find out what is invalid.

Re: Finding out what's invalid

How about:

assert_not_nil d.errors.on(:task)

vinnie - rails forum admin

Re: Finding out what's invalid

That has the same result as 'task'.  The problem is that I wasn't sure whether it was task or something else that was invalid.

I've actually found the answer though, by doing

puts d.errors.full_messages

after the assertion to see if it's valid, I can get it to print out what is invalid.  Now I've just got to work out why it's invalid.

Re: Finding out what's invalid

Ignore my first sentence, I didn't read the code you gave me properly.  However, my solution still stands, even if it's not the best way of doing it!