Class: RailsAuditLog::Matchers::CreateAuditLogEntry

Inherits:
Object
  • Object
show all
Defined in:
lib/rails_audit_log/matchers.rb

Instance Method Summary collapse

Constructor Details

#initialize(event:, touching:) ⇒ CreateAuditLogEntry

Returns a new instance of CreateAuditLogEntry.



53
54
55
56
# File 'lib/rails_audit_log/matchers.rb', line 53

def initialize(event:, touching:)
  @event    = event
  @touching = touching
end

Instance Method Details

#descriptionObject



82
83
84
# File 'lib/rails_audit_log/matchers.rb', line 82

def description
  "create an audit log entry#{qualifier}"
end

#failure_messageObject



74
75
76
# File 'lib/rails_audit_log/matchers.rb', line 74

def failure_message
  "expected block to create an audit log entry#{qualifier}, but none was created"
end

#failure_message_when_negatedObject



78
79
80
# File 'lib/rails_audit_log/matchers.rb', line 78

def failure_message_when_negated
  "expected block not to create an audit log entry#{qualifier}, but one was created"
end

#matches?(block) ⇒ Boolean

Returns:

  • (Boolean)


67
68
69
70
71
72
# File 'lib/rails_audit_log/matchers.rb', line 67

def matches?(block)
  @before = matching_scope.count
  block.call
  @after = matching_scope.count
  @after > @before
end

#supports_block_expectations?Boolean

Returns:

  • (Boolean)


63
64
65
# File 'lib/rails_audit_log/matchers.rb', line 63

def supports_block_expectations?
  true
end

#touching(attribute) ⇒ Object



58
59
60
61
# File 'lib/rails_audit_log/matchers.rb', line 58

def touching(attribute)
  @touching = attribute
  self
end