Sha256: cbbe7bda00a9a53c0869e9626bc352bb97e7106c3db17b507453f45ebd42115c

Contents?: true

Size: 838 Bytes

Versions: 10

Compression:

Stored size: 838 Bytes

Contents

require 'rack/test'
require 'request_tracer/trace'
require 'request_tracer/integration/rest_client_handler'
require 'webmock/rspec'

describe RequestTracer::Integration::RestClientHandler do
  include RequestTracer::Integration::Base
  RequestTracer.integrate_with(:rest_client)
  before(:all) { WebMock.disable_net_connect! }

  let(:trace) { RequestTracer::Trace.create }

  before do
    RequestTracer::Trace.clear
    stub_request(:any, "www.example.com")
    allow(RequestTracer::Trace).to receive(:record).and_yield(trace)
    RestClient.get("www.example.com")
  end

  context "when no previous trace existed on the stack" do
    it "sets fresh trace headers on the outgoing call" do
      expect(WebMock).to have_requested(:get, "www.example.com").
        with(headers: extract_headers_from_fields(trace.to_h))
    end
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
request-tracer-0.7.0 spec/lib/request_tracer/integration/rest_client_handler_spec.rb
request-tracer-0.6.6 spec/lib/request_tracer/integration/rest_client_handler_spec.rb
request-tracer-0.6.5 spec/lib/request_tracer/integration/rest_client_handler_spec.rb
request-tracer-0.6.4 spec/lib/request_tracer/integration/rest_client_handler_spec.rb
request-tracer-0.6.3 spec/lib/request_tracer/integration/rest_client_handler_spec.rb
request-tracer-0.6.2 spec/lib/request_tracer/integration/rest_client_handler_spec.rb
request-tracer-0.6.1 spec/lib/request_tracer/integration/rest_client_handler_spec.rb
request-tracer-0.5.8 spec/lib/request_tracer/integration/rest_client_handler_spec.rb
request-tracer-0.5.6 spec/lib/request_tracer/integration/rest_client_handler_spec.rb
request-tracer-0.5.5 spec/lib/request_tracer/integration/rest_client_handler_spec.rb