On Sat, Jul 5, 2008 at 10:03 AM, John Knox <[EMAIL PROTECTED]> wrote: > > But the auto-generated specifications created by "script/generate > rspec_scaffold...", etc, assume that one is using a sequential integer > primary key.
That's just the fixtures in spec/fixtures. They're using the old fixture style, where all the IDs are hardcoded. You can modify the fixtures easily enough simply by removing the ID field from each of them; if you're using Rails 2.0 or higher, read up on the "foxy fixtures" behavior where it handles ID generation and associations in a much smarter way. Better yet, for more flexibility, get rid of the fixtures entirely and create your test data using some sort of factory method. If you're doing something fundamentally different with your data like UUID primary keys, you might _have_ to do this. The Peepcode screencasts about RSpec show easy examples of how to define create_foo() methods in your specs. Or you could use one of the various fixture replacement plugins/gems: Fixture Replacement 2: http://replacefixtures.rubyforge.org/ (This is the one I use. I love it.) Factory Girl: http://giantrobots.thoughtbot.com/2008/6/6/waiting-for-a-factory-girl can_has_fixtures: http://github.com/benburkert/can_has_fixtures/tree/master If you use any of these, you will of course end up having to change the autogenerated specs in spec/models. But for models at least, the RSpec generator puts virtually nothing in, so that only means changing one or two lines of code each time. I don't consider that much of a burden. -- Have Fun, Steve Eley Deep Salt Team _______________________________________________ rspec-users mailing list rspec-users@rubyforge.org http://rubyforge.org/mailman/listinfo/rspec-users