article.rb 917 B

1234567891011121314151617181920212223242526272829
  1. FactoryBot.define do
  2. factory :'ticket/article', aliases: %i[ticket_article] do
  3. transient do
  4. type_name { 'email' }
  5. sender_name { 'Customer' }
  6. end
  7. association :ticket, strategy: :create # or else build(:ticket_article).save fails
  8. from { 'factory-customer-1@example.com' }
  9. to { 'factory-customer-1@example.com' }
  10. subject { 'factory article' }
  11. message_id { 'factory@id_com_1' }
  12. body { 'some message 123' }
  13. internal { false }
  14. sender { Ticket::Article::Sender.find_by(name: sender_name) }
  15. type { Ticket::Article::Type.find_by(name: type_name) }
  16. updated_by_id { 1 }
  17. created_by_id { 1 }
  18. factory :twitter_article do
  19. transient do
  20. type_name { 'twitter status' }
  21. end
  22. association :ticket, factory: :twitter_ticket
  23. body { Faker::Lorem.sentence }
  24. end
  25. end
  26. end