Sha256: abf9ffa9136f5924b3b8a6e45401169ffeb29f28f569819a79d1923ccb786920

Contents?: true

Size: 959 Bytes

Versions: 1

Compression:

Stored size: 959 Bytes

Contents

# -*- encoding : utf-8 -*-
module Pacto
  module DummyServer
    describe PlaybackServlet do
      let(:request) { double }
      let(:response) { double('response', :status= => '', :[]= => '', :body= => '') }

      it 'alters response data with recorded status' do
        servlet = PlaybackServlet.new status: 200
        servlet.do_GET(request, response)
        expect(response).to have_received(:status=).with(200)
      end

      it 'alters reponse data with recorded headers' do
        servlet = PlaybackServlet.new headers: { 'Content-Type' => 'application/json' }
        servlet.do_GET(request, response)
        expect(response).to have_received(:[]=).with('Content-Type', 'application/json')
      end

      it 'alters reponse data with recorded ' do
        servlet = PlaybackServlet.new body: 'recorded'
        servlet.do_GET(request, response)
        expect(response).to have_received(:body=).with('recorded')
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
pacto-0.4.0.rc1 spec/unit/pacto/server/playback_servlet_spec.rb