Code works in console but fails test?


#1

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.

http://pastie.caboo.se/84337


#2

Hi, please post the exact statement that you’re typing in the console.
-Conrad


#3

u = User.find :first
then

u.messages.size
the output is three


#4

tests are run against the test database, so it will be empty unless
you create some messages for your user in fixtures or otherwise.