Skip to content

Commit

Permalink
Update tests to reflect audit_comment validation changes
Browse files Browse the repository at this point in the history
  • Loading branch information
jeffdill2 committed Mar 20, 2018
1 parent fae0b64 commit aa4ac78
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions lib/audited/rspec_matchers.rb
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ def records_changes_to_specified_fields?

def comment_required_valid?
expects "to require audit_comment before #{model_class.audited_options[:on]} when comment required"
validate_callbacks_include_presence_of_comment? && destroy_callbacks_include_comment_required?
validations_include_presence_of_comment? && destroy_callbacks_include_comment_required?
end

def only_audit_on_designated_callbacks?
Expand All @@ -128,9 +128,9 @@ def only_audit_on_designated_callbacks?
end.compact.all?
end

def validate_callbacks_include_presence_of_comment?
def validations_include_presence_of_comment?
if @options[:comment_required] && audited_on_create_or_update?
callbacks_for(:validate).include?(:presence_of_audit_comment)
model_class.validators_on(:audit_comment).present?
else
true
end
Expand Down

0 comments on commit aa4ac78

Please sign in to comment.