Skip to main content

Why Smartest

Smartest introduces pytest-style fixtures for Ruby.

It is a small Ruby test runner that brings pytest-style fixture injection, explicit fixture dependencies, and fixture teardown to Ruby tests.

It is designed around three ideas:

  • Tests should read naturally at the top level.
  • Fixture usage should be explicit in the test signature.
  • Teardown should be written only for fixtures that actually need it.
# smartest/fixtures/web_fixture.rb
class WebFixture < Smartest::Fixture
fixture :server do
server = TestServer.start
on_teardown { server.stop }
server
end

fixture :client do |server:|
Client.new(base_url: server.url)
end
end

# smartest/test_helper.rb
around_suite do |suite|
use_fixture WebFixture
suite.run
end

# smartest/web_test.rb
test("GET /health") do |client:|
response = client.get("/health")

expect(response.status).to eq(200)
end

What to Read First

Current Scope

Smartest currently focuses on a small runner API:

  • top-level test
  • class-based fixtures
  • keyword-argument fixture injection
  • fixture dependencies through keyword arguments
  • fixture teardown
  • suite-scoped fixtures through suite_fixture
  • fixture-scoped method stubs and block-scoped constant stubs
  • suite hooks through around_suite
  • test hooks through around_test
  • skipped and pending tests through skip and pending
  • expectation matchers through expect
  • console reporting
  • a CLI runner

Nested describe blocks, watch mode, parallel execution, and file-scoped fixtures are not part of the current MVP.