Fixture access question


#1

Hi,
I want to add the basic model record create tests for my rails app
as in the “Agile Web D. with Rails” example:
i.e. (header stuff and boring repitition missed)

def test_create
assert_kind_of Requirement, requirements(:requirement_1)
assert_equal requirements[“requirement_1”][“name”],
requirements(:requirement_1).name
end

Now I’m not supposed to use requirements since that’s slow but
how do I now “get” to the Fixture values, as opposed to the
Requirement class object created from those values?
I thought that requirements(:requirement_1)[“created_on”]
would be the go but it worries me that:
requirements(:requirement_1).class is “Requirement”
and (when I turn it back on)
@requirements[“requirement_1”].class is “Fixture”

This is probably post Java programming paranoia but I’d
hate to write a bunch of tests validating that a=a :slight_smile:
I’ve had a read of the fixtures questions on the rails list, had a read
of
the HowtoUnitTest, read MikeClark’s Weblog but no-one seems
to do exactly this. I’m afraid my Ruby isn’t yet up to working this out
from
fixtures.rb (though I’ve had an interesting read)
Thanks in advance for any help.
Regards,
Tony