Sha256: b8e1247c5a13d5e08600ae04d5ab597286d61f9d5dc360c0a0dee0f63d2cf6bd

Contents?: true

Size: 1.25 KB

Versions: 1

Compression:

Stored size: 1.25 KB

Contents

require 'spec_helper'

describe LetterOpener::Message do
  let(:location) { File.expand_path('../../../tmp/letter_opener', __FILE__) }

  describe '#reply_to' do
    it 'handles one email as a string' do
      message = described_class.new(location, mock(reply_to: 'test@example.com'))
      message.reply_to.should eq('test@example.com')
    end

    it 'handles array of emails' do
      message = described_class.new(location, mock(reply_to: ['test1@example.com', 'test2@example.com']))
      message.reply_to.should eq('test1@example.com, test2@example.com')
    end
  end

  describe '#to' do
    it 'handles one email as a string' do
      message = described_class.new(location, mock(to: 'test@example.com'))
      message.to.should eq('test@example.com')
    end

    it 'handles array of emails' do
      message = described_class.new(location, mock(to: ['test1@example.com', 'test2@example.com']))
      message.to.should eq('test1@example.com, test2@example.com')
    end
  end

  describe '#<=>' do
    it 'sorts rich type before plain type' do
      plain = described_class.new(location, mock(content_type: 'text/plain'))
      rich = described_class.new(location, mock(content_type: 'text/html'))
      [plain, rich].sort.should eq([rich, plain])
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
letter_opener-1.0.0 spec/letter_opener/message_spec.rb