Sha256: 7ab1199a8a76fab4f71e6bc04dcb8d73a767d8a67dbc16bb39a707a32e19f29a

Contents?: true

Size: 1.21 KB

Versions: 1

Compression:

Stored size: 1.21 KB

Contents

require File.expand_path('../spec_helper', __FILE__)

describe Mail do
  describe SimplePostmark do
    let(:instance) { Mail::SimplePostmark.new({}) }


    it 'should respond to deliver!' do
      instance.must_respond_to(:deliver!)
    end


    describe :deliver! do
      let(:mail) do
        Mail.new do
          from     'barney@himym.tld'
          to       'ted@himym.tld'
          subject  "I'm your bro!"
          body     "Think of me like Yoda, but instead of being little and green I wear suits and I'm awesome. I'm your bro-I'm Broda!"
          tag      'simple-postmark'
          add_file(File.join(File.dirname(__FILE__), 'thebrocode.jpg'))
        end
      end
      let(:url) { 'http://api.postmarkapp.com/email' }

      before do
        mail.delivery_method(Mail::SimplePostmark)
        stub_request(:post, url)
      end


      it 'should send emails' do
        mail.deliver

        assert_requested(:post, url)
      end


      it 'should post appropriate data' do
        mail.deliver

        assert_requested(:post, url, headers: { 'Accept' => 'application/json', 'ContentType' => 'application/json', 'X-Postmark-Server-Token' => '********-****-****-****-************' })
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
simple_postmark-0.4.1 spec/delivery_method_spec.rb