Revision 38f854cd
Added by Tomer Brisker almost 6 years ago
test/models/user_test.rb | ||
---|---|---|
@user.save
|
||
|
||
recent_audit = @user.audits.last
|
||
audited_changes = recent_audit.audited_changes[:roles]
|
||
audited_changes = recent_audit.audited_changes[:role_ids]
|
||
|
||
assert audited_changes, 'No audits found for user-roles'
|
||
assert_empty audited_changes.first
|
||
assert_equal @role.name, audited_changes.last
|
||
assert_equal [@role.id], audited_changes.last
|
||
end
|
||
|
||
test 'should audit when a role is removed/de-assigned from a user' do
|
||
... | ... | |
@user.save
|
||
|
||
recent_audit = @user.audits.last
|
||
audited_changes = recent_audit.audited_changes[:roles]
|
||
audited_changes = recent_audit.audited_changes[:role_ids]
|
||
|
||
assert audited_changes, 'No audits found for user-roles'
|
||
assert_equal [Role.default.to_label, @role.to_label].sort.join(', '), audited_changes.first
|
||
assert_equal [[@role.id, Role.default.id], []], audited_changes
|
||
assert_empty audited_changes.last
|
||
end
|
||
|
Also available in: Unified diff
Fixes #23965 - Only save ids for association audits (#5753)
Otherwise, we have issues when trying to check revisions of the audit
since it will fail trying to assign a string to an attribute that
expects an object id.