Testing¶
MedTracker uses RSpec with Capybara/Playwright and runs tests in PostgreSQL-backed test environments.
Standard test command¶
Always run tests through task:
task test
Run a targeted spec path:
task test TEST_FILE=spec/models/user_spec.rb
Test environments¶
- Dockerized test environment:
task testandtask test:*tasks - Local CI-like environment:
task local:*tasks
Useful local commands:
task local:test
task local:test:browser
task local:test:all
task local:clean
TDD workflow¶
MedTracker follows Red-Green-Refactor:
- Write a failing test first.
- Implement the minimal change to pass.
- Refactor while keeping tests green.
Browser/system coverage¶
System and feature tests live under spec/system/ and spec/features/.
Browser flows use Playwright in CI and local browser-enabled runs.
Linting¶
Run RuboCop through Taskfile:
task rubocop
task rubocop AUTOCORRECT=true
Test data¶
- Fixtures live in
spec/fixtures/ - Development seeding loads fixture-style data through
db/seeds.rb - Test fixture users use password:
password