Class: RosettaQueue::Matchers::PublishMessage

Inherits:
PublishMessageMatcher show all
Defined in:
lib/rosetta_queue/spec_helpers/publishing_matchers.rb

Instance Method Summary collapse

Constructor Details

#initialize(expected_message, options) ⇒ PublishMessage

Returns a new instance of PublishMessage.



110
111
112
113
# File 'lib/rosetta_queue/spec_helpers/publishing_matchers.rb', line 110

def initialize(expected_message, options)
  @expected_message = expected_message
  extract_options(options)
end

Instance Method Details

#descriptionObject



132
133
134
# File 'lib/rosetta_queue/spec_helpers/publishing_matchers.rb', line 132

def description
  "publish the message: #{@expected_message.inspect}"
end

#failure_messageObject



120
121
122
123
124
125
126
# File 'lib/rosetta_queue/spec_helpers/publishing_matchers.rb', line 120

def failure_message
  if @actual_message.blank?
    "expected #{@expected_message.inspect} to be published but no message was"
  else
    "expected #{@expected_message.inspect} to be published but the following was instead: #{@actual_message.inspect}"
  end
end

#matches?(lambda_to_run) ⇒ Boolean

Returns:

  • (Boolean)


115
116
117
118
# File 'lib/rosetta_queue/spec_helpers/publishing_matchers.rb', line 115

def matches?(lambda_to_run)
  super
  @actual_message == @expected_message
end

#negative_failure_messageObject



128
129
130
# File 'lib/rosetta_queue/spec_helpers/publishing_matchers.rb', line 128

def negative_failure_message
  "expected #{@expected_message.inspect} not to be published but it was"
end