Some rubocop successions.

This commit is contained in:
Martin Edenhofer 2015-04-27 19:42:59 +02:00
parent ca0d651262
commit 91027a8309
4 changed files with 24 additions and 24 deletions

View file

@ -70,7 +70,7 @@ class TicketNotificationTest < ActiveSupport::TestCase
updated_by_id: customer.id, updated_by_id: customer.id,
created_by_id: customer.id, created_by_id: customer.id,
) )
article_inbound = Ticket::Article.create( Ticket::Article.create(
ticket_id: ticket1.id, ticket_id: ticket1.id,
from: 'some_sender@example.com', from: 'some_sender@example.com',
to: 'some_recipient@example.com', to: 'some_recipient@example.com',
@ -109,7 +109,7 @@ class TicketNotificationTest < ActiveSupport::TestCase
assert_equal( 2, notification_check(ticket1, agent2), ticket1.id ) assert_equal( 2, notification_check(ticket1, agent2), ticket1.id )
# add article to ticket # add article to ticket
article_note = Ticket::Article.create( Ticket::Article.create(
ticket_id: ticket1.id, ticket_id: ticket1.id,
from: 'some person', from: 'some person',
subject: 'some note', subject: 'some note',
@ -134,7 +134,7 @@ class TicketNotificationTest < ActiveSupport::TestCase
ticket1.owner_id = agent1.id ticket1.owner_id = agent1.id
ticket1.updated_by_id = agent1.id ticket1.updated_by_id = agent1.id
ticket1.save ticket1.save
article_note = Ticket::Article.create( Ticket::Article.create(
ticket_id: ticket1.id, ticket_id: ticket1.id,
from: 'some person', from: 'some person',
subject: 'some note', subject: 'some note',
@ -166,7 +166,7 @@ class TicketNotificationTest < ActiveSupport::TestCase
updated_by_id: agent1.id, updated_by_id: agent1.id,
created_by_id: agent1.id, created_by_id: agent1.id,
) )
article_inbound = Ticket::Article.create( Ticket::Article.create(
ticket_id: ticket2.id, ticket_id: ticket2.id,
from: 'some_sender@example.com', from: 'some_sender@example.com',
to: 'some_recipient@example.com', to: 'some_recipient@example.com',
@ -321,7 +321,7 @@ class TicketNotificationTest < ActiveSupport::TestCase
updated_by_id: customer.id, updated_by_id: customer.id,
created_by_id: customer.id, created_by_id: customer.id,
) )
article_inbound = Ticket::Article.create( Ticket::Article.create(
ticket_id: ticket1.id, ticket_id: ticket1.id,
from: 'some_sender@example.com', from: 'some_sender@example.com',
to: 'some_recipient@example.com', to: 'some_recipient@example.com',
@ -344,28 +344,28 @@ class TicketNotificationTest < ActiveSupport::TestCase
ticket1.priority = Ticket::Priority.lookup( name: '3 high' ) ticket1.priority = Ticket::Priority.lookup( name: '3 high' )
ticket1.save ticket1.save
list = EventBuffer.list list = EventBuffer.list
listObjects = Observer::Ticket::Notification.get_uniq_changes(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', list_objects[ticket1.id][:changes]['title'][0] )
assert_equal( 'some notification event test 1 - #2', listObjects[ticket1.id][:changes]['title'][1] ) assert_equal( 'some notification event test 1 - #2', list_objects[ticket1.id][:changes]['title'][1] )
assert_not( listObjects[ticket1.id][:changes]['priority'] ) assert_not( list_objects[ticket1.id][:changes]['priority'] )
assert_equal( 2, listObjects[ticket1.id][:changes]['priority_id'][0] ) assert_equal( 2, list_objects[ticket1.id][:changes]['priority_id'][0] )
assert_equal( 3, listObjects[ticket1.id][:changes]['priority_id'][1] ) assert_equal( 3, list_objects[ticket1.id][:changes]['priority_id'][1] )
# update ticket attributes # update ticket attributes
ticket1.title = "#{ticket1.title} - #3" ticket1.title = "#{ticket1.title} - #3"
ticket1.priority = Ticket::Priority.lookup( name: '1 low' ) ticket1.priority = Ticket::Priority.lookup( name: '1 low' )
ticket1.save ticket1.save
list = EventBuffer.list list = EventBuffer.list
listObjects = Observer::Ticket::Notification.get_uniq_changes(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', list_objects[ticket1.id][:changes]['title'][0] )
assert_equal( 'some notification event test 1 - #2 - #3', listObjects[ticket1.id][:changes]['title'][1] ) assert_equal( 'some notification event test 1 - #2 - #3', list_objects[ticket1.id][:changes]['title'][1] )
assert_not( listObjects[ticket1.id][:changes]['priority'] ) assert_not( list_objects[ticket1.id][:changes]['priority'] )
assert_equal( 2, listObjects[ticket1.id][:changes]['priority_id'][0] ) assert_equal( 2, list_objects[ticket1.id][:changes]['priority_id'][0] )
assert_equal( 1, listObjects[ticket1.id][:changes]['priority_id'][1] ) assert_equal( 1, list_objects[ticket1.id][:changes]['priority_id'][1] )
end end
@ -402,7 +402,7 @@ class TicketNotificationTest < ActiveSupport::TestCase
type: 'update', type: 'update',
changes: { changes: {
'priority_id' => [1, 2], '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')],
}, },
) )

View file

@ -750,7 +750,7 @@ class TicketSlaTest < ActiveSupport::TestCase
assert( ticket, 'ticket created' ) assert( ticket, 'ticket created' )
# state change to open from pending # state change to open from pending
History.add( History.add(
history_type: 'updated', history_type: 'updated',
history_object: 'Ticket', history_object: 'Ticket',
history_attribute: 'state', history_attribute: 'state',

View file

@ -102,12 +102,12 @@ class TicketTest < ActiveSupport::TestCase
# set pending time # set pending time
ticket.state_id = Ticket::State.where(name: 'pending reminder').first.id 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.save
ticket = Ticket.find(ticket.id) ticket = Ticket.find(ticket.id)
assert_equal( ticket.state.name, 'pending reminder', 'state verify' ) 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 # reset pending state, should also reset pending time
ticket.state_id = Ticket::State.where(name: 'closed').first.id ticket.state_id = Ticket::State.where(name: 'closed').first.id

View file

@ -548,7 +548,7 @@ class WorkingTimeTest < ActiveSupport::TestCase
] ]
tests.each { |test| tests.each { |test|
dest_time = TimeCalculation.dest_time( test[:start] + ' UTC', test[:diff], test[:config], test[:timezone] ) 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 end