Class: Hash
- Inherits:
-
Object
- Object
- Hash
- Defined in:
- lib/rosetta_queue/spec_helpers/hash.rb
Instance Method Summary collapse
-
#published_to?(destination) ⇒ Boolean
To be used in conjuction with rspec’s predicate matcher.
Instance Method Details
#published_to?(destination) ⇒ Boolean
To be used in conjuction with rspec’s predicate matcher.
For example, in story/feature or a functional spec you could say:
expected_message = => ‘Advertiser’ expected_message.should be_published_to(:advertiser_create)
9 10 11 12 13 14 15 16 17 18 19 |
# File 'lib/rosetta_queue/spec_helpers/hash.rb', line 9 def published_to?(destination) = nil begin Timeout::timeout(2) { = RosettaQueue::Consumer.receive(destination)} rescue Timeout::Error raise "#{destination} should have received a message but did not NOTE: make sure there are no other processes which are polling messages" end # calling should == is kinda wierd, I know.. but in order to get a decent error message it is needed .should == self end |