Sha256: 32a589defaa80578c415f4e6b454eef573db40eb56b16fd03d9822b3872d9d0b

Contents?: true

Size: 1.14 KB

Versions: 3

Compression:

Stored size: 1.14 KB

Contents

require 'pione/test-helper'

describe 'System::FileCache' do
  before do
    System::FileCache.clear
  end

  it 'shoud get cached file path' do
    orig_location = Location[Temppath.create].tap{|x| x.create("A")}
    cache_location = System::FileCache.get(orig_location)
    orig_location.should.exist
    cache_location.should.exist
    cache_location.read.should == "A"
    cache_location.path.ftype.should == "file"
    orig_location.read.should == "A"
    orig_location.path.ftype.should == "link"
  end

  it 'should put source into destination' do
    src = Location[Temppath.create].tap{|x| x.create("A")}
    dest = Location[Temppath.create]
    System::FileCache.put(src, dest)
    src.should.cached
    dest.should.cached
    System::FileCache.get(src).read.should == "A"
    System::FileCache.get(dest).read.should == "A"
    System::FileCache.get(src).should == System::FileCache.get(dest)
    src.path.ftype == "link"
    dest.path.ftype == "file"
    System::FileCache.get(src).path.ftype == "link"
  end

  it 'should cached' do
    orig = Location[Temppath.create].tap{|x| x.create("A")}
    System::FileCache.get(orig)
    orig.should.cached
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
pione-0.3.2 test/system/spec_file-cache.rb
pione-0.3.1 test/system/spec_file-cache.rb
pione-0.3.0 test/system/spec_file-cache.rb