Sha256: 8209c59d83fbff3a5b5e33e085371d0f867da7ccc8ec7ed5224da9fb07ff520b
Contents?: true
Size: 1.31 KB
Versions: 1
Compression:
Stored size: 1.31 KB
Contents
require 'spec_helper' describe S3Repo::Cache do it 'serves a file', vcr: { cassette_name: 'cache' } do with_auth do resp = S3Repo::Cache.new.serve('repo.db') expect(resp).to be_an_instance_of String end end context 'by default' do it 'tries to cache the file', vcr: { cassette_name: 'cache' } do with_auth do cache = S3Repo::Cache.new cache.serve('repo.db') expect { cache.serve('repo.db') }.to raise_exception( VCR::Errors::UnhandledHTTPRequestError ) end end it 'checks etag for caching', vcr: { cassette_name: 'etag_cache' } do with_auth do cache = S3Repo::Cache.new res = (1..2).map do cache.serve('repo.db') cache.send(:etags)['repo.db'] end expect(res.first).to eql res.last end end end context 'with refresh = false' do it 'caches the file', vcr: { cassette_name: 'cache' } do with_auth do cache = S3Repo::Cache.new cache.serve('repo.db') expect(cache.serve('repo.db', false)).to be_an_instance_of String end end end it 'returns nil if key does not exist', vcr: { cassette_name: 'nil_cache' } do with_auth do cache = S3Repo::Cache.new expect(cache.serve('nonexistent-file')).to be_nil end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
s3repo-1.0.0 | spec/s3repo/cache_spec.rb |