Sha256: c6dda245147cc22101fe345d1e11163639964130c9d3b4b33e38417a74d524d0

Contents?: true

Size: 902 Bytes

Versions: 2

Compression:

Stored size: 902 Bytes

Contents

require 'spec_helper'
require 'govuk_notify_rails/mailer'

RSpec.describe NotifyMailer, type: :mailer do
  describe 'new_message_test_email' do
    let(:template) { '9661d08a-486d-4c67-865e-ad976f17871d' }
    let(:user) { double('User', name: 'Test Name', email: 'test@example.com') }
    let(:mail) { described_class.test_email(user) }

    it 'is a govuk_notify delivery' do
      expect(mail.delivery_method).to be_a(GovukNotifyRails::Delivery)
    end

    it 'sets the recipient' do
      expect(mail.to).to eq(['test@example.com'])
    end

    it 'sets the subject' do
      expect(mail.body).to match("This is a GOV.UK Notify email with template #{template}")
    end

    it 'sets the template' do
      expect(mail.govuk_notify_template).to eq(template)
    end

    it 'sets the personalisation' do
      expect(mail.govuk_notify_personalisation.keys).to eq([:full_name])
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
govuk_notify_rails-1.0.0 spec/mailers/notify_mailer_spec.rb
govuk_notify_rails-0.0.2 spec/mailers/notify_mailer_spec.rb