-
Notifications
You must be signed in to change notification settings - Fork 0
Getting Started
Ngan Pham edited this page Feb 24, 2026
·
1 revision
Add FixtureKit in your test group:
group :test do
gem "fixture_kit"
endRSpec:
# spec/rails_helper.rb
require "fixture_kit/rspec"
RSpec.configure do |config|
config.use_transactional_fixtures = true
endMinitest:
# test/test_helper.rb
require "fixture_kit/minitest"
class ActiveSupport::TestCase
self.use_transactional_tests = true
end# spec/fixture_kit/project_management.rb
FixtureKit.define do
owner = User.create!(name: "Alice", email: "alice@example.com")
project = Project.create!(name: "Roadmap", owner: owner)
expose(owner: owner, project: project)
endIf you use Minitest conventions, place fixture files under test/fixture_kit.
RSpec example:
RSpec.describe Project do
fixture "project_management"
it "belongs to the exposed owner" do
expect(fixture.project.owner).to eq(fixture.owner)
end
endfixture returns a Repository. Exposed entries become methods (fixture.owner, fixture.project).
- Declaration patterns: Declaring Fixtures
- Framework behavior: Using Fixtures in RSpec, Using Fixtures in Minitest
- Full API signatures:
docs/reference.md