Sha256: d062be72d15526a0e5da0c9f5e8dde6a4986ee26c20889954a86a0661f284c6a

Contents?: true

Size: 1.16 KB

Versions: 14

Compression:

Stored size: 1.16 KB

Contents

require 'spec_helper'

describe Mail::Postmark do
  let(:message) do
    Mail.new do
      from    "sheldon@bigbangtheory.com"
      to      "lenard@bigbangtheory.com"
      subject "Hello!"
      body    "Hello Sheldon!"
    end
  end

  it "can be set as delivery_method" do
    message.delivery_method Mail::Postmark
  end

  it "wraps Postmark.send_through_postmark" do
    Postmark::ApiClient.any_instance.should_receive(:deliver_message).with(message)
    message.delivery_method Mail::Postmark
    message.deliver
  end

  it "returns self by default" do
    Postmark::ApiClient.any_instance.should_receive(:deliver_message).with(message)
    message.delivery_method Mail::Postmark
    message.deliver.should eq message
  end

  it "returns the actual response if :return_response setting is present" do
    Postmark::ApiClient.any_instance.should_receive(:deliver_message).with(message)
    message.delivery_method Mail::Postmark, :return_response => true
    message.deliver.should eq message
  end

  it "allows to set the api key" do
    message.delivery_method Mail::Postmark, {:api_key => 'api-key'}
    message.delivery_method.settings[:api_key].should == 'api-key'
  end
end

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
postmark-1.4.3 spec/unit/postmark/handlers/mail_spec.rb
postmark-1.4.2 spec/unit/postmark/handlers/mail_spec.rb
postmark-1.4.1 spec/unit/postmark/handlers/mail_spec.rb
postmark-1.4.0 spec/unit/postmark/handlers/mail_spec.rb
postmark-1.3.1 spec/unit/postmark/handlers/mail_spec.rb
postmark-1.3.0 spec/unit/postmark/handlers/mail_spec.rb
postmark-1.2.1 spec/unit/postmark/handlers/mail_spec.rb
postmark-1.2.0 spec/unit/postmark/handlers/mail_spec.rb
postmark-1.1.2 spec/unit/postmark/handlers/mail_spec.rb
postmark-1.1.1 spec/unit/postmark/handlers/mail_spec.rb
postmark-1.1.0 spec/unit/postmark/handlers/mail_spec.rb
postmark-1.0.2 spec/unit/postmark/handlers/mail_spec.rb
postmark-1.0.1 spec/unit/postmark/handlers/mail_spec.rb
postmark-1.0.0 spec/unit/postmark/handlers/mail_spec.rb