spec/lib/flapjack/gateways/pagerduty_spec.rb in flapjack-0.7.27 vs spec/lib/flapjack/gateways/pagerduty_spec.rb in flapjack-0.7.28
- old
+ new
@@ -6,14 +6,14 @@
let(:config) { {'queue' => 'pagerduty_notifications'} }
let(:time) { Time.new }
- let(:redis) { mock('redis') }
+ let(:redis) { double('redis') }
it "prompts the blocking redis connection to quit" do
- shutdown_redis = mock('shutdown_redis')
+ shutdown_redis = double('shutdown_redis')
shutdown_redis.should_receive(:rpush).with(config['queue'], %q{{"notification_type":"shutdown"}})
EM::Hiredis.should_receive(:connect).and_return(shutdown_redis)
Flapjack::RedisPool.should_receive(:new).and_return(redis)
fp = Flapjack::Gateways::Pagerduty.new(:config => config, :logger => @logger)
@@ -92,19 +92,19 @@
it "creates acknowledgements when pagerduty acknowledgements are found" do
Flapjack::RedisPool.should_receive(:new).and_return(redis)
fp = Flapjack::Gateways::Pagerduty.new(:config => config, :logger => @logger)
- contact = mock('contact')
+ contact = double('contact')
contact.should_receive(:pagerduty_credentials).and_return({
'service_key' => '12345678',
'subdomain"' => 'flpjck',
'username' => 'flapjack',
'password' => 'password123'
})
- entity_check = mock('entity_check')
+ entity_check = double('entity_check')
entity_check.should_receive(:check).and_return('PING')
entity_check.should_receive(:contacts).and_return([contact])
entity_check.should_receive(:entity_name).exactly(2).times.and_return('foo-app-01.bar.net')
Flapjack::Data::Event.should_receive(:create_acknowledgement).with('foo-app-01.bar.net', 'PING',
:summary => 'Acknowledged on PagerDuty', :redis => redis)
@@ -115,10 +115,10 @@
fp.send(:find_pagerduty_acknowledgements)
end
it "runs a blocking loop listening for notifications" do
- timer = mock('timer')
+ timer = double('timer')
timer.should_receive(:cancel)
EM::Synchrony.should_receive(:add_periodic_timer).with(10).and_return(timer)
redis.should_receive(:del).with('sem_pagerduty_acks_running')