Is there a way to override an association through a call to
Factory.create?
Factory.define :foo do |f|
f.name = 'fowled up'
f.time = DateTime.now
f.status { |a| a.association(:somewhat_beyond_all_recognition)}
end
Factory.define :somewhat_ beyond_all_recognition, :class => Bar do |b|
b.status = 'a minor disaster'
b.time = DateTime.now
...
end
Factory.define :extremely_ beyond_all_recognition, :class => Bar do |
b|
b.status = 'a major disaster'
b.time = Time.new(2004, 1, 1)
...
end
So, I'd like to be able to change f.status association to
use :somewhat_beyond_all_recognition.
Factory.create(:foo, ?)