Sha256: 9d6e1e7d1b7fc87837de418f4cdeb24dfd4b619a4e72c21d1fb34ff5638d2696

Contents?: true

Size: 833 Bytes

Versions: 1

Compression:

Stored size: 833 Bytes

Contents

require 'spec_helper'
require_relative 'support/middleware'

Plaza.configure :connection_spec do
  logger NullLogger.new
  use Example::HelloMiddleware
  use Example::GoodbyeMiddleware
end

describe Plaza::Connection do

  context 'with custom middeware' do
    it 'should run middleware in correct order' do
      stub_request(:get, "http://example.com/").
        with(:headers => {
          'Accept'=>'application/json',
          'Accept-Encoding'=>'gzip;q=1.0,deflate;q=0.6,identity;q=0.3',
          'Greetings'=>'HelloGoodbye',
          'X-User-Id'=>''}
        ).to_return(:status => 200, :body => "", :headers => {})
      connection = Plaza::Connection.for(:connection_spec)
      response = connection.get('http://example.com')
      expect(response.headers).to eq( {'Greetings' => 'GoodbyeHello'} )
    end

  end

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
plaza-0.1.1 spec/plaza/connection_spec.rb