state.rb 774 B

123456789101112131415161718192021
  1. FactoryBot.define do
  2. factory :'ticket/state', aliases: %i[ticket_state] do
  3. name do
  4. # The following line ensures that the name generated by Faker
  5. # does not conflict with any existing names in the DB.
  6. # There's a special syntax for this
  7. # (Faker::Verb.unique.exclude(:past_participle, [], Ticket::State.pluck(:name)),
  8. # but it's not available yet in the current release of Faker (1.9.1).
  9. Faker::Verb.unique
  10. .instance_variable_get(:@previous_results)
  11. .dig([:past_participle, []])
  12. .merge(Ticket::State.pluck(:name))
  13. Faker::Verb.unique.past_participle
  14. end
  15. association :state_type, factory: :'ticket/state_type'
  16. updated_by_id { 1 }
  17. created_by_id { 1 }
  18. end
  19. end