Sha256: 44ae6e4f7aa4509827e1af68a9c37440a4f161c7ff46953fcab1ceebe2c6e874

Contents?: true

Size: 1000 Bytes

Versions: 2

Compression:

Stored size: 1000 Bytes

Contents

require 'rspec_ext'
require 'ruby_ext'

require 'tilt'
require 'vfs'

rspec do
  def self.with_test_fs        
    before do
      @test_fs = "/tmp/test_fs".to_dir
      
      FileUtils.rm_r test_fs.path if File.exist? test_fs.path
      FileUtils.mkdir_p test_fs.path
    end
    
    after do      
      FileUtils.rm_r test_fs.path if File.exist? test_fs.path
      @test_fs = nil
    end
  end
  
  def test_fs
    @test_fs
  end
end

# require 'fakefs/spec_helpers'
# 
# include FakeFS::SpecHelpers
# use_fakefs self
# 
# 
# # 
# # FakeFS fixes
# # 
# FakeFS::File::Stat.class_eval do
#   # there's also file? method defined on File::Stat
#   def file?; !directory? end
# end
# 
# FakeFS::File.class_eval do
#   class << self
#     # File.delete should raise error if it's directory
#     alias_method :delete_without_bang, :delete
#     def delete path
#       raise Errno::EPERM, "Operation not permitted - #{path}" if directory?(path)
#       delete_without_bang path
#     end
#   end
# end

Version data entries

2 entries across 2 versions & 1 rubygems

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