spec/lib/flapjack/jabber_spec.rb in flapjack-0.6.31 vs spec/lib/flapjack/jabber_spec.rb in flapjack-0.6.32
- old
+ new
@@ -23,10 +23,11 @@
it "hooks up event handlers to the appropriate methods" do
Socket.should_receive(:gethostname).and_return('thismachine')
fj = Flapjack::Jabber.new
fj.bootstrap(:config => config)
+ fj.should_receive(:build_redis_connection_pool)
EM.should_receive(:next_tick).exactly(4).times.and_yield
EM.should_receive(:synchrony).exactly(4).times.and_yield
fj.should_receive(:register_handler).with(:ready).and_yield(stanza)
@@ -46,10 +47,12 @@
it "joins a chat room after connecting" do
fj = Flapjack::Jabber.new
fj.bootstrap(:config => config)
+ fj.should_receive(:build_redis_connection_pool)
+
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)
@@ -129,13 +132,13 @@
timer_2.should_receive(:cancel)
EM::Synchrony.should_receive(:add_periodic_timer).with(30).and_return(timer_1)
EM::Synchrony.should_receive(:add_periodic_timer).with(60).and_return(timer_2)
redis = mock('redis')
- EventMachine::Synchrony::ConnectionPool.should_receive(:new).and_return(redis)
fj = Flapjack::Jabber.new
fj.bootstrap(:config => config)
+ fj.should_receive(:build_redis_connection_pool).and_return(redis)
fj.should_receive(:register_handler).exactly(4).times
fj.should_receive(:connect)
fj.should_receive(:connected?).exactly(3).times.and_return(true)
fj.should_receive(:should_quit?).exactly(4).times.and_return(false, false, true)