require 'spec_helper' require_monitor 'mailer' module RCS module Monitor describe Mailer do let(:subject) { described_class.new } let(:email_subject) { "foo" } let(:email_template) { :component_restored } let(:short_message) { "bar" } describe '#alert' do context 'when calleded with the binding param' do it 'renders a template' do @restored = [] expect(subject).to receive(:alert!).with(email_subject, /.*(healty again).*/, html: true) subject.alert(email_subject, email_template, binding: binding) end context 'when short messages are enforced' do before { subject.stub(:short_messages?).and_return(true) } it 'does not render the template' do expect(subject).to receive(:alert!).with(email_subject, short_message, html: false) subject.alert(email_subject, email_template, binding: binding, short_message: short_message) end end end end end end end .