Class: RosettaQueue::Matchers::PublishMessageWith

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

Instance Method Summary collapse

Constructor Details

#initialize(message_subset, options) ⇒ PublishMessageWith

Returns a new instance of PublishMessageWith.



75
76
77
78
# File 'lib/rosetta_queue/spec_helpers/publishing_matchers.rb', line 75

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

Instance Method Details

#descriptionObject



97
98
99
# File 'lib/rosetta_queue/spec_helpers/publishing_matchers.rb', line 97

def description
  "publish a message with #{@message_subset.inspect}"
end

#failure_messageObject



85
86
87
88
89
90
91
# File 'lib/rosetta_queue/spec_helpers/publishing_matchers.rb', line 85

def failure_message
  if @actual_message.blank?
    "expected #{@message_subset.inspect} to be contained in a message but no message was published"
  else
    "expected #{@message_subset.inspect} to be contained in the message: #{@actual_message.inspect}"
  end
end

#matches?(lambda_to_run) ⇒ Boolean

Returns:

  • (Boolean)


80
81
82
83
# File 'lib/rosetta_queue/spec_helpers/publishing_matchers.rb', line 80

def matches?(lambda_to_run)
  super
  Spec::Mocks::ArgumentConstraints::HashIncludingConstraint.new(@message_subset) == @actual_message
end

#negative_failure_messageObject



93
94
95
# File 'lib/rosetta_queue/spec_helpers/publishing_matchers.rb', line 93

def negative_failure_message
  "expected #{@message_subset.inspect} not to be contained in the message but was"
end