Class: Moqueue::Matchers::HasAcked
- Inherits:
-
Object
- Object
- Moqueue::Matchers::HasAcked
- Defined in:
- lib/moqueue/matchers.rb
Instance Method Summary collapse
- #failure_message_for_should ⇒ Object
- #failure_message_for_should_not ⇒ Object
-
#initialize(msg_expecting_ack) ⇒ HasAcked
constructor
A new instance of HasAcked.
- #matches?(queue_or_exchange) ⇒ Boolean
Constructor Details
#initialize(msg_expecting_ack) ⇒ HasAcked
Returns a new instance of HasAcked.
33 34 35 |
# File 'lib/moqueue/matchers.rb', line 33 def initialize(msg_expecting_ack) @msg_expecting_ack = msg_expecting_ack end |
Instance Method Details
#failure_message_for_should ⇒ Object
48 49 50 |
# File 'lib/moqueue/matchers.rb', line 48 def "expected #{@queue_or_exchange.inspect} to have received an ack for the message ``#{@msg_expecting_ack}''" end |
#failure_message_for_should_not ⇒ Object
52 53 54 |
# File 'lib/moqueue/matchers.rb', line 52 def "expected #{@queue_or_exchange.inspect} to not have received an ack for the message ``#{@msg_expecting_ack}''" end |
#matches?(queue_or_exchange) ⇒ Boolean
37 38 39 40 41 42 43 44 45 46 |
# File 'lib/moqueue/matchers.rb', line 37 def matches?(queue_or_exchange) if queue_or_exchange.respond_to?(:received_ack_for_message?) @queue_or_exchange = queue_or_exchange @queue_or_exchange.(@msg_expecting_ack) else raise NoMethodError, "Grrr. you can't use ``should have_received_ack_for'' on #{queue_or_exchange.inspect} " + "because it doesn't respond_to :received_ack_for_message?" end end |