Class: RubyEventStore::RSpec::BeEvent::DataMatcher

Inherits:
Object
  • Object
show all
Defined in:
lib/ruby_event_store/rspec/be_event.rb

Instance Method Summary collapse

Constructor Details

#initialize(expected, strict:) ⇒ DataMatcher

Returns a new instance of DataMatcher.


17
18
19
20
# File 'lib/ruby_event_store/rspec/be_event.rb', line 17

def initialize(expected, strict:)
  @strict = strict
  @expected = expected
end

Instance Method Details

#matches?(actual) ⇒ Boolean

Returns:

  • (Boolean)

22
23
24
25
26
# File 'lib/ruby_event_store/rspec/be_event.rb', line 22

def matches?(actual)
  return true unless @expected
  matcher = @strict ? ::RSpec::Matchers::BuiltIn::Match : ::RSpec::Matchers::BuiltIn::Include
  matcher.new(@expected).matches?(actual)
end