Sha256: 32134ae007f27d388f58641700a530bd8205d1f95a76f651a5a4cad2b9ec1f43

Contents?: true

Size: 809 Bytes

Versions: 54

Compression:

Stored size: 809 Bytes

Contents

require 'rails_helper'

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

  let!(:first_request) do
    stub_request(:get, "http://local.ch/").to_return(body: 'Website')
  end

  let!(:second_request) do
    stub_request(:get, "http://local.ch/weather").to_return(body: 'The weather')
  end

  it 'does not fetch requests served from cache when doing requests in parallel with hydra' do
    LHC.request([{ url: 'http://local.ch', cache: true }, { url: 'http://local.ch/weather', cache: true }])
    LHC.request([{ url: 'http://local.ch', cache: true }, { url: 'http://local.ch/weather', cache: true }])
    assert_requested first_request, times: 1
    assert_requested second_request, times: 1
  end
end

Version data entries

54 entries across 54 versions & 1 rubygems

Version Path
lhc-10.1.2 spec/interceptors/caching/hydra_spec.rb
lhc-10.1.1 spec/interceptors/caching/hydra_spec.rb
lhc-10.1.0 spec/interceptors/caching/hydra_spec.rb
lhc-10.0.2 spec/interceptors/caching/hydra_spec.rb
lhc-9.4.4 spec/interceptors/caching/hydra_spec.rb
lhc-10.0.1 spec/interceptors/caching/hydra_spec.rb
lhc-10.0.0 spec/interceptors/caching/hydra_spec.rb
lhc-9.4.3 spec/interceptors/caching/hydra_spec.rb
lhc-9.4.2 spec/interceptors/caching/hydra_spec.rb
lhc-9.4.1 spec/interceptors/caching/hydra_spec.rb
lhc-9.4.0 spec/interceptors/caching/hydra_spec.rb
lhc-9.3.1 spec/interceptors/caching/hydra_spec.rb
lhc-9.3.0 spec/interceptors/caching/hydra_spec.rb
lhc-9.2.0 spec/interceptors/caching/hydra_spec.rb
lhc-9.1.2 spec/interceptors/caching/hydra_spec.rb
lhc-9.1.2.pre spec/interceptors/caching/hydra_spec.rb
lhc-9.1.1 spec/interceptors/caching/hydra_spec.rb
lhc-8.1.1 spec/interceptors/caching/hydra_spec.rb
lhc-9.1.0 spec/interceptors/caching/hydra_spec.rb
lhc-9.0.0 spec/interceptors/caching/hydra_spec.rb