Agile Development Stumble

I am going through the Agile Web Development with Rails book, and in their tutorial, there’s a slight stumbling block I ran into. I figure if anyone else has this problem and is anything like me, they’ll google for it, so maybe this will help someone out there. A description of the issue and solution follows:

On page 145, it takes you through building some test cases for the shopping cart in the “depot” app we’re learning with.

In “products.yml”, the book has you create a few example records, for example:

version_control_book:
id: 1
title: Pragmatic Version Control
description: How to use version control
image_url: http://…/sk_svn_small.jpg
price: 29.95
date_available: 2005-01-26 00:00:00

The book then refers to this object as @version_control_book. This wasn’t working for me, however. I kept getting errors like this using the same examples they had:

After scratching my head for a while, I discovered it’s because in “test_helper.rb”, “self.use_instantiated_fixtures” was set to false. In order for the test methods to instantiate the objects by name from the YML files, this needs to be set to true. The book seems to be operating on the assumption that it’s set to true by default, but in the version of rails I was using, it wasn’t.

So, after setting “self.use_instantiated_fixtures = true” in test_helper.rb, I was good to go.

CHRIS is best identified by the ubiquitous camera around his neck. A true local, Chris is from Nashville, TN. He once had an ongoing argument with an artist behind an online political comic that lasted for several years. It turned out that their families were holler neighbors from many years ago, a modern-day Hatfields & McCoys. (If you understood any of those last two sentences, you are clearly from the south.) Two more fun facts just because: Chris bought one of his first cars from Dean Ween from the band Ween and he will beat you at chess.