5 require File.dirname(__FILE__) + '/../../../../../plugins/mcollective/discovery/mc.rb'
10 describe "#discover" do
13 @reply.stubs(:payload).returns({:senderid => "rspec"})
16 @client.stubs(:sendreq)
17 @client.stubs(:unsubscribe)
18 @client.stubs(:receive).returns(@reply)
23 it "should send the ping request via the supplied client" do
24 @client.expects(:sendreq).with("ping", "discovery", Util.empty_filter).returns("123456")
25 Mc.discover(Util.empty_filter, 1, 1, @client)
28 it "should stop early if a limit is supplied" do
29 @client.stubs(:receive).returns(@reply).times(10)
30 Mc.discover(Util.empty_filter, 1, 10, @client).should == ("rspec," * 10).split(",")
33 it "should unsubscribe from the discovery reply source" do
34 @client.expects(:unsubscribe).with("discovery", :reply)
35 Mc.discover(Util.empty_filter, 1, 10, @client).should == ("rspec," * 10).split(",")