Fake file system?
trans opened this issue · comments
Any way to use it for faking a fs? Would be nice for testing purposes.
Vfs knows nothing about the storage, it uses adapter to talk to it (local FS or S3 for example).
So, it can be faked by providing with in-memory adapter.
I used exactly this approach in testing first versions of Vfs, and there's actually fake in-memory adapter https://github.com/alexeypetrushin/vfs/tree/master/old
But, in later versions I removed it, mainly to reduce the size of source code and because I don't need it much.
It generally should work, but there may be errors, because it's old and the API of Vfs changed since the time I used it. It probably needs to be updated. But its code is quite simple and short.
If You need to fake original Ruby File, Dir and so on, there's special lib for this https://github.com/defunkt/fakefs
It also should work with Vfs, but there where bugs I tried it last time, don't know maybe they were already fixed.