Class: RailsAuditLog::Matchers::CreateAuditLogEntry
- Inherits:
-
Object
- Object
- RailsAuditLog::Matchers::CreateAuditLogEntry
- Defined in:
- lib/rails_audit_log/matchers.rb
Overview
RSpec matcher — asserts that a block creates a new matching entry.
Instance Method Summary collapse
- #description ⇒ Object private
- #failure_message ⇒ Object private
- #failure_message_when_negated ⇒ Object private
-
#initialize(event:, touching:) ⇒ CreateAuditLogEntry
constructor
A new instance of CreateAuditLogEntry.
- #matches?(block) ⇒ Boolean private
- #supports_block_expectations? ⇒ Boolean private
-
#touching(attribute) ⇒ self
Chains an attribute filter onto the matcher.
Constructor Details
#initialize(event:, touching:) ⇒ CreateAuditLogEntry
Returns a new instance of CreateAuditLogEntry.
100 101 102 103 |
# File 'lib/rails_audit_log/matchers.rb', line 100 def initialize(event:, touching:) @event = event @touching = touching end |
Instance Method Details
#description ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
138 139 140 |
# File 'lib/rails_audit_log/matchers.rb', line 138 def description "create an audit log entry#{qualifier}" end |
#failure_message ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
128 129 130 |
# File 'lib/rails_audit_log/matchers.rb', line 128 def "expected block to create an audit log entry#{qualifier}, but none was created" end |
#failure_message_when_negated ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
133 134 135 |
# File 'lib/rails_audit_log/matchers.rb', line 133 def "expected block not to create an audit log entry#{qualifier}, but one was created" end |
#matches?(block) ⇒ Boolean
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
120 121 122 123 124 125 |
# File 'lib/rails_audit_log/matchers.rb', line 120 def matches?(block) @before = matching_scope.count block.call @after = matching_scope.count @after > @before end |
#supports_block_expectations? ⇒ Boolean
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
115 116 117 |
# File 'lib/rails_audit_log/matchers.rb', line 115 def supports_block_expectations? true end |
#touching(attribute) ⇒ self
Chains an attribute filter onto the matcher.
109 110 111 112 |
# File 'lib/rails_audit_log/matchers.rb', line 109 def touching(attribute) @touching = attribute self end |