Sha256: 028f2f0bec5e6cd1114e1fdd8d7c938f35206784a5f4d6d705d07fb6153601d1

Contents?: true

Size: 1.27 KB

Versions: 2

Compression:

Stored size: 1.27 KB

Contents

require 'spec_helper'

describe Macaco::Sender do

  let(:mail) do
    Macaco::Sender.new do
      to      'to@test.com'
      from    'from@test.com'
      subject 'Subject for my email'
      body_html '<h1>This is a header for the HTML version</h1>'
      body_text 'This is the Text version'
    end
  end

  describe '#hash_attributes' do
    it 'creates a new mail record via hash' do
      m = Macaco::Sender.new( from: 'from@test.com', to: 'to@test.com', subject: 'Test' )
      m.from.must_equal 'from@test.com'
    end
  end

  describe '#to' do
    it 'sets the recipient if theres a string provided' do
      mail.to.must_equal [ 'to@test.com' ]
    end
  end

  describe '#from' do
    it 'sets the from address' do
      mail.from.must_equal 'from@test.com'
    end
  end

  describe '#subject' do
    it 'sets the subject address' do
      mail.subject.must_equal 'Subject for my email'
    end
  end

  describe '#body_html' do
    it 'sets the body html' do
      n = Macaco::Sender.new
      n.body_html '<h1>This is a test</h1>'
      n.body_html.must_equal '<h1>This is a test</h1>'
    end
  end

  describe '#body_text' do
    it 'sets the body text' do
      n = Macaco::Sender.new
      n.body_text 'This is a test'
      n.body_text.must_equal 'This is a test'
    end
  end

end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
macaco-0.0.6 spec/lib/macaco/senders/sender_spec.rb
macaco-0.0.5 spec/lib/macaco/senders/sender_spec.rb