Skip to content

Commit b99c36c

Browse files
committed
Add Prior art section comparing FixtureBot to Oaken
1 parent c8a2071 commit b99c36c

1 file changed

Lines changed: 18 additions & 0 deletions

File tree

README.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -271,6 +271,24 @@ FixtureBot::Schema.define do
271271
end
272272
```
273273

274+
## Prior art
275+
276+
### [Oaken](https://github.com/kaspth/oaken)
277+
278+
Oaken and FixtureBot share the same motivation: replace hand-written YAML fixtures with a Ruby DSL. They take very different approaches.
279+
280+
**Oaken inserts records into the database** at runtime using `ActiveRecord::Base#create!`. It also supports loading different seed files per test case (`seed "cases/pagination"`), which means your data set can vary across tests. This flexibility comes at a cost: you lose the "load once, wrap every test in a transaction" speed advantage that makes Rails fixtures fast. It's closer to factories in that regard, with more structure around organizing seed scripts.
281+
282+
**FixtureBot is more opinionated.** One fixture file, one data set, compiled to plain YAML and checked into git. At test time, FixtureBot is out of the picture entirely. Rails loads the YAML fixtures once and wraps each test in a transaction as usual. No runtime dependency, no per-test seeding, no seed file organization to manage.
283+
284+
| | FixtureBot | Oaken |
285+
|---|---|---|
286+
| **Output** | YAML files checked into git | Records inserted at test time |
287+
| **Runtime dependency** | None. Rails loads YAML | Required to seed data |
288+
| **Data set** | One set, loaded once | Per-test sets via seed files |
289+
| **Associations** | Symbolic refs resolved at compile time | Ruby object refs at runtime |
290+
| **Stable IDs** | Deterministic via `Zlib.crc32` | Database-assigned |
291+
274292
## Development
275293

276294
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt.

0 commit comments

Comments
 (0)