link.rb 619 B

1234567891011121314151617
  1. FactoryBot.define do
  2. factory :link do
  3. transient do
  4. link_type { 'normal' }
  5. link_object_source { from.class.name }
  6. link_object_target { to.class.name }
  7. from { Ticket.first }
  8. to { Ticket.last }
  9. end
  10. link_type_id { Link::Type.create_if_not_exists(name: link_type, active: true).id }
  11. link_object_source_id { Link::Object.create_if_not_exists(name: link_object_source).id }
  12. link_object_target_id { Link::Object.create_if_not_exists(name: link_object_target).id }
  13. link_object_source_value { from.id }
  14. link_object_target_value { to.id }
  15. end
  16. end