Sha256: 3c5c93d16a98a27936d8b5c6cef98b65a453151d63fe94c08cb55e0c1c02e351
Contents?: true
Size: 931 Bytes
Versions: 6
Compression:
Stored size: 931 Bytes
Contents
module Spec module Rails module Matchers class Observe def initialize(expected_model_class) @expected_model_class = expected_model_class end def matches?(observer) @observer = observer if @observer.is_a?(ActiveRecord::Observer) @observer = @observer.class end @observed_classes = observer.observed_classes.flatten @observed_classes.include?(@expected_model_class) end def failure_message return "expected #{@observer.name} to observe #{@expected_model_class.name}, but it was not included in [#{@observed_classes.map(&:name).join(', ')}]" end def description "observer to be observing #{@expected_model_class.name}" end end def observe(expected_model_class) Observe.new(expected_model_class) end end end end
Version data entries
6 entries across 6 versions & 2 rubygems