This project is archived and is in readonly mode.

#3563 ✓committed
Sam Ruby

[PATCH] Generate fixture data for empty models

Reported by Sam Ruby | December 11th, 2009 @ 06:37 PM | in 3.0.2

In Agile Web Development with Rails, Edition Four, I'm intending to define a Cart model thus:

class Cart < ActiveRecord::Base
  has_many :line_items, :dependent=>:destroy

So I start off easily enough:

ruby script/generate scaffold cart

This generates both a test/functional/carts_controller_test.rb and a test/fixtures/carts.yml. Unfortunately, the generated tests will not pass as generated as there are no fixtures name one and two, nor is there even an indication of what needs to be done in the fixture itself.

I figured I could explain this in the book, or I could simply provide a patch to eliminate the need to explain this, and hence the patch.

Comments and changes to this ticket

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile »

<h2 style="font-size: 14px">Tickets have moved to Github</h2>

The new ticket tracker is available at <a href=""></a>

People watching this ticket


Referenced by