Sha256: d02240a9cbb0f579175e58058f12c848fe1e5dd3ea8e538ebeb8d6800242e488

Contents?: true

Size: 893 Bytes

Versions: 5

Compression:

Stored size: 893 Bytes

Contents

require 'spec_helper'

describe ActionMailer::Text do
  let(:mailer) do
    Class.new(ActionMailer::Base) do
      include ActionMailer::Text

      default from: 'Joe User <joe@example.org>'

      def welcome_mail(username)
        @username = username
        mail to: 'user@example.org', subject: 'Welcome!' do |format|
          format.html { render 'templates/welcome_email' }
        end
      end
    end
  end
  subject do
    mailer.welcome_mail('username')
  end
  it 'generates a text part' do
    expect(subject.parts.size).to eq 2
  end
  it 'inserts text part first' do
    expect(subject.parts.first.content_type).to eq 'text/plain; charset=UTF-8'
  end
  it 'inserts html part last' do
    expect(subject.parts.last.content_type).to eq 'text/html; charset=UTF-8'
  end
  it 'matches output' do
    expect(subject).to match_email_example_in 'welcome_email.multipart'
  end
end

Version data entries

5 entries across 5 versions & 2 rubygems

Version Path
actionmailer-textgiri-0.2.1 spec/actionmailer-text/multipart_spec.rb
actionmailer-textgiri-0.2 spec/actionmailer-text/multipart_spec.rb
actionmailer-textgiri-0.1.2 spec/actionmailer-text/multipart_spec.rb
actionmailer-text-0.1.1 spec/actionmailer-text/multipart_spec.rb
actionmailer-text-0.1.0 spec/actionmailer-text/multipart_spec.rb