Actions
Bug #14064
closedPuppetclass#hostgroups_count should be excluded from auditing
Description
On Rails 4.2, the hostgroups_count cached counter on Puppetclass is now getting updated when a HostgroupClass record is created. This causes the following test to fail, as an audit entry is created for the HostgroupClass and a second for the new hostgroups_count attribute update:
1) Failure: HostgroupClassTest#test_0001_when creating a new hostgroup class object, an audit entry needs to be added [test/unit/hostgroup_class_test.rb:13]: "Audit.count" didn't change by 1. Expected: 2 Actual: 3
The second audit entry looks like:
#<Audited::Adapters::ActiveRecord::Audit:0x0000000a6a9b68 id: 980190964, auditable_id: 980190962, auditable_type: "Puppetclass", user_id: 135138680, user_type: nil, username: "Admin User", action: "update", audited_changes: {"hostgroups_count"=>[0, 1]}, version: 1, comment: nil, associated_id: nil, associated_type: nil, request_uuid: "1ce91154-9533-44f3-9431-7842dd534ac7", created_at: Mon, 07 Mar 2016 09:22:12 UTC +00:00, remote_address: nil, auditable_name: "base", associated_name: nil>]
Actions