Sha256: 5ecdaa61a80f9a7c198be195d902e8c66d3581ed51cd8736bf900e9128feba46

Contents?: true

Size: 1.37 KB

Versions: 10

Compression:

Stored size: 1.37 KB

Contents

require 'spec_helper'

describe 'UniversalEntry' do
  with_test_dir

  before do
    @path = test_dir['a/b/c']
  end

  describe 'existence' do
    it "should check both files and dirs" do
      @path.should_not exist
      @path.dir.create
      @path.should be_dir
      @path.should exist

      @path.file.create
      @path.should be_file
      @path.should exist
    end
  end

  describe 'destroying' do
    it "should destroy both files and dirs" do
      @path.dir.create
      @path.should be_dir
      @path.entry.destroy
      @path.should_not exist

      @path.file.create
      @path.should be_file
      @path.entry.destroy
      @path.should_not exist
    end

    it "shouldn't raise if file not exist" do
      @path.destroy
    end
  end

  describe 'copy_to' do
    before do
      @from = @path.dir
      @from.create
      @from.file('file').write 'something'
      @from.dir('dir').create.tap do |dir|
        dir.file('file2').write 'something2'
      end

      @to = test_dir['to']
    end

    it "shoud copy dir" do
      @from.entry.copy_to @to
      @to['dir/file2'].file?.should be_true
    end

    it "should copy file" do
      @from['file'].entry.copy_to @to
      @to.file.should be_true
    end

    it "should raise if entry not exist" do
      -> {@from['non existing'].entry.copy_to @to}.should raise_error(/not exist/)
    end
  end

  describe 'move_to'
end

Version data entries

10 entries across 10 versions & 2 rubygems

Version Path
vfs-momolog-0.0.1 spec/universal_entry_spec.rb
vfs-0.4.8 spec/universal_entry_spec.rb
vfs-0.4.7 spec/universal_entry_spec.rb
vfs-0.4.6 spec/universal_entry_spec.rb
vfs-0.4.5 spec/universal_entry_spec.rb
vfs-0.4.4 spec/universal_entry_spec.rb
vfs-0.4.3 spec/universal_entry_spec.rb
vfs-0.4.2 spec/universal_entry_spec.rb
vfs-0.4.1 spec/universal_entry_spec.rb
vfs-0.4.0 spec/universal_entry_spec.rb