Improved timings.

This commit is contained in:
Martin Edenhofer 2016-05-21 17:40:40 +02:00
parent 4c55ca4121
commit 22f9f59a9a
3 changed files with 86 additions and 86 deletions

View file

@ -81,10 +81,10 @@ class CacheTest < ActiveSupport::TestCase
key: 'some valueöäüß2', key: 'some valueöäüß2',
}, },
param: { param: {
expires_in: 5.seconds, expires_in: 3.seconds,
} }
}, },
sleep: 10, sleep: 5,
verify: { verify: {
key: '123', key: '123',
data: nil data: nil

View file

@ -75,41 +75,41 @@ class OrganizationRefObjectTouchTest < ActiveSupport::TestCase
assert_equal(ticket.customer.id, customer1.id ) assert_equal(ticket.customer.id, customer1.id )
assert_equal(ticket.organization.id, organization1.id ) assert_equal(ticket.organization.id, organization1.id )
sleep 6 sleep 4
organization1.name = 'Ref Object Update Org 1/1' organization1.name = 'Ref Object Update Org 1/1'
organization1.save organization1.save
# check if ticket and customer has been touched # check if ticket and customer has been touched
ticket = Ticket.find(ticket.id) ticket = Ticket.find(ticket.id)
if ticket.updated_at > 4.seconds.ago if ticket.updated_at > 2.seconds.ago
assert(true, 'ticket.updated_at has been updated') assert(true, 'ticket.updated_at has been updated')
else else
assert(false, 'ticket.updated_at has not been updated') assert(false, 'ticket.updated_at has not been updated')
end end
customer1 = User.find(customer1.id) customer1 = User.find(customer1.id)
if customer1.updated_at > 4.seconds.ago if customer1.updated_at > 2.seconds.ago
assert(true, 'customer1.updated_at has been updated') assert(true, 'customer1.updated_at has been updated')
else else
assert(false, 'customer1.updated_at has not been updated') assert(false, 'customer1.updated_at has not been updated')
end end
sleep 6 sleep 4
customer2.organization_id = organization1.id customer2.organization_id = organization1.id
customer2.save customer2.save
# check if customer1 and organization has been touched # check if customer1 and organization has been touched
customer1 = User.find(customer1.id) customer1 = User.find(customer1.id)
if customer1.updated_at > 4.seconds.ago if customer1.updated_at > 2.seconds.ago
assert(true, 'customer1.updated_at has been updated') assert(true, 'customer1.updated_at has been updated')
else else
assert(false, 'customer1.updated_at has not been updated') assert(false, 'customer1.updated_at has not been updated')
end end
organization1 = Organization.find(organization1.id) organization1 = Organization.find(organization1.id)
if organization1.updated_at > 4.seconds.ago if organization1.updated_at > 2.seconds.ago
assert(true, 'organization1.updated_at has been updated') assert(true, 'organization1.updated_at has been updated')
else else
assert(false, 'organization1.updated_at has not been updated') assert(false, 'organization1.updated_at has not been updated')