Sha256: c6e153f907f0ae19bf0b34c81a320ae5fb3f99635fe6ae8eebc9ed845d8420ad

Contents?: true

Size: 1.16 KB

Versions: 28

Compression:

Stored size: 1.16 KB

Contents

#!/usr/bin/env rspec

require 'spec_helper'

require 'mcollective/discovery/mc'

module MCollective
  class Discovery
    describe Mc do
      describe "#discover" do
        before do
          @reply = mock
          @reply.stubs(:payload).returns({:senderid => "rspec"})

          @client = mock
          @client.stubs(:sendreq)
          @client.stubs(:unsubscribe)
          @client.stubs(:receive).returns(@reply)

          Log.stubs(:debug)
        end

        it "should send the ping request via the supplied client" do
          @client.expects(:sendreq).with("ping", "discovery", Util.empty_filter).returns("123456")
          Mc.discover(Util.empty_filter, 1, 1, @client)
        end

        it "should stop early if a limit is supplied" do
          @client.stubs(:receive).returns(@reply).times(10)
          Mc.discover(Util.empty_filter, 1, 10, @client).should == ("rspec," * 10).split(",")
        end

        it "should unsubscribe from the discovery reply source" do
          @client.expects(:unsubscribe).with("discovery", :reply)
          Mc.discover(Util.empty_filter, 1, 10, @client).should == ("rspec," * 10).split(",")
        end
      end
    end
  end
end

Version data entries

28 entries across 28 versions & 1 rubygems

Version Path
mcollective-client-2.12.5 spec/unit/mcollective/discovery/mc_spec.rb
mcollective-client-2.12.4 spec/unit/mcollective/discovery/mc_spec.rb
mcollective-client-2.12.3 spec/unit/mcollective/discovery/mc_spec.rb
mcollective-client-2.12.1 spec/unit/mcollective/discovery/mc_spec.rb
mcollective-client-2.12.0 spec/unit/mcollective/discovery/mc_spec.rb
mcollective-client-2.10.6 spec/unit/mcollective/discovery/mc_spec.rb
mcollective-client-2.11.4 spec/unit/mcollective/discovery/mc_spec.rb
mcollective-client-2.11.3 spec/unit/mcollective/discovery/mc_spec.rb
mcollective-client-2.11.2 spec/unit/mcollective/discovery/mc_spec.rb
mcollective-client-2.11.1 spec/unit/mcollective/discovery/mc_spec.rb
mcollective-client-2.11.0 spec/unit/mcollective/discovery/mc_spec.rb
mcollective-client-2.10.4 spec/unit/mcollective/discovery/mc_spec.rb
mcollective-client-2.10.3 spec/unit/mcollective/discovery/mc_spec.rb
mcollective-client-2.10.2 spec/unit/mcollective/discovery/mc_spec.rb
mcollective-client-2.10.1 spec/unit/mcollective/discovery/mc_spec.rb
mcollective-client-2.10.0 spec/unit/mcollective/discovery/mc_spec.rb
mcollective-client-2.8.7 spec/unit/mcollective/discovery/mc_spec.rb
mcollective-client-2.8.5 spec/unit/mcollective/discovery/mc_spec.rb
mcollective-client-2.8.8 spec/unit/mcollective/discovery/mc_spec.rb
mcollective-client-2.8.6 spec/unit/mcollective/discovery/mc_spec.rb