Forum: Ruby on Rails Code works in console but fails test?

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
Brian S. (Guest)
on 2007-08-02 18:35
(Received via mailing list)
So I have message model and each user has many messages. When I run
user.messages in the console it returns correctly, however in the test
it returns and empty collection? Any thoughts. All the sql is being
generate correctly, I checked the log. Here's a pastie with the code
in question.
Conrad T. (Guest)
on 2007-08-02 18:43
(Received via mailing list)
Hi, please post the exact statement that you're typing in the console.
Brian S. (Guest)
on 2007-08-02 19:06
(Received via mailing list)
u = User.find :first

the output is three
Jeff E. (Guest)
on 2007-08-03 06:17
(Received via mailing list)
tests are run against the test database, so it will be empty unless
you create some messages for your user in fixtures or otherwise.
This topic is locked and can not be replied to.