Sha256: 00134cd8fe8d56fc6eb150917f6c1d1c745d98cae2c3cea1e09a1bd359f3db1e
Contents?: true
Size: 1.4 KB
Versions: 3
Compression:
Stored size: 1.4 KB
Contents
require 'spec_helper' describe DiskCache do let(:path) { 'spec/asset/Trollface.svg' } before(:each) { DiskCache.clear! } context "storing and accessing" do it ".put" do DiskCache.put(path) DiskCache.get(path).should_not be_nil end it ".get" do DiskCache.put(path) file_from_cache = DiskCache.get(path) FileUtils.compare_file(path, file_from_cache).should be_true end it ".pget" do DiskCache.del(path) file_from_cache = DiskCache.pget(path) FileUtils.compare_file(path, file_from_cache).should be_true end it ".filepath" do DiskCache.put(path) DiskCache.filepath(path).should include( 'cache/fb/2b/228b717ea0a569bc7d12187ff55e5e3a0180') end end context "removing data" do before(:each) { DiskCache.put(path) } it ".delete" do DiskCache.del(path) DiskCache.get(path).should be_nil end it ".clear" do DiskCache.clear! DiskCache.get(path).should be_nil end end context "sanity" do let(:web) { 'http://example.com/Troll face.svg' } before(:each) do stub_request(:get, "http://example.com/Troll face.svg"). to_return(body: File.read(path)) end it "should handle urls with spaces" do DiskCache.put(web) file_from_cache = DiskCache.get(web) FileUtils.compare_file(path, file_from_cache).should be_true end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
disk_cache-0.0.6 | spec/disk_cache/disk_cache_spec.rb |
disk_cache-0.0.5 | spec/disk_cache/disk_cache_spec.rb |
disk_cache-0.0.4 | spec/disk_cache/disk_cache_spec.rb |