diff --git a/spec/factories/calendar.rb b/spec/factories/calendar.rb new file mode 100644 index 000000000..e9098ddab --- /dev/null +++ b/spec/factories/calendar.rb @@ -0,0 +1,42 @@ +FactoryBot.define do + factory :calendar do + sequence(:name) { |n| "Escalation Test #{n}" } + timezone 'Europe/Berlin' + default true + ical_url nil + business_hours do + { + mon: { + active: true, + timeframes: [['09:00', '17:00']] + }, + tue: { + active: true, + timeframes: [['09:00', '17:00']] + }, + wed: { + active: true, + timeframes: [['09:00', '17:00']] + }, + thu: { + active: true, + timeframes: [['09:00', '17:00']] + }, + fri: { + active: true, + timeframes: [['09:00', '17:00']] + }, + sat: { + active: false, + timeframes: [['09:00', '17:00']] + }, + sun: { + active: false, + timeframes: [['09:00', '17:00']] + } + } + end + created_by_id 1 + updated_by_id 1 + end +end diff --git a/spec/factories/sla.rb b/spec/factories/sla.rb new file mode 100644 index 000000000..c32a6e5a3 --- /dev/null +++ b/spec/factories/sla.rb @@ -0,0 +1,19 @@ +FactoryBot.define do + factory :sla do + sequence(:name) { |n| "SLA #{n}" } + first_response_time nil + update_time nil + solution_time nil + calendar { create(:calendar) } + condition do + { + 'ticket.state_id' => { + operator: 'is', + value: Ticket::State.by_category(:open).pluck(:id), + }, + } + end + created_by_id 1 + updated_by_id 1 + end +end