Sha256: 464b839adfebcd1c2747745ab04296117dcd5323f7e5adb59222cfe82289608c

Contents?: true

Size: 866 Bytes

Versions: 12

Compression:

Stored size: 866 Bytes

Contents

require "rails_helper"

describe MnoEnterprise::MailAdapters::SmtpAdapter do
  describe '.deliver' do
    before { described_class.instance_variable_set("@client", nil) }

    let(:template) { :some_template }
    let(:from) {{ name: "John", email: "j@e.com" }}
    let(:to) {{ name: "John", email: "j@e.com" }}
    let(:vars) {{ some: 'var' }}
    let(:opts) {{ some: 'opt' }}

    subject { described_class.deliver(template, from, to, vars, opts) }   

    it 'delegates the method to a smtp client' do
      # Stub SmptClient
      smtp = double('smtpclient')
      smtp_mail = double('smtpmail')
      
      expect(MnoEnterprise::SmtpClient).to receive(:new).and_return(smtp)
      
      expect(smtp).to receive(:deliver).with(template, from, to, vars, opts).and_return(smtp_mail)
      expect(smtp_mail).to receive(:deliver)

      subject
    end
  end
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
mno-enterprise-core-3.4.0 spec/lib/mno_enterprise/mail_adapters/smtp_adapter_spec.rb
mno-enterprise-core-3.3.3 spec/lib/mno_enterprise/mail_adapters/smtp_adapter_spec.rb
mno-enterprise-core-3.3.2 spec/lib/mno_enterprise/mail_adapters/smtp_adapter_spec.rb
mno-enterprise-core-3.2.1 spec/lib/mno_enterprise/mail_adapters/smtp_adapter_spec.rb
mno-enterprise-core-3.3.1 spec/lib/mno_enterprise/mail_adapters/smtp_adapter_spec.rb
mno-enterprise-core-3.3.0 spec/lib/mno_enterprise/mail_adapters/smtp_adapter_spec.rb
mno-enterprise-core-3.2.0 spec/lib/mno_enterprise/mail_adapters/smtp_adapter_spec.rb
mno-enterprise-core-3.1.4 spec/lib/mno_enterprise/mail_adapters/smtp_adapter_spec.rb
mno-enterprise-core-3.1.3 spec/lib/mno_enterprise/mail_adapters/smtp_adapter_spec.rb
mno-enterprise-core-3.1.2 spec/lib/mno_enterprise/mail_adapters/smtp_adapter_spec.rb
mno-enterprise-core-3.1.1 spec/lib/mno_enterprise/mail_adapters/smtp_adapter_spec.rb
mno-enterprise-core-3.1.0 spec/lib/mno_enterprise/mail_adapters/smtp_adapter_spec.rb