Sha256: 0e3790e013edf6f97d6003f029c90f0d5f4944e70464a29104f608378e792ed2

Contents?: true

Size: 870 Bytes

Versions: 15

Compression:

Stored size: 870 Bytes

Contents

require 'spec_helper'
require 'mail_room/delivery/postback'

describe MailRoom::Delivery::Postback do
  describe '#deliver' do
    let(:mailbox) {MailRoom::Mailbox.new({
      :delivery_url => 'http://localhost/inbox',
      :delivery_token => 'abcdefg'
    })}

    it 'posts the message with faraday' do
      connection = stub
      request = stub
      Faraday.stubs(:new).returns(connection)

      connection.stubs(:token_auth)
      connection.stubs(:post).yields(request)

      request.stubs(:url)
      request.stubs(:body=)

      MailRoom::Delivery::Postback.new(mailbox).deliver('a message')

      connection.should have_received(:token_auth).with('abcdefg')
      connection.should have_received(:post)

      request.should have_received(:url).with('http://localhost/inbox')
      request.should have_received(:body=).with('a message')
    end
  end
end

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
mail_room-0.7.0 spec/lib/delivery/postback_spec.rb
mail_room-0.6.1 spec/lib/delivery/postback_spec.rb
mail_room-0.6.0 spec/lib/delivery/postback_spec.rb
mail_room-0.5.2 spec/lib/delivery/postback_spec.rb
mail_room-0.5.1 spec/lib/delivery/postback_spec.rb
mail_room-0.5.0 spec/lib/delivery/postback_spec.rb
mail_room-0.4.2 spec/lib/delivery/postback_spec.rb
mail_room-0.4.1 spec/lib/delivery/postback_spec.rb
mail_room-0.4.0 spec/lib/delivery/postback_spec.rb
mail_room-0.3.1 spec/lib/delivery/postback_spec.rb
mail_room-0.3.0 spec/lib/delivery/postback_spec.rb
mail_room-0.2.0 spec/lib/delivery/postback_spec.rb
mail_room-0.1.0 spec/lib/delivery/postback_spec.rb
mail_room-0.0.3 spec/lib/delivery/postback_spec.rb
mail_room-0.0.2 spec/lib/delivery/postback_spec.rb