Sha256: 17b13c03acef6a42caad45efb3ba8482326e9ce1cbd0bca924dc584efc617e45
Contents?: true
Size: 1.92 KB
Versions: 1
Compression:
Stored size: 1.92 KB
Contents
require File.dirname(__FILE__) + '/../spec_helper' module RosettaQueue class TestProducer < Producer publishes_to :test_queue options :persistent => false end describe Producer do before(:each) do @adapter = mock("adapter", :send_message => nil) RosettaQueue::Adapter.stub!(:instance).and_return(@adapter) @gateway = TestProducer.new Destinations.stub!(:lookup).and_return("/queue/test_queue") end it_should_behave_like "a messaging gateway object" attr_reader :adapter, :gateway describe "#publish" do before(:each) do @adapter = mock("adpater", :send_message => nil) RosettaQueue::Adapter.stub!(:instance).and_return(@adapter) end # it "should look up the destination defined on the class" do # Destinations.should_receive(:lookup).with(:test_queue).and_return("/queue/test_queue") # # when # @gateway.publish('some message') # end it "should publish messages to queue with the options defined in the class" do # TO DO: REFACTOR #publish METHOD SO THAT YOU PASS IN MESSAGE HANDLER AS WITH CONSUMER pending # expect @adapter.should_receive(:send_message).with("/queue/test_queue", "Hello World!", {:persistent => false}) # when @gateway.publish("Hello World!") end end describe ".publish" do # it "should look up the destination defined on the class" do # Destinations.should_receive(:lookup).with(:test_queue).and_return("/queue/test_queue") # # when # Producer.publish(:test_queue, "blah") # end it "should send the message to the adpater along with the options" do # expect @adapter.should_receive(:send_message).with("/queue/test_queue", "Hello World!", {:persistent => true}) # when Producer.publish(:test_queue, "Hello World!", {:persistent => true}) end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
bmabey-rosetta_queue-0.3.3 | spec/rosetta_queue/producer_spec.rb |