Sha256: b586e5e5282776902564f219bb22d05608813c9fe58074dcb24ac3b899e29b18

Contents?: true

Size: 1.51 KB

Versions: 7

Compression:

Stored size: 1.51 KB

Contents

require 'spec_helper'

describe "Delivering messages with postmark-rails" do
  let(:api_token) { 'POSTMARK_API_TEST' }

  before do
    ActionMailer::Base.postmark_settings = { :api_token => api_token }
  end

  it 'delivers a simple message' do
    message = TestMailer.simple_message

    expect { message.deliver }.to change{message.delivered?}.to(true)
  end

  it 'delivers a tagged message' do
    message = TestMailer.tagged_message

    expect { message.deliver }.to change{message.delivered?}.to(true)
  end

  it 'delivers a multipart message' do
    message = TestMailer.multipart_message

    expect { message.deliver }.to change{message.delivered?}.to(true)
  end

  it 'delivers a message with attachments' do
    message = TestMailer.message_with_attachment
    request = message.to_postmark_hash

    expect(request['Attachments'].count).not_to be_zero
    expect { message.deliver }.to change{message.delivered?}.to(true)
  end

  it 'delivers a message with inline image' do
    message = TestMailer.message_with_inline_image
    request = message.to_postmark_hash

    expect(request['Attachments'].count).not_to be_zero
    expect(request['Attachments'].first).to have_key('ContentID')
    expect { message.deliver }.to change{message.delivered?}.to(true)
  end

  it 'delivers a message with metadata' do
    message = TestMailer.message_with_metadata

    request = message.to_postmark_hash

    expect(request['Metadata']).to eq('foo' => 'bar')
    expect { message.deliver }.to change { message.delivered? }.to true
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
postmark-rails-0.22.1 spec/integration/delivery_spec.rb
postmark-rails-0.22.0 spec/integration/delivery_spec.rb
postmark-rails-0.21.0 spec/integration/delivery_spec.rb
postmark-rails-0.20.0 spec/integration/delivery_spec.rb
postmark-rails-0.19.0 spec/integration/delivery_spec.rb
postmark-rails-0.18.0 spec/integration/delivery_spec.rb
postmark-rails-0.17.0 spec/integration/delivery_spec.rb