Sha256: 825d77d3f4592f66d646610f00432f8c6399d09bfeecec602c38d708d4e4188e

Contents?: true

Size: 771 Bytes

Versions: 1

Compression:

Stored size: 771 Bytes

Contents

require 'spec_helper'

describe DiskCache do
  let(:path) { 'spec/asset/Trollface.svg' }
  let(:file) { File.open(path, 'r') }

  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(file, file_from_cache).should be_true
    end

    it ".pget" do
      DiskCache.del(path)
      file_from_cache = DiskCache.pget(path)
      FileUtils.compare_file(file, file_from_cache).should be_true
    end
  end

  context "removing data" do
    before(:each) { DiskCache.put(path) }

    it ".delete" do
      DiskCache.del(path)
      DiskCache.get(path).should be_nil
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
disk_cache-0.0.2 spec/file_cache/file_cache_spec.rb