Sha256: 22cacc4e22503487171a0d46bdb36e8406edc969afc8284983082f334996976e

Contents?: true

Size: 1.11 KB

Versions: 4

Compression:

Stored size: 1.11 KB

Contents

require File.expand_path(File.dirname(__FILE__) + '/spec_helper')

describe "PostmarkRails3" do
  it "should allow setting an api key" do
    Postmark.stub!(:send_through_postmark)
    ActionMailer::Base.postmark_settings = {:api_key => 'api-key'}
    ActionMailer::Base.postmark_settings[:api_key].should == 'api-key'
    Postmark.should_receive(:api_key=).with('api-key')
    TestMailer.simple_message.deliver
  end
  
  it "should use postmark for delivery" do
    Postmark.should_receive(:send_through_postmark) do |message|
      message.subject.should == "hello"
    end
    TestMailer.simple_message.deliver
  end

  it "should allow tagging of message" do
    Postmark.should_receive(:send_through_postmark) do |message|
      message.tag.to_s.should == "delivery"
    end
    TestMailer.tagged_message.deliver
  end
  
  it "should work with multipart messages" do
    Postmark.should_receive(:send_through_postmark) do |message|
        message.should be_multipart
        message.body_text.strip.should == "hello"
        message.body_html.strip.should == "<b>hello</b>"
    end
    TestMailer.multipart_message.deliver
  end
end

Version data entries

4 entries across 4 versions & 2 rubygems

Version Path
fishman-postmark-rails-0.4.1 spec/postmark-rails_spec.rb
postmark-rails-0.4.1 spec/postmark-rails_spec.rb
postmark-rails-0.4.0 spec/postmark-rails_spec.rb
postmark-rails-0.3.0 spec/postmark-rails_spec.rb