Sha256: f7b799d4cfca7695cbd319bbee713dc4506be3ac2bfd35b23994d2eed55ef843

Contents?: true

Size: 1.1 KB

Versions: 12

Compression:

Stored size: 1.1 KB

Contents

require 'rails_helper'

describe MnoEnterprise::SmtpClient do
  let(:client) { described_class.send(:new) }

  describe '#deliver' do
    subject do
      client.deliver(
        'reset-password-instructions',
        {name: 'John', email: 'john.doe@example.com'},
        {name: 'Joe', email: 'joe.blogg@example.com'},
      )
    end

    it 'calls mail with the correct params' do
      expected_params = {
        from: 'John <john.doe@example.com>',
        to: 'joe.blogg@example.com',
        subject: 'Reset password instructions',
        template_path: 'system_notifications',
        template_name: 'reset-password-instructions'
      }
      expect(client).to receive(:mail).with(expected_params)
      subject
    end
  end

  describe '#format_sender' do
    it do
      sender = {name: 'John', email: 'john.doe@example.com'}
      expect(client.format_sender(sender)).to eq('John <john.doe@example.com>')
    end
  end
  describe '#humanize' do
    it 'returns a humanized template subject' do
      expect(client.humanize('reset-password-instructions')).to eq('Reset password instructions')
    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/smtp_client_spec.rb
mno-enterprise-core-3.3.3 spec/lib/mno_enterprise/smtp_client_spec.rb
mno-enterprise-core-3.3.2 spec/lib/mno_enterprise/smtp_client_spec.rb
mno-enterprise-core-3.2.1 spec/lib/mno_enterprise/smtp_client_spec.rb
mno-enterprise-core-3.3.1 spec/lib/mno_enterprise/smtp_client_spec.rb
mno-enterprise-core-3.3.0 spec/lib/mno_enterprise/smtp_client_spec.rb
mno-enterprise-core-3.2.0 spec/lib/mno_enterprise/smtp_client_spec.rb
mno-enterprise-core-3.1.4 spec/lib/mno_enterprise/smtp_client_spec.rb
mno-enterprise-core-3.1.3 spec/lib/mno_enterprise/smtp_client_spec.rb
mno-enterprise-core-3.1.2 spec/lib/mno_enterprise/smtp_client_spec.rb
mno-enterprise-core-3.1.1 spec/lib/mno_enterprise/smtp_client_spec.rb
mno-enterprise-core-3.1.0 spec/lib/mno_enterprise/smtp_client_spec.rb