STI and Fixtures

I'm trying to implement a TDD design pattern in Rails for the first time for a system maintenance reporting application, and running into issues with STI (also a first-time user) and fixtures causing my tests to throw errors.

class Report < ActiveRecord::Base   validates_presence_of :subject, :author, :category_id   validates_inclusion_of :status, :in => [true, false]   validates_inclusion_of :type, :in => ["MaintenanceReport", "OutageReport"] end

"Report" is the parent class I'm implementing. Each report - be it a maintenance report or an outage report - has the following:

(This is also my first fixture: reports.yml)

Fixtures are a bit odd - they're more table based than class based (sortof - hence the odd). If you stick everything in reports.yml you should be ok.

Fred

Frederick Cheung wrote: [...]

Fixtures are a bit odd - they're more table based than class based (sortof - hence the odd). If you stick everything in reports.yml you should be ok.

Or just use factories. At least with Machinist, they seem to work directly with the class structure. I've never used STI with Machinist, but I'd be *very* surprised, given Machinist's architecture, if it didn't work as expected, without the gotchas of fixtures.

Best,