Apparently the first time I posted this, it was tacked onto the end of
another thread. Please pardon my repost. Won’t happen again.
Howdy. I’m just getting into Rails, and really enjoying it! I’m coming
from the .NET world, so I’ll embarrassedly admit that I’m running it on
winXP and even using SQLServer (for now, may switch to mysql soon).
Hopefully someday I’ll feel competent enough on my mac to work there,
one new thing at a time!
Anyway, I am trying to be a good programmer and use TDD, but am having a
problem with a simple test, mostly copied from the examples on:
I generated my model classes and even got the scaffold working (ooh,
not TDD!!). I was starting out messing with unit tests and fixtures,
was taking baby steps. Ran into a hitch when it was saying that my
variable was nil:
require File.dirname(FILE) + ‘/…/test_helper’
class MessageTest < Test::Unit::TestCase
fixtures :messages, :tags, :messages_tags
@message = Message.find(1)
assert_kind_of Message, @message
assert_equal @messages[“peace_message”].title, @message.title
The three fixtures exist (messages, tags, messages_tags) and have data.
Brute force tests (assert_equal “my message title”, @message.title)
But the @messages[“peace_message”][“title”] returns an error. I added
assert_not_nil call and indeed, that fails. It seems like it should
automatically exist? What am I doing wrong?
Thanks for any help!