simonc / memfs

MemFs provides a fake file system that can be used for tests. Strongly inspired by FakeFS.
MIT License
322 stars 27 forks source link

Missing Dir.mktmpdir #36

Open djberg96 opened 2 years ago

djberg96 commented 2 years ago

The tmpdir library in the stdlib implements a single method called mktmpdir. I'd like to be able to use it for an eloop test that looks something like this:

  require 'tmpdir'
  Dir.chdir(Dir.mktmpdir) do
    File.symlink('eloop0', 'eloop1')
    File.symlink('eloop1', 'eloop0')
    expected = ['./eloop0', './eloop1']

    results = described_class.new(:path => '.', :follow => true).find
    expect(results.sort).to eq(expected)
  end

However, with memfs I'm getting:

undefined method 'mktmpdir' for MemFs::Dir:Class

Can that be implemented?

simonc commented 2 years ago

Hi. Thanks for reporting this issue. Sadly I'm on an extremely tight schedule and can't spend to much time maintaining the project. I'm open to reviewing a PR if you'd like to have a stab at it though 😊