Sha256: 0169f12a4d6e9d02f7e57dd24cbea8d3a86bd68f802cba9e0612bdd73dea4808

Contents?: true

Size: 705 Bytes

Versions: 12

Compression:

Stored size: 705 Bytes

Contents

require 'spec_helper'

describe CMSScanner::Cache::Typhoeus do
  subject(:cache) { described_class.new(cache_dir) }

  let(:cache_dir) { File.join(CACHE, 'typhoeus_cache') }
  let(:url)       { 'http://example.com' }
  let(:request)   { Typhoeus::Request.new(url, cache_ttl: 20) }
  let(:key)       { request.hash.to_s }

  describe '#get' do
    it 'calls #read_entry' do
      expect(cache).to receive(:read_entry).with(key)

      cache.get(request)
    end
  end

  describe '#set' do
    let(:response) { Typhoeus::Response.new }

    it 'calls #write_entry' do
      expect(cache).to receive(:write_entry).with(key, response, request.cache_ttl)

      cache.set(request, response)
    end
  end
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
cms_scanner-0.0.18 spec/lib/cache/typhoeus_spec.rb
cms_scanner-0.0.17 spec/lib/cache/typhoeus_spec.rb
cms_scanner-0.0.16 spec/lib/cache/typhoeus_spec.rb
cms_scanner-0.0.15 spec/lib/cache/typhoeus_spec.rb
cms_scanner-0.0.14 spec/lib/cache/typhoeus_spec.rb
cms_scanner-0.0.13 spec/lib/cache/typhoeus_spec.rb
cms_scanner-0.0.12 spec/lib/cache/typhoeus_spec.rb
cms_scanner-0.0.11 spec/lib/cache/typhoeus_spec.rb
cms_scanner-0.0.10 spec/lib/cache/typhoeus_spec.rb
cms_scanner-0.0.9 spec/lib/cache/typhoeus_spec.rb
cms_scanner-0.0.8 spec/lib/cache/typhoeus_spec.rb
cms_scanner-0.0.7 spec/lib/cache/typhoeus_spec.rb