Sha256: 19d3092b8c49de0d2934faff46a9de294d7e4b3d01d3087b35205b2e153f4c65

Contents?: true

Size: 717 Bytes

Versions: 44

Compression:

Stored size: 717 Bytes

Contents

require 'rails_helper'

describe LHC::Caching do
  context 'parameters' do
    before(:each) do
      LHC.config.interceptors = [LHC::Caching]
      Rails.cache.clear
    end

    it 'considers parameters when writing/reading from cache' do
      LHC.config.endpoint(:local, 'http://local.ch', cache: true)
      stub_request(:get, 'http://local.ch').to_return(status: 200, body: 'The Website')
      stub_request(:get, 'http://local.ch?location=zuerich').to_return(status: 200, body: 'The Website for Zuerich')
      expect(
        LHC.get(:local).body
      ).to eq 'The Website'
      expect(
        LHC.get(:local, params: { location: 'zuerich' }).body
      ).to eq 'The Website for Zuerich'
    end
  end
end

Version data entries

44 entries across 44 versions & 1 rubygems

Version Path
lhc-6.4.0 spec/interceptors/caching/parameters_spec.rb
lhc-6.3.1 spec/interceptors/caching/parameters_spec.rb
lhc-6.3.0 spec/interceptors/caching/parameters_spec.rb
lhc-6.2.0 spec/interceptors/caching/parameters_spec.rb