Sha256: bbef6382dc3db758e2f01daa5eab34a75f37f7c157fc6db6ca55ad087526403b
Contents?: true
Size: 1.46 KB
Versions: 3
Compression:
Stored size: 1.46 KB
Contents
# -*- encoding : utf-8 -*- module Pacto class Consumer describe FaradayDriver do subject(:strategy) { described_class.new } let(:get_request) { Fabricate(:pacto_request, method: :get, host: 'http://localhost/', path: 'hello_world', params: { 'foo' => 'bar' }) } let(:post_request) { Fabricate(:pacto_request, method: :post, host: 'http://localhost/', path: 'hello_world', params: { 'foo' => 'bar' }) } describe '#execute' do before do WebMock.stub_request(:get, 'http://localhost/hello_world?foo=bar'). to_return(status: 200, body: '', headers: {}) WebMock.stub_request(:post, 'http://localhost/hello_world?foo=bar'). to_return(status: 200, body: '', headers: {}) end context 'for any request' do it 'returns the a Pacto::PactoResponse' do expect(strategy.execute get_request).to be_a Pacto::PactoResponse end end context 'for a GET request' do it 'makes the request thru the http client' do strategy.execute get_request expect(WebMock).to have_requested(:get, 'http://localhost/hello_world?foo=bar') end end context 'for a POST request' do it 'makes the request thru the http client' do strategy.execute post_request expect(WebMock).to have_requested(:post, 'http://localhost/hello_world?foo=bar') end end end end end end
Version data entries
3 entries across 3 versions & 1 rubygems