Sha256: ae3fd47cdf82b911876e4f0d052b5e49cd2096787ded4fdfa5e653ee5ee764cd

Contents?: true

Size: 493 Bytes

Versions: 10

Compression:

Stored size: 493 Bytes

Contents

# frozen_string_literal: true

require 'rails_helper'

describe DHC do
  context 'interceptor' do
    before(:each) do
      class TrackingIdInterceptor < DHC::Interceptor
        def before_request
          request.params[:tid] = 123
        end
      end
      DHC.configure { |c| c.interceptors = [TrackingIdInterceptor] }
    end

    it 'can modify requests before they are send' do
      stub_request(:get, 'http://depay.fi/?tid=123')
      DHC.get('http://depay.fi')
    end
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
dhc-3.0.0 spec/interceptors/before_request_spec.rb
dhc-2.4.0 spec/interceptors/before_request_spec.rb
dhc-2.3.0 spec/interceptors/before_request_spec.rb
dhc-2.2.1 spec/interceptors/before_request_spec.rb
dhc-2.2.0 spec/interceptors/before_request_spec.rb
dhc-2.1.1 spec/interceptors/before_request_spec.rb
dhc-2.1.0 spec/interceptors/before_request_spec.rb
dhc-2.0.1 spec/interceptors/before_request_spec.rb
dhc-2.0.0 spec/interceptors/before_request_spec.rb
dhc-1.0.0 spec/interceptors/before_request_spec.rb