in Quid Pro Quo, Rails

Fixture variables not created

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).

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

Comments are closed.