paulelliott/fabrication — Issue #65: Fabricator load order should not be important
Author: pcastellazzi
Created: 2011-10-08 05:15:36+00:00
State: open

# some basic AR models
class Person < ActiveRecord::Base ; end
class KeyPerson < Person; end

# very simple fabricators
Fabricator(:person) { name 'Pablo' }
Fabricator(:key_person, :from => :person, :class_name, :key_person) {}

Let's assume every fabricator is in a different file. If person is loaded first and then key_person, it work as expected. If key_person is loaded first, it generate an empty object.

This kind of scenario should at least generate a warning like 'person fabricator is missing' or something like that.
May be a better solution will be to lazy build fabricators after load them.