Sha256: 45a442c0ca940af0e3aa795ccbc9740b1b1d7798499836c94db393bce3a8d298

Contents?: true

Size: 1.09 KB

Versions: 2

Compression:

Stored size: 1.09 KB

Contents

require 'spec_helper'
File.file_mutate :delete

describe FileMutate do
  let(:file_to_delete)  { fixture_file 'file_to_delete.txt' }

  describe '#delete! (class)' do
    it 'should delete file' do
      File.overwrite(file_to_delete) do
        'Delete this!'
      end
      File.delete! file_to_delete
      File.exist?(file_to_delete).should be_false
    end
  end

  describe '#delete_file! (class)' do
    it 'should delete file' do
      File.overwrite(file_to_delete) do
        'Delete this!'
      end
      File.delete_file! file_to_delete
      File.exist?(file_to_delete).should be_false
    end
  end

  describe '#delete! (instance)' do
    it 'should delete file' do
      File.overwrite(file_to_delete) do
        'Delete this!'
      end
      File.new(file_to_delete).delete!
      File.exist?(file_to_delete).should be_false 
    end
  end

  describe '#delete_file! (instance)' do
    it 'should delete file' do
      File.overwrite(file_to_delete) do
        'Delete this!'
      end
      File.new(file_to_delete).delete_file!
      File.exist?(file_to_delete).should be_false 
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
file_mutate-0.1.3 spec/file_mutate/delete_spec.rb
file_mutate-0.1.2 spec/file_mutate/delete_spec.rb