Class: Moqueue::Matchers::HasExactRoutingKey
- Inherits:
-
Object
- Object
- Moqueue::Matchers::HasExactRoutingKey
- Defined in:
- lib/moqueue/matchers.rb
Instance Method Summary collapse
- #failure_message_for_should ⇒ Object
- #failure_message_for_should_not ⇒ Object
-
#initialize(expected_key) ⇒ HasExactRoutingKey
constructor
A new instance of HasExactRoutingKey.
- #matches?(queue) ⇒ Boolean
Constructor Details
#initialize(expected_key) ⇒ HasExactRoutingKey
Returns a new instance of HasExactRoutingKey.
59 60 61 |
# File 'lib/moqueue/matchers.rb', line 59 def initialize(expected_key) @expected_key = expected_key end |
Instance Method Details
#failure_message_for_should ⇒ Object
74 75 76 |
# File 'lib/moqueue/matchers.rb', line 74 def "expected #{@queue.inspect} to have received header with routing key ``#{@expected_msg}''" end |
#failure_message_for_should_not ⇒ Object
78 79 80 |
# File 'lib/moqueue/matchers.rb', line 78 def "expected #{@queue.inspect} to not have received header with routing key ``#{@expected_msg}''" end |
#matches?(queue) ⇒ Boolean
63 64 65 66 67 68 69 70 71 72 |
# File 'lib/moqueue/matchers.rb', line 63 def matches?(queue) if queue.respond_to?(:received_routing_key?) @queue = queue @queue.received_routing_key?(@expected_key) else raise NoMethodError, "Grrr. you can't use ``should have_received_routing_key'' on #{queue.inspect} " + "because it doesn't respond_to :received_routing_key?" end end |