diff options
Diffstat (limited to 'spec/unit/util/queue/stomp_spec.rb')
-rwxr-xr-x | spec/unit/util/queue/stomp_spec.rb | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/spec/unit/util/queue/stomp_spec.rb b/spec/unit/util/queue/stomp_spec.rb index 6799becea..7730ab7cb 100755 --- a/spec/unit/util/queue/stomp_spec.rb +++ b/spec/unit/util/queue/stomp_spec.rb @@ -13,7 +13,7 @@ describe 'Puppet::Util::Queue::Stomp', :if => Puppet.features.stomp?, :'fails_on before do # So we make sure we never create a real client instance. # Otherwise we'll try to connect, and that's bad. - Stomp::Client.stubs(:new).returns stub("client") + Stomp::Client.stubs(:new).returns stub("client", :publish => true) end it 'should be registered with Puppet::Util::Queue as :stomp type' do @@ -22,7 +22,7 @@ describe 'Puppet::Util::Queue::Stomp', :if => Puppet.features.stomp?, :'fails_on describe "when initializing" do it "should create a Stomp client instance" do - Stomp::Client.expects(:new).returns stub("stomp_client") + Stomp::Client.expects(:new).returns stub("stomp_client", :publish => true) Puppet::Util::Queue::Stomp.new end @@ -65,7 +65,7 @@ describe 'Puppet::Util::Queue::Stomp', :if => Puppet.features.stomp?, :'fails_on describe "when publishing a message" do before do - @client = stub 'client' + @client = stub 'client', :publish => true Stomp::Client.stubs(:new).returns @client @queue = Puppet::Util::Queue::Stomp.new end @@ -84,11 +84,16 @@ describe 'Puppet::Util::Queue::Stomp', :if => Puppet.features.stomp?, :'fails_on @client.expects(:publish).with { |queue, msg, options| options[:persistent] == true } @queue.publish_message('fooqueue', 'Smite!') end + + it "should use send when the gem does not support publish" do + Stomp::Client.stubs(:new).returns(stub('client', :send => true)) + Puppet::Util::Queue::Stomp.new.publish_message('fooqueue', 'Smite!') + end end describe "when subscribing to a queue" do before do - @client = stub 'client', :acknowledge => true + @client = stub 'client', :acknowledge => true, :publish => true Stomp::Client.stubs(:new).returns @client @queue = Puppet::Util::Queue::Stomp.new end |