Sha256: d8e40cd38d905a04145ae2b93eb7b6acc37404c5e5061328983b531e5e17996c

Contents?: true

Size: 707 Bytes

Versions: 5

Compression:

Stored size: 707 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

5 entries across 5 versions & 1 rubygems

Version Path
cms_scanner-0.0.6 spec/lib/cache/typhoeus_spec.rb
cms_scanner-0.0.5 spec/lib/cache/typhoeus_spec.rb
cms_scanner-0.0.4 spec/lib/cache/typhoeus_spec.rb
cms_scanner-0.0.3 spec/lib/cache/typhoeus_spec.rb
cms_scanner-0.0.2 spec/lib/cache/typhoeus_spec.rb