history.rb 350 B

123456789101112131415
  1. FactoryBot.define do
  2. factory :history do
  3. transient do
  4. o { Ticket.first }
  5. end
  6. association :history_type, factory: :'history/type'
  7. o_id { o.id }
  8. created_by_id { 1 }
  9. history_object_id do
  10. History::Object.lookup(name: o.class.name)&.id || create(:'history/object', name: o.class.name).id
  11. end
  12. end
  13. end