class RubyEventStore::RSpec::HavePublished
Attributes
expected[R]
failed_on_stream[R]
failure_message_formatter[R]
fetch_events[R]
phraser[R]
published_events[R]
Public Class Methods
new(*expected, phraser:, failure_message_formatter:)
click to toggle source
# File lib/ruby_event_store/rspec/have_published.rb, line 6 def initialize(*expected, phraser:, failure_message_formatter:) @expected = ExpectedCollection.new(expected) @phraser = phraser @failure_message_formatter = failure_message_formatter @fetch_events = FetchEvents.new end
Public Instance Methods
description()
click to toggle source
# File lib/ruby_event_store/rspec/have_published.rb, line 61 def description "have published events that have to (#{phraser.(expected.events)})" end
exactly(count)
click to toggle source
# File lib/ruby_event_store/rspec/have_published.rb, line 23 def exactly(count) expected.exactly(count) self end
failure_message()
click to toggle source
# File lib/ruby_event_store/rspec/have_published.rb, line 53 def failure_message failure_message_formatter.failure_message(expected, published_events, failed_on_stream) end
failure_message_when_negated()
click to toggle source
# File lib/ruby_event_store/rspec/have_published.rb, line 57 def failure_message_when_negated failure_message_formatter.failure_message_when_negated(expected, published_events, failed_on_stream) end
from(event_id)
click to toggle source
# File lib/ruby_event_store/rspec/have_published.rb, line 43 def from(event_id) fetch_events.from(event_id) self end
in_stream(stream_name)
click to toggle source
# File lib/ruby_event_store/rspec/have_published.rb, line 28 def in_stream(stream_name) @stream_names = [stream_name] self end
in_streams(stream_names)
click to toggle source
# File lib/ruby_event_store/rspec/have_published.rb, line 33 def in_streams(stream_names) @stream_names = Array(stream_names) self end
matches?(event_store)
click to toggle source
# File lib/ruby_event_store/rspec/have_published.rb, line 13 def matches?(event_store) stream_names.all? do |stream_name| fetch_events.stream(stream_name) fetch_events.in(event_store) @published_events = fetch_events.call.to_a @failed_on_stream = stream_name MatchEvents.new.call(expected, published_events) end end
once()
click to toggle source
# File lib/ruby_event_store/rspec/have_published.rb, line 48 def once expected.once self end
strict()
click to toggle source
# File lib/ruby_event_store/rspec/have_published.rb, line 65 def strict expected.strict self end
times()
click to toggle source
# File lib/ruby_event_store/rspec/have_published.rb, line 38 def times self end
Also aliased as: time
Private Instance Methods
stream_names()
click to toggle source
# File lib/ruby_event_store/rspec/have_published.rb, line 72 def stream_names @stream_names || [nil] end