Sha256: f54caf7b55d93e358f96d7fe9c9706ec3f78f8989e8be0e9f3335d346db42957
Contents?: true
Size: 1.76 KB
Versions: 2
Compression:
Stored size: 1.76 KB
Contents
require 'spec_helper' require 'mail' require 'govdelivery/tms/mail/delivery_method' describe GovDelivery::TMS::Mail::DeliveryMethod do subject { GovDelivery::TMS::Mail::DeliveryMethod.new({}) } let(:client) { double('GovDelivery::TMS::Client') } let(:email_messages) { double('email_messages') } let(:tms_message) { double('tms_message', recipients: double(build: GovDelivery::TMS::Recipient.new('href'))) } it 'should work with a basic Mail::Message' do mail = Mail.new do subject 'hi' from '"My mom" <my@mom.com>' to '"A Nice Fellow" <tyler@sink.govdelivery.com>' body '<blink>HI</blink>' end allow(client).to receive(:email_messages).and_return(email_messages) allow(subject).to receive(:client).and_return(client) expect(email_messages).to receive(:build).with( from_name: mail[:from].display_names.first, subject: mail.subject, body: '<blink>HI</blink>' ).and_return(tms_message) expect(tms_message).to receive(:post!).and_return(true) subject.deliver!(mail) end it 'should work with a multipart Mail::Message' do mail = Mail.new do subject 'hi' from '"My mom" <my@mom.com>' to '"A Nice Fellow" <tyler@sink.govdelivery.com>' html_part do content_type 'text/html; charset=UTF-8' body '<blink>HTML</blink>' end end allow(client).to receive(:email_messages).and_return(email_messages) allow(subject).to receive(:client).and_return(client) expect(email_messages).to receive(:build).with( from_name: mail[:from].display_names.first, subject: mail.subject, body: '<blink>HTML</blink>' ).and_return(tms_message) expect(tms_message).to receive(:post!).and_return(true) subject.deliver!(mail) end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
govdelivery-tms-0.8.4 | spec/mail/delivery_method_spec.rb |
govdelivery-tms-0.8.3 | spec/mail/delivery_method_spec.rb |