diff --git a/test/unit/ticket_notification_test.rb b/test/unit/ticket_notification_test.rb index 75505aa6b..031f254d9 100644 --- a/test/unit/ticket_notification_test.rb +++ b/test/unit/ticket_notification_test.rb @@ -70,7 +70,7 @@ class TicketNotificationTest < ActiveSupport::TestCase updated_by_id: customer.id, created_by_id: customer.id, ) - article_inbound = Ticket::Article.create( + Ticket::Article.create( ticket_id: ticket1.id, from: 'some_sender@example.com', to: 'some_recipient@example.com', @@ -109,7 +109,7 @@ class TicketNotificationTest < ActiveSupport::TestCase assert_equal( 2, notification_check(ticket1, agent2), ticket1.id ) # add article to ticket - article_note = Ticket::Article.create( + Ticket::Article.create( ticket_id: ticket1.id, from: 'some person', subject: 'some note', @@ -134,7 +134,7 @@ class TicketNotificationTest < ActiveSupport::TestCase ticket1.owner_id = agent1.id ticket1.updated_by_id = agent1.id ticket1.save - article_note = Ticket::Article.create( + Ticket::Article.create( ticket_id: ticket1.id, from: 'some person', subject: 'some note', @@ -166,7 +166,7 @@ class TicketNotificationTest < ActiveSupport::TestCase updated_by_id: agent1.id, created_by_id: agent1.id, ) - article_inbound = Ticket::Article.create( + Ticket::Article.create( ticket_id: ticket2.id, from: 'some_sender@example.com', to: 'some_recipient@example.com', @@ -321,7 +321,7 @@ class TicketNotificationTest < ActiveSupport::TestCase updated_by_id: customer.id, created_by_id: customer.id, ) - article_inbound = Ticket::Article.create( + Ticket::Article.create( ticket_id: ticket1.id, from: 'some_sender@example.com', to: 'some_recipient@example.com', @@ -344,28 +344,28 @@ class TicketNotificationTest < ActiveSupport::TestCase ticket1.priority = Ticket::Priority.lookup( name: '3 high' ) ticket1.save - list = EventBuffer.list - listObjects = Observer::Ticket::Notification.get_uniq_changes(list) + list = EventBuffer.list + list_objects = Observer::Ticket::Notification.get_uniq_changes(list) - assert_equal( 'some notification event test 1', listObjects[ticket1.id][:changes]['title'][0] ) - assert_equal( 'some notification event test 1 - #2', listObjects[ticket1.id][:changes]['title'][1] ) - assert_not( listObjects[ticket1.id][:changes]['priority'] ) - assert_equal( 2, listObjects[ticket1.id][:changes]['priority_id'][0] ) - assert_equal( 3, listObjects[ticket1.id][:changes]['priority_id'][1] ) + assert_equal( 'some notification event test 1', list_objects[ticket1.id][:changes]['title'][0] ) + assert_equal( 'some notification event test 1 - #2', list_objects[ticket1.id][:changes]['title'][1] ) + assert_not( list_objects[ticket1.id][:changes]['priority'] ) + assert_equal( 2, list_objects[ticket1.id][:changes]['priority_id'][0] ) + assert_equal( 3, list_objects[ticket1.id][:changes]['priority_id'][1] ) # update ticket attributes ticket1.title = "#{ticket1.title} - #3" ticket1.priority = Ticket::Priority.lookup( name: '1 low' ) ticket1.save - list = EventBuffer.list - listObjects = Observer::Ticket::Notification.get_uniq_changes(list) + list = EventBuffer.list + list_objects = Observer::Ticket::Notification.get_uniq_changes(list) - assert_equal( 'some notification event test 1', listObjects[ticket1.id][:changes]['title'][0] ) - assert_equal( 'some notification event test 1 - #2 - #3', listObjects[ticket1.id][:changes]['title'][1] ) - assert_not( listObjects[ticket1.id][:changes]['priority'] ) - assert_equal( 2, listObjects[ticket1.id][:changes]['priority_id'][0] ) - assert_equal( 1, listObjects[ticket1.id][:changes]['priority_id'][1] ) + assert_equal( 'some notification event test 1', list_objects[ticket1.id][:changes]['title'][0] ) + assert_equal( 'some notification event test 1 - #2 - #3', list_objects[ticket1.id][:changes]['title'][1] ) + assert_not( list_objects[ticket1.id][:changes]['priority'] ) + assert_equal( 2, list_objects[ticket1.id][:changes]['priority_id'][0] ) + assert_equal( 1, list_objects[ticket1.id][:changes]['priority_id'][1] ) end @@ -402,7 +402,7 @@ class TicketNotificationTest < ActiveSupport::TestCase type: 'update', changes: { 'priority_id' => [1, 2], - 'pending_time' => [nil, Time.parse('2015-01-11 23:33:47 UTC')], + 'pending_time' => [nil, Time.zone.parse('2015-01-11 23:33:47 UTC')], }, ) diff --git a/test/unit/ticket_sla_test.rb b/test/unit/ticket_sla_test.rb index 3bacb6ba8..e9852872c 100644 --- a/test/unit/ticket_sla_test.rb +++ b/test/unit/ticket_sla_test.rb @@ -750,7 +750,7 @@ class TicketSlaTest < ActiveSupport::TestCase assert( ticket, 'ticket created' ) # state change to open from pending - History.add( + History.add( history_type: 'updated', history_object: 'Ticket', history_attribute: 'state', diff --git a/test/unit/ticket_test.rb b/test/unit/ticket_test.rb index fc8d303d3..bf4d8e490 100644 --- a/test/unit/ticket_test.rb +++ b/test/unit/ticket_test.rb @@ -102,12 +102,12 @@ class TicketTest < ActiveSupport::TestCase # set pending time ticket.state_id = Ticket::State.where(name: 'pending reminder').first.id - ticket.pending_time = Time.parse('1977-10-27 22:00:00 +0000') + ticket.pending_time = Time.zone.parse('1977-10-27 22:00:00 +0000') ticket.save ticket = Ticket.find(ticket.id) assert_equal( ticket.state.name, 'pending reminder', 'state verify' ) - assert_equal( ticket.pending_time, Time.parse('1977-10-27 22:00:00 +0000'), 'pending_time verify' ) + assert_equal( ticket.pending_time, Time.zone.parse('1977-10-27 22:00:00 +0000'), 'pending_time verify' ) # reset pending state, should also reset pending time ticket.state_id = Ticket::State.where(name: 'closed').first.id diff --git a/test/unit/working_time_test.rb b/test/unit/working_time_test.rb index ce4a2a0e3..f44ecf7b4 100644 --- a/test/unit/working_time_test.rb +++ b/test/unit/working_time_test.rb @@ -548,7 +548,7 @@ class WorkingTimeTest < ActiveSupport::TestCase ] tests.each { |test| dest_time = TimeCalculation.dest_time( test[:start] + ' UTC', test[:diff], test[:config], test[:timezone] ) - assert_equal( dest_time.gmtime, Time.parse( test[:dest_time] + ' UTC' ), "dest time - #{test[:dest_time]}" ) + assert_equal( dest_time.gmtime, Time.zone.parse( test[:dest_time] + ' UTC' ), "dest time - #{test[:dest_time]}" ) } end