Sha256: 4f1e62f7c6713b69f98e284c327078f527f2aa1d31582c14328451f5b7fb168d

Contents?: true

Size: 952 Bytes

Versions: 2

Compression:

Stored size: 952 Bytes

Contents

require 'spec_helper'

describe 'Container' do
  with_test_fs
  
  it "should threat paths as UniversalEntry except it ends with '/'" do
    test_fs.should_receive(:entry).with('tmp/a/b')
    test_fs['tmp/a/b']
    
    test_fs.should_receive(:dir).with('tmp/a/b')
    test_fs['tmp/a/b/']
  end
  
  it '/' do
    test_fs[:some_path].should == test_fs / :some_path
    test_fs[:some_path][:another_path].should == test_fs / :some_path / :another_path
  end
  
  it "UniversalEntry should be wrapped inside of proxy, Dir and File should not" do
    -> {test_fs.dir.proxy?}.should raise_error(NoMethodError)
    -> {test_fs.file.proxy?}.should raise_error(NoMethodError)
    test_fs.entry.proxy?.should be_true
  end
  
  it "sometimes it also should inexplicitly guess that path is a Dir instead of UniversalEntry (but still wrap it inside of Proxy)" do
    dir = test_fs['tmp/a/..']
    dir.proxy?.should be_true
    dir.should be_a(Vfs::Dir)
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
vfs-0.3.12 spec/container_spec.rb
vfs-0.3.11 spec/container_spec.rb