# fakefs/fakefs

A fake filesystem. Use it in your tests.

Repository: https://github.com/fakefs/fakefs
Canonical: https://ross.abutalabs.com/products/fakefs
Language: Ruby
License: MIT
License Family: permissive
Last push: 2026-03-30T15:27:26+00:00

## Health v2 (maintenance only)
Score: 56/100 (v2, computed 2026-09-02T17:46:02.011165+00:00)
- activity 74, release rhythm 8, longevity 100
- inputs: {"age_days": 6305, "days_push": 156, "days_rel": null, "gap_med": null, "n_releases_24m": 0}
- flags: none
- formula: round(0.45*activity + 0.35*rhythm + 0.20*longevity); archived -> min(score, 10)

## Adoption (not part of the score)
Stars 1061, forks 191 (observed 2026-08-28T04:03:25.909212+00:00)

## What it is
FakeFS is a Ruby gem that provides an in-memory fake filesystem, monkey-patching File, FileUtils, Dir, and related classes so tests can exercise filesystem code without touching the real disk. It can be activated temporarily via a block or helper modules for RSpec.

## Use cases
- test ruby code that writes files without touching the real disk
- mock filesystem operations in rspec tests
- avoid mocking FileUtils calls directly in unit tests
- create isolated temporary filesystems for each test
- test code that uses absolute paths safely

## When to choose
- you are writing Ruby tests for code that reads or writes the filesystem
- you want behavior-based tests instead of brittle method mocks on File or FileUtils
- you need a fresh, isolated filesystem per test example

## When to avoid
- your code relies on IO methods beyond basic file operations, which are not mocked by default
- you can simply use real temp directories (Dir.mktmpdir) for your tests
- your project uses gems that monkey-patch File and may conflict with FakeFS

## Facets
- artifact type: library
- maturity: active
- function: testing, mocking, file-system
- domain: testing, developer-tools, files
- platform: ruby, cross-platform
- tags: fake-filesystem, ruby-gem, rspec, test-isolation

## Member repositories
- fakefs/fakefs (main) score 56

## Provenance
- Observed fields: from GitHub, fetched 2026-08-28T04:03:25.909212+00:00.
- Health v2: computed from the inputs above; adoption is never an input.
- Inferred fields (summary, facets, guidance): AI-extracted, prompt v1, taxonomy v1, on 2026-08-30T06:56:50.324166+00:00, confidence not recorded.
  - readme: https://github.com/fakefs/fakefs (fetched 2026-08-28T04:03:25.909212+00:00, sha b6843742b756)
- Data as of 2026-08-30T08:39:29.467469+00:00.
