You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+109-1Lines changed: 109 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -9,6 +9,8 @@ FixtureBot lets you define your test data in a Ruby DSL and compiles it into sta
9
9
-**Ruby DSL** for defining records, associations, and join tables
10
10
-**Generators** for filling in required columns (like email) across all records
11
11
-**Stable IDs** so foreign keys are consistent and diffs are clean across runs
12
+
-**UUID support** for tables with UUID primary keys
13
+
-**Polymorphic associations** with automatic type column resolution
12
14
-**Schema auto-detection** from your Rails database (no manual column lists)
13
15
-**Auto-generates** before your test suite runs (RSpec and Minitest)
14
16
@@ -175,7 +177,13 @@ FixtureBot.define do
175
177
end
176
178
```
177
179
178
-
The generator block receives a `fixture` object as a block parameter with access to `fixture.key` (the record's symbol name). Bare methods inside the block refer to column values set on the record.
180
+
The generator block receives a `fixture` object with a `key` method (the record's symbol name). Bare methods inside the block refer to column values set on the record:
FixtureBot generates deterministic UUID v5 values, so the output is stable across runs.
318
+
319
+
You can also provide your own key strategy — any object (or module) that responds to `generate(table_name, record_name)`. For example, Stripe-style prefixed IDs:
0 commit comments