module Audited::RspecMatchers

Public Instance Methods

be_audited() click to toggle source

Ensure that the model is audited.

Options:

  • associated_with - tests that the audit makes use of the associated_with option

  • only - tests that the audit makes use of the only option *Overrides except option*

  • except - tests that the audit makes use of the except option

  • requires_comment - if specified, then the audit must require comments through the audit_comment attribute

  • on - tests that the audit makes use of the on option with specified parameters

Example:

it { should be_audited }
it { should be_audited.associated_with(:user) }
it { should be_audited.only(:field_name) }
it { should be_audited.except(:password) }
it { should be_audited.requires_comment }
it { should be_audited.on(:create).associated_with(:user).except(:password) }
# File lib/audited/rspec_matchers.rb, line 20
def be_audited
  AuditMatcher.new
end
have_associated_audits() click to toggle source

Ensure that the model has associated audits

Example:

it { should have_associated_audits }
# File lib/audited/rspec_matchers.rb, line 29
def have_associated_audits
  AssociatedAuditMatcher.new
end