Improved observer for better testing.
This commit is contained in:
parent
1c8b9dabdc
commit
bcc72a9793
2 changed files with 7 additions and 5 deletions
|
@ -26,9 +26,11 @@ class Observer::Ticket::Article::FillupFromEmail < ActiveRecord::Observer
|
||||||
# clean subject
|
# clean subject
|
||||||
record.subject = ticket.subject_clean( record.subject )
|
record.subject = ticket.subject_clean( record.subject )
|
||||||
|
|
||||||
# generate message id
|
# generate message id, force it in prodution, in test allow to set it for testing reasons
|
||||||
|
if !record.message_id || Rails.env.production?
|
||||||
fqdn = Setting.get('fqdn')
|
fqdn = Setting.get('fqdn')
|
||||||
record.message_id = '<' + DateTime.current.to_s(:number) + '.' + record.ticket_id.to_s + '.' + rand(999_999).to_s() + '@' + fqdn + '>'
|
record.message_id = '<' + DateTime.current.to_s(:number) + '.' + record.ticket_id.to_s + '.' + rand(999_999).to_s() + '@' + fqdn + '>'
|
||||||
|
end
|
||||||
|
|
||||||
# generate message_id_md5
|
# generate message_id_md5
|
||||||
record.check_message_id_md5
|
record.check_message_id_md5
|
||||||
|
|
|
@ -2038,9 +2038,9 @@ Some Text',
|
||||||
ticket_id: ticket.id,
|
ticket_id: ticket.id,
|
||||||
from: 'some_sender@example.com',
|
from: 'some_sender@example.com',
|
||||||
to: 'some_recipient@example.com',
|
to: 'some_recipient@example.com',
|
||||||
subject: 'some subject',
|
subject: 'bounce check',
|
||||||
message_id: '<20150830145601.30.608881@edenhofer.zammad.com>',
|
message_id: '<20150830145601.30.608881@edenhofer.zammad.com>',
|
||||||
body: 'some message article',
|
body: 'some message bounce check',
|
||||||
internal: false,
|
internal: false,
|
||||||
sender: Ticket::Article::Sender.where(name: 'Agent').first,
|
sender: Ticket::Article::Sender.where(name: 'Agent').first,
|
||||||
type: Ticket::Article::Type.where(name: 'email').first,
|
type: Ticket::Article::Type.where(name: 'email').first,
|
||||||
|
|
Loading…
Reference in a new issue