I'm in need of some code which fakes the actual file system to a fake one. So, when I start it it converts /home/user/Documents/fake_fs
to /
, so every Dir
or File
call goes to that directory. An example:
I want to make a file on /some_file
, so I use:
File.open('/some_file', 'w') do |f|
f.puts 'something on this file'
end
And it would write it on /home/user/Documents/fake_fs/some_file
instead of /some_file
. Is there any way of doing this? Thanks!