module OvirtRefresherSpecCommon
  extend ActiveSupport::Concern

  def serialize_inventory(models = [])
    skip_attributes = %w(updated_on last_refresh_date updated_at last_updated finish_time)
    inventory = {}
    models.each do |model|
      inventory[model.name] = model.all.collect do |rec|
        rec.attributes.except(*skip_attributes)
      end.sort { |rec| rec["id"] }
    end
    inventory
  end
end

module OvirtRefresherSpecCommon
  extend ActiveSupport::Concern

  def serialize_inventory(models = [])
    skip_attributes = %w(updated_on last_refresh_date updated_at last_updated finish_time)
    inventory = {}
    models.each do |model|
      inventory[model.name] = model.all.collect do |rec|
        rec.attributes.except(*skip_attributes)
      end.sort_by { |rec| rec["id"] }
    end
    inventory
  end
end

Fix sporadic test failure on sorting IDs
Fix sporadic test failure on sorting IDs

When comparing whole tables we need to sort by id, this was done with
`#sort` instead of `#sort_by` leading to sporadic failures.
