Class: Moqueue::Matchers::HasReceived
- Inherits:
-
Object
- Object
- Moqueue::Matchers::HasReceived
- Defined in:
- lib/moqueue/matchers.rb
Instance Method Summary collapse
- #failure_message_for_should ⇒ Object
- #failure_message_for_should_not ⇒ Object
-
#initialize(expected_msg) ⇒ HasReceived
constructor
A new instance of HasReceived.
- #matches?(queue) ⇒ Boolean
Constructor Details
#initialize(expected_msg) ⇒ HasReceived
Returns a new instance of HasReceived.
6 7 8 |
# File 'lib/moqueue/matchers.rb', line 6 def initialize(expected_msg) @expected_msg = expected_msg end |
Instance Method Details
#failure_message_for_should ⇒ Object
21 22 23 |
# File 'lib/moqueue/matchers.rb', line 21 def "expected #{@queue.inspect} to have received message ``#{@expected_msg}''" end |
#failure_message_for_should_not ⇒ Object
25 26 27 |
# File 'lib/moqueue/matchers.rb', line 25 def "expected #{@queue.inspect} to not have received message ``#{@expected_msg}''" end |
#matches?(queue) ⇒ Boolean
10 11 12 13 14 15 16 17 18 19 |
# File 'lib/moqueue/matchers.rb', line 10 def matches?(queue) if queue.respond_to?(:received_message?) @queue = queue @queue.(@expected_msg) else raise NoMethodError, "Grrr. you can't use ``should have_received_message'' on #{queue.inspect} " + "because it doesn't respond_to :received_message?" end end |