Added new FactoryBot factories for SLA and Calendar.

This commit is contained in:
Thorsten Eckel 2018-08-29 21:50:58 +02:00
parent ee176d3761
commit 7c1a4d413c
2 changed files with 61 additions and 0 deletions

View file

@ -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

19
spec/factories/sla.rb Normal file
View file

@ -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