百科.dev
全部条目在线工具AI 编程趋势榜开源项目技术资讯提交条目
登录
< 返回工具列表
F

fixture_kit

> 后端框架
开源

实现固定装置级的性能,而不放弃 FactoryBot 类型的测试设置。

176 stars0 点赞1 次浏览
访问官网GitHub

工具介绍

实现固定装置级的性能,而不放弃 FactoryBot 类型的测试设置。

FixtureKit

Fixture-level performance without giving up FactoryBot-style test setup.

Rails fixtures are very performant. But in large companies with hundreds of models and varying Rails familiarity, maintaining a well-manicured garden of YAML files quickly becomes unrealistic.

Teams reach for tools like FactoryBot to simplify test setup and keep things readable. The tradeoff is performance. FixtureKit gives you the speed wins while letting you keep the test setup tooling your teams already use, by generating and caching fixture data on-demand.

  • Full documentation (guides): GitHub Wiki
  • API/reference (canonical): docs/reference.md

Installation

ruby
group :test do
  gem "fixture_kit"
end

Quick Start

1. Define a fixture

ruby
# spec/fixture_kit/project_management.rb
FixtureKit.define do
  owner = User.create!(name: "Alice", email: "[email protected]")
  project = Project.create!(name: "Roadmap", owner: owner)

  expose(owner: owner, project: project)
end

2. Configure your framework

RSpec:

ruby
# spec/rails_helper.rb
require "fixture_kit/rspec"

RSpec.configure do |config|
  config.use_transactional_fixtures = true
end

Minitest:

ruby
# test/test_helper.rb
require "fixture_kit/minitest"

class ActiveSupport::TestCase
  self.use_transactional_tests = true
end

3. Use the fixture in tests

RSpec:

ruby
RSpec.describe Project do
  fixture "project_management"

  it "loads exposed records" do
    expect(fixture.project.owner).to eq(fixture.owner)
  end
end

Minitest:

ruby
class ProjectTest = 3.3
- ActiveRecord >= 8.0
- ActiveSupport >= 8.0

## Releasing

1. Bump the version in `lib/fixture_kit/version.rb`
2. Update lockfiles:
   ```sh
   bundle install
   cd spec/dummy && bundle install && cd ../..
   bundle exec appraisal install
  1. Commit and push to main:
    bash
    git add lib/fixture_kit/version.rb spec/dummy/Gemfile.lock gemfiles/*.gemfile.lock
    git commit -m "Release vX.Y.Z"
    git push
  2. Create a GitHub release:
    bash
    gh release create vX.Y.Z --title "vX.Y.Z" --target main --generate-notes

License

MIT. See LICENSE.

Issues· 8 开放

查看全部 Issues在 GitHub 打开

暂无开放 Issues,或尚未同步最近议题。

> 标签

Rubycachefactorybotfixturesrails

暂无评论,来聊聊你的看法吧

> 工具信息

发布日期2026年8月1日
最后更新2026年9月18日
分类后端框架
定价开源

> 相关工具

N
Node.js
基于 V8 的 JavaScript 运行时
D
Django
Python 高级 Web 框架
S
Spring Boot
Java 生态主流微服务框架