Sha256: ca28f3a4c29b0dba12044f3889f22250b818e6fbe7fda0d1e694dd9eb172b482

Contents?: true

Size: 968 Bytes

Versions: 3

Compression:

Stored size: 968 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

3 entries across 3 versions & 1 rubygems

Version Path
vfs-0.3.15 spec/spec_helper.rb
vfs-0.3.14 spec/spec_helper.rb
vfs-0.3.13 spec/spec_helper.rb