class Eventifier::Matchers::Notifications
Public Class Methods
new(target)
click to toggle source
# File lib/eventifier/matchers.rb, line 4 def initialize(target) @target = target end
Public Instance Methods
failure_message_for_should()
click to toggle source
# File lib/eventifier/matchers.rb, line 19 def failure_message_for_should 'should have worked' #"the block should have chronicled the '#{ @event_name }' incident for the #{ @target.class.name }##{ @target.object_id }, but it didn't" end
failure_message_for_should_not()
click to toggle source
# File lib/eventifier/matchers.rb, line 24 def failure_message_for_should_not 'should not have worked' #"the block should not have chronicled the '#{ @event_name }' incident for the #{ @target.class.name }##{ @target.object_id }, but it did" end
matches?(block_to_test)
click to toggle source
# File lib/eventifier/matchers.rb, line 8 def matches?(block_to_test) #before = incidents_count existing_notifications = @target.inject({}) do |memo, record| memo[record] = record.notifications end block_to_test.call @target.none? do |record| (existing_notifications[record] - record.notifications).empty? end end