fix tests

This commit is contained in:
r888888888
2017-04-04 12:25:03 -07:00
parent 347ffb5989
commit 0b8d4105aa
19 changed files with 111 additions and 162 deletions

View File

@@ -5,12 +5,16 @@ module PoolArchiveTestHelper
_, json = msg.split(/\n/)
json = JSON.parse(json)
prev = PoolArchive.where(pool_id: json["pool_id"]).order("id desc").first
if prev && prev.updater_ip_addr.to_s == json["updater_ip_addr"]
if merge?(prev, json)
prev.update_columns(json)
else
PoolArchive.create(json)
end
end
def merge?(prev, json)
prev && (prev.updater_id == json["updater_id"]) && (prev.updated_at >= 1.hour.ago)
end
end
PoolArchive.stubs(:sqs_service).returns(mock_sqs_service.new)