diff options
author | Stig Sandbeck Mathisen <ssm@debian.org> | 2012-01-26 11:22:40 +0100 |
---|---|---|
committer | Stig Sandbeck Mathisen <ssm@debian.org> | 2012-01-26 11:22:40 +0100 |
commit | c17b3ba16e7013f06416f10b8752ef783f048717 (patch) | |
tree | 790f13f167199b954007e17d1c55a8d1b0218775 /spec/unit/util/queue | |
parent | 32af6143486ceb24a93636445d1883f5fe2299d7 (diff) | |
download | puppet-upstream/2.7.10.tar.gz |
Imported Upstream version 2.7.10upstream/2.7.10
Diffstat (limited to 'spec/unit/util/queue')
-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 |