Sha256: e483c1f036e3452b6068f4862e088c690abdb579759649502a44a5f6c7bf00d7

Contents?: true

Size: 750 Bytes

Versions: 36

Compression:

Stored size: 750 Bytes

Contents

require 'core/spec_helper'

describe ZendeskAPI::Middleware::Request::EtagCache do
  it "caches" do
    client.config.cache.size = 1

    stub_json_request(:get, %r{blergh}, '{"x":1}', :headers => {"Etag" => "x"})
    first_response = client.connection.get("blergh")
    expect(first_response.status).to eq(200)
    expect(first_response.body).to eq({"x"=>1})

    stub_request(:get, %r{blergh}).to_return(:status => 304, :headers => {"Etag" => "x"})
    response = client.connection.get("blergh")
    expect(response.status).to eq(304)
    expect(response.body).to eq({"x"=>1})

    %w{content_encoding content_type content_length etag}.each do |header|
      expect(response.headers[header]).to eq(first_response.headers[header])
    end
  end
end

Version data entries

36 entries across 36 versions & 1 rubygems

Version Path
zendesk_api-1.13.1 spec/core/middleware/request/etag_cache_spec.rb
zendesk_api-1.12.1 spec/core/middleware/request/etag_cache_spec.rb
zendesk_api-1.12.0 spec/core/middleware/request/etag_cache_spec.rb
zendesk_api-1.11.7 spec/core/middleware/request/etag_cache_spec.rb
zendesk_api-1.11.6 spec/core/middleware/request/etag_cache_spec.rb
zendesk_api-1.11.5 spec/core/middleware/request/etag_cache_spec.rb
zendesk_api-1.11.4 spec/core/middleware/request/etag_cache_spec.rb
zendesk_api-1.11.3 spec/core/middleware/request/etag_cache_spec.rb
zendesk_api-1.11.2 spec/core/middleware/request/etag_cache_spec.rb
zendesk_api-1.11.1 spec/core/middleware/request/etag_cache_spec.rb
zendesk_api-1.11.0 spec/core/middleware/request/etag_cache_spec.rb
zendesk_api-1.10.0 spec/core/middleware/request/etag_cache_spec.rb
zendesk_api-1.9.6 spec/core/middleware/request/etag_cache_spec.rb
zendesk_api-1.9.5 spec/core/middleware/request/etag_cache_spec.rb
zendesk_api-1.9.4 spec/core/middleware/request/etag_cache_spec.rb
zendesk_api-1.9.3 spec/core/middleware/request/etag_cache_spec.rb
zendesk_api-1.9.2 spec/core/middleware/request/etag_cache_spec.rb
zendesk_api-1.9.1 spec/core/middleware/request/etag_cache_spec.rb
zendesk_api-1.9.0 spec/core/middleware/request/etag_cache_spec.rb
zendesk_api-1.8.0 spec/core/middleware/request/etag_cache_spec.rb