Releases: Gusto/fixture_kit
Releases · Gusto/fixture_kit
v0.12.0
v0.11.2
What's Changed
- Fix STI resolution for models inheriting directly from ActiveRecord::Base by @robbiegill in #34
Full Changelog: v0.11.1...v0.11.2
v0.11.1
v0.11.0
v0.10.0
Fixture Inheritance
Fixtures can now extend other fixtures via extends:, enabling parent-child relationships that share setup data without duplication.
Named fixture inheritance
Define a base fixture, then extend it in a child file:
# spec/fixture_kit/company/base.rb
FixtureKit.define do
company = Company.create!(name: "Acme Corp")
owner = User.create!(name: "Alice", company: company, role: "owner")
expose(company: company, owner: owner)
end
# spec/fixture_kit/company/with_employees.rb
FixtureKit.define(extends: "company/base") do
employee = User.create!(name: "Bob", company: parent.company, role: "employee")
expose(employee: employee)
endInline fixture inheritance
Extend a named fixture directly in a test:
RSpec.describe "onboarding" do
fixture(extends: "company/base") do
onboarding = Onboarding.create!(company: parent.company, admin: parent.owner)
expose(onboarding: onboarding)
end
it "sets up onboarding for the company" do
expect(fixture.onboarding.company.name).to eq("Acme Corp")
end
endMulti-level chains
Inheritance chains work to any depth — grandchild → child → base. Parent fixtures are generated before their children automatically.
Exposure rules
Only the child's explicitly exposed records are accessible via fixture.*. Parent records are present in the database and reachable through associations, but not auto-exposed.
Circular dependency detection
Circular chains (A extends B, B extends A) are detected at registration time and raise FixtureKit::CircularFixtureInheritance.
Breaking Changes
Fixture#cacherenamed toFixture#generateRegistry#addargument order changed to(name_or_definition, scope)Runner#registerargument order changed to(name_or_definition, scope)- Cache data format changed: model classes as keys instead of string names
Repositoryrecord format changed from{ "model" => name, "id" => id }to{ ModelClass => id }
v0.9.1
v0.9.0
v0.8.0
v0.7.0
Highlights
- Added STI-aware SQL write tracking so fixture caching resolves subclass write events to the base table-owning model.
- Added dummy app STI integration coverage for both RSpec and Minitest.
- Improved cache replay behavior by batching restore statements per connection in
Cache#load. - Moved cache generation into framework lifecycle hooks while keeping runner startup focused on cache clearing/start state.
Tooling and Test Coverage
- Extended unit coverage across runner lifecycle, SQL subscriber event handling, and cache replay behavior.
- Expanded integration coverage in dummy app suites for STI and queue-style execution behavior.
Full Changelog
v0.6.0
Highlights
- Moved fixture cache generation into framework lifecycle hooks:
- RSpec generates per declaring group in
before(:context). - Minitest generates per declaring class in class-level
run_suite.
- RSpec generates per declaring group in
- Simplified runner startup semantics:
Runner#startnow handles startup/clear-cache only.- Cache generation is now framework-driven.
- Improved cache loading performance by batching restore statements per DB connection and issuing one
execute_batchper connection.
Additional updates
- README lifecycle documentation updated to match current behavior.
- Expanded unit coverage for runner lifecycle, RSpec/Minitest entrypoint behavior, and cache batching.