Sha256: 74887b061760dd96878b8b2dc097093b559d706678980d5abc8f106b0c6de3e3
Contents?: true
Size: 1.81 KB
Versions: 3
Compression:
Stored size: 1.81 KB
Contents
require 'spec_helper' require 'flapjack/gateways/email' describe Flapjack::Gateways::Email, :logger => true do it "sends a mail with text and html parts" do email = mock('email') entity_check = mock(Flapjack::Data::EntityCheck) entity_check.should_receive(:in_scheduled_maintenance?).and_return(false) entity_check.should_receive(:in_unscheduled_maintenance?).and_return(false) redis = mock('redis') Flapjack::Data::EntityCheck.should_receive(:for_event_id). with('example.com:ping', :redis => redis).and_return(entity_check) # TODO better checking of what gets passed here EM::P::SmtpClient.should_receive(:send).with( hash_including(:host => 'localhost', :port => 25)).and_return(email) response = mock(response) response.should_receive(:"respond_to?").with(:code).and_return(true) response.should_receive(:code).and_return(250) EM::Synchrony.should_receive(:sync).with(email).and_return(response) notification = {'notification_type' => 'recovery', 'contact_first_name' => 'John', 'contact_last_name' => 'Smith', 'state' => 'ok', 'state_duration' => 2, 'summary' => 'smile', 'last_state' => 'problem', 'last_summary' => 'frown', 'time' => Time.now.to_i, 'event_id' => 'example.com:ping'} Flapjack::Gateways::Email.instance_variable_set('@config', {}) Flapjack::Gateways::Email.instance_variable_set('@redis', redis) Flapjack::Gateways::Email.instance_variable_set('@logger', @logger) Flapjack::Gateways::Email.start Flapjack::Gateways::Email.perform(notification) end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
flapjack-0.7.27 | spec/lib/flapjack/gateways/email_spec.rb |
flapjack-0.7.26 | spec/lib/flapjack/gateways/email_spec.rb |
flapjack-0.7.25 | spec/lib/flapjack/gateways/email_spec.rb |