Sha256: 22b96fba03675b351625b1fba6d9a59f53fb31afc05f4bb77583354b04559ce2

Contents?: true

Size: 840 Bytes

Versions: 49

Compression:

Stored size: 840 Bytes

Contents

# frozen_string_literal: true

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

49 entries across 49 versions & 1 rubygems

Version Path
lhc-15.2.1 spec/interceptors/caching/hydra_spec.rb
lhc-15.2.0 spec/interceptors/caching/hydra_spec.rb
lhc-15.1.3 spec/interceptors/caching/hydra_spec.rb
lhc-15.1.2 spec/interceptors/caching/hydra_spec.rb
lhc-15.1.1 spec/interceptors/caching/hydra_spec.rb
lhc-15.1.0 spec/interceptors/caching/hydra_spec.rb
lhc-16.0.0.pre.pro2162.2 spec/interceptors/caching/hydra_spec.rb
lhc-16.0.0.pre.pro2162 spec/interceptors/caching/hydra_spec.rb
lhc-15.0.1 spec/interceptors/caching/hydra_spec.rb
lhc-15.0.0 spec/interceptors/caching/hydra_spec.rb
lhc-14.0.0 spec/interceptors/caching/hydra_spec.rb
lhc-13.4.0.pre.pro1766.1 spec/interceptors/caching/hydra_spec.rb
lhc-13.2.0 spec/interceptors/caching/hydra_spec.rb
lhc-13.1.0 spec/interceptors/caching/hydra_spec.rb
lhc-13.0.0 spec/interceptors/caching/hydra_spec.rb
lhc-12.3.0 spec/interceptors/caching/hydra_spec.rb
lhc-12.2.1 spec/interceptors/caching/hydra_spec.rb
lhc-12.2.0 spec/interceptors/caching/hydra_spec.rb
lhc-12.1.3 spec/interceptors/caching/hydra_spec.rb
lhc-12.1.2 spec/interceptors/caching/hydra_spec.rb