base.rb 1009 B

12345678910111213141516171819202122
  1. # Copyright (C) 2012-2024 Zammad Foundation, https://zammad-foundation.org/
  2. shared_context 'with core workflow base' do
  3. let(:group) { create(:group) }
  4. let(:ticket_created_at) { Time.zone.now }
  5. let(:ticket_title) { SecureRandom.uuid }
  6. let(:ticket_customer) { create(:customer) }
  7. let(:ticket) { create(:ticket, title: ticket_title, state: Ticket::State.find_by(name: 'pending reminder'), pending_time: 5.days.from_now, group: group, created_at: ticket_created_at, customer: ticket_customer, **additional_ticket_attributes) }
  8. let!(:base_payload) do
  9. {
  10. 'event' => 'core_workflow',
  11. 'request_id' => 'default',
  12. 'class_name' => 'Ticket',
  13. 'screen' => 'create_middle',
  14. 'params' => {},
  15. }
  16. end
  17. let(:additional_ticket_attributes) { {} }
  18. let(:payload) { base_payload }
  19. let!(:action_user) { create(:agent, groups: [ticket.group]) }
  20. let(:result) { CoreWorkflow.perform(payload: payload, user: action_user) }
  21. end