lib/audited/rspec_matchers.rb in audited-4.2.2 vs lib/audited/rspec_matchers.rb in audited-4.3.0

- old
+ new

@@ -74,10 +74,12 @@ def negative_failure_message "Did not expect #{@expectation}" end + alias_method :failure_message_when_negated, :negative_failure_message + def description description = "audited" description += " associated with #{@options[:associated_with]}" if @options.key?(:associated_with) description += " only => #{@options[:only].join ', '}" if @options.key?(:only) description += " except => #{@options[:except].join(', ')}" if @options.key?(:except) @@ -147,10 +149,12 @@ def negative_failure_message "Expected #{model_class} to not have associated audits" end + alias_method :failure_message_when_negated, :negative_failure_message + def description "has associated audits" end protected @@ -162,12 +166,12 @@ def reflection model_class.reflect_on_association(:associated_audits) end def association_exists? - (!reflection.nil?) && + !reflection.nil? && reflection.macro == :has_many && - reflection.options[:class_name] == Audited.audit_class.name + reflection.options[:class_name] == Audit.name end end end end