Improved stability of test.

This commit is contained in:
Martin Edenhofer 2018-06-19 22:33:12 +02:00
parent 1aeb5b3f12
commit 577776c324

View file

@ -115,7 +115,7 @@ class TicketEscalationTest < ActiveSupport::TestCase
ticket.save! ticket.save!
assert_not(ticket.has_changes_to_save?) assert_not(ticket.has_changes_to_save?)
assert(ticket.escalation_at) assert(ticket.escalation_at)
assert_equal((ticket_escalation_at - 30.minutes).to_s, ticket.escalation_at.to_s) assert_in_delta((ticket_escalation_at - 30.minutes).to_i, ticket.escalation_at.to_i, 90)
sla.destroy! sla.destroy!
calendar.destroy! calendar.destroy!
@ -192,10 +192,10 @@ Some Text"
ticket_p, article_p, user_p, mail = Channel::EmailParser.new.process({}, email) ticket_p, article_p, user_p, mail = Channel::EmailParser.new.process({}, email)
ticket_p.reload ticket_p.reload
assert(ticket_p.escalation_at) assert(ticket_p.escalation_at)
assert_in_delta(ticket_p.first_response_escalation_at.to_i, (ticket_p.created_at + 1.hour).to_i, 120) assert_in_delta(ticket_p.first_response_escalation_at.to_i, (ticket_p.created_at + 1.hour).to_i, 90)
assert_in_delta(ticket_p.update_escalation_at.to_i, (ticket_p.created_at + 3.hours).to_i, 120) assert_in_delta(ticket_p.update_escalation_at.to_i, (ticket_p.created_at + 3.hours).to_i, 90)
assert_in_delta(ticket_p.close_escalation_at.to_i, (ticket_p.created_at + 4.hours).to_i, 120) assert_in_delta(ticket_p.close_escalation_at.to_i, (ticket_p.created_at + 4.hours).to_i, 90)
assert_in_delta(ticket_p.escalation_at.to_i, (ticket_p.created_at + 1.hour).to_i, 120) assert_in_delta(ticket_p.escalation_at.to_i, (ticket_p.created_at + 1.hour).to_i, 90)
travel 3.hours travel 3.hours
article = nil article = nil
@ -217,10 +217,10 @@ Some Text"
end end
ticket_p.reload ticket_p.reload
assert_in_delta(ticket_p.first_response_escalation_at.to_i, (ticket_p.created_at + 1.hour).to_i, 120) assert_in_delta(ticket_p.first_response_escalation_at.to_i, (ticket_p.created_at + 1.hour).to_i, 90)
assert_in_delta(ticket_p.update_escalation_at.to_i, (ticket_p.last_contact_agent_at + 3.hours).to_i, 120) assert_in_delta(ticket_p.update_escalation_at.to_i, (ticket_p.last_contact_agent_at + 3.hours).to_i, 90)
assert_in_delta(ticket_p.close_escalation_at.to_i, (ticket_p.created_at + 4.hours).to_i, 120) assert_in_delta(ticket_p.close_escalation_at.to_i, (ticket_p.created_at + 4.hours).to_i, 90)
assert_in_delta(ticket_p.escalation_at.to_i, (ticket_p.created_at + 4.hours).to_i, 120) assert_in_delta(ticket_p.escalation_at.to_i, (ticket_p.created_at + 4.hours).to_i, 90)
end end
end end