Class: RubyEventStore::RSpec::CrudeFailureMessageFormatter::Publish

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

Instance Method Summary collapse

Instance Method Details

#failure_message(expected, events, stream) ⇒ Object


29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
# File 'lib/ruby_event_store/rspec/crude_failure_message_formatter.rb', line 29

def failure_message(expected, events, stream)
  if !expected.empty?
    <<~EOS
    expected block to have published:

    #{expected.events}

    #{"in stream #{stream} " if stream}but published:

    #{events}
    EOS
  else
    "expected block to have published any events"
  end
end

#failure_message_when_negated(expected, events, stream) ⇒ Object


45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
# File 'lib/ruby_event_store/rspec/crude_failure_message_formatter.rb', line 45

def failure_message_when_negated(expected, events, stream)
  if !expected.empty?
    <<~EOS
    expected block not to have published:

    #{expected.events}

    #{"in stream #{stream} " if stream}but published:

    #{events}
    EOS
  else
    "expected block not to have published any events"
  end
end