Fixture variables not created

Posted on Sun Mar 12 03:55:00 UTC 2006

Given a fixture contacts.yml which contains:

patrick:
id: 1
name: patrick
email: patrick@tes.com

pre 1.0 solutions:

@contacts[“patrick”]  #using hash
@patrick              #using variable

solution 1:

contacts(:patrick)    #using accessor

solution 2:

@loaded_fixtures[“contacts”][“patrick”] #direct access (not recommended)

solution 3:

Edit the test/test_helper.rb and set

  self.use_instantiated_fixtures  = true

this way the fixture variables are created like they used to.

You can get more details from the man himself (Mike Clark’s Weblog).

Posted in Quid Pro Quo, Rails  |  Tags ,  |  1 comment

Comments

  1. jwm0z jwm0z said // Apr 27, 2006 at 12:08 AM

    I've been having the same problem, thanks for the tip it was driving me mad!

(leave url/email »)

Comment Markup Help