Skip to main content

Smartest

Pytest-style fixtures for Ruby.

# 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

Write Tests

Declare test dependencies with Ruby keyword arguments.

Read the guide

Run Suites

Run a single file with autorun or execute a suite through the CLI.

Run tests

Use Fixtures

Define fixture dependencies and teardown close to resource setup.

Learn fixtures