spec/lib/flapjack/jabber_spec.rb in flapjack-0.6.24 vs spec/lib/flapjack/jabber_spec.rb in flapjack-0.6.25
- old
+ new
@@ -46,10 +46,11 @@
it "joins a chat room after connecting" do
fj = Flapjack::Jabber.new
fj.bootstrap(:config => config)
+ fj.should_receive(:connected?).and_return(true)
fj.should_receive(:write).with(an_instance_of(Blather::Stanza::Presence))
fj.should_receive(:write).with(an_instance_of(Blather::Stanza::Message))
fj.on_ready(stanza)
end
@@ -77,10 +78,11 @@
fj = Flapjack::Jabber.new
fj.bootstrap(:config => config)
fj.instance_variable_set('@redis_handler', redis)
+ fj.should_receive(:connected?).and_return(true)
fj.should_receive(:write).with(an_instance_of(Blather::Stanza::Message))
fj.on_groupchat(stanza)
end
@@ -91,10 +93,11 @@
stanza.should_receive(:from).and_return(from)
fj = Flapjack::Jabber.new
fj.bootstrap(:config => config)
+ fj.should_receive(:connected?).and_return(true)
fj.should_receive(:write).with(an_instance_of(Blather::Stanza::Message))
fj.on_groupchat(stanza)
end
@@ -130,12 +133,13 @@
redis = mock('redis')
EventMachine::Synchrony::ConnectionPool.should_receive(:new).and_return(redis)
fj = Flapjack::Jabber.new
fj.bootstrap(:config => config)
+ fj.should_receive(:register_handler).exactly(4).times
fj.should_receive(:connect)
- fj.should_receive(:connected?).twice.and_return(true)
+ fj.should_receive(:connected?).exactly(3).times.and_return(true)
fj.should_receive(:should_quit?).exactly(3).times.and_return(false, false, true)
redis.should_receive(:blpop).twice.and_return(
["jabber_notifications", %q{{"notification_type":"problem","event_id":"main-example.com:ping","state":"critical","summary":"!!!"}}],
["jabber_notifications", %q{{"notification_type":"shutdown"}}]
)