This page provides an overview of testing strategies and example processes in the Solid::Process framework. It covers how the test suite is organized, the philosophy behind testing processes, and introduces the example processes used throughout the codebase as both tests and documentation.
For detailed testing patterns and best practices, see Testing Patterns and Best Practices. For in-depth walkthroughs of specific example processes, see Example Processes.
Solid::Process adopts a test-first approach where processes return explicit Success or Failure results rather than raising exceptions. This design makes testing straightforward: invoke the process and assert on the result type, data, and predicates.
The framework's testing strategy emphasizes:
.new(deps) to inject test doubles:invalid_input failures| Pattern | Use Case | Example |
|---|---|---|
.call(data) | Production usage, default dependencies | UserCreation.call(name: "John") |
.new().call(data) | Explicit instantiation, default dependencies | UserCreation.new.call(name: "John") |
.new(deps).call(data) | Testing with injected dependencies | UserCreation.new(repository: mock).call(name: "John") |
Sources: test/solid/process/result_test.rb10-15 test/solid/process/dependencies/result_test.rb10-15
The test suite follows a structured organization that separates framework tests from example process tests.
Key Locations:
test/solid/ - Framework component tests (Model, Input, Value, Process)test/solid/process/ - Process execution and result teststest/support/ - Shared fixtures including example processesSupport files use numbered prefixes (e.g., 010_, 050_) to control load order. Lower numbers load first, ensuring dependencies are available.
| File Pattern | Purpose |
|---|---|
010_*.rb | Database models and schema setup |
050_*.rb | Example processes without dependencies |
051_*.rb | Example processes with dependencies or composition |
052_*.rb | Complex multi-step example processes |
Sources: .claude/CLAUDE.md84-86
The framework tests across 8 Rails versions (6.0-8.1+edge) and 8 Ruby versions (2.7-4.0+head):
| Rails Version | Ruby Versions | Command |
|---|---|---|
| 6.0 | 2.7, 3.0 | bundle exec appraisal rails-6-0 rake test |
| 6.1 | 2.7, 3.0 | bundle exec appraisal rails-6-1 rake test |
| 7.0 | 3.0, 3.1, 3.2, 3.3 | bundle exec appraisal rails-7-0 rake test |
| 7.1 | 3.0, 3.1, 3.2, 3.3 | bundle exec appraisal rails-7-1 rake test |
| 7.2 | 3.1, 3.2, 3.3, 3.4 | bundle exec appraisal rails-7-2 rake test |
| 8.0 | 3.2, 3.3, 3.4 | bundle exec appraisal rails-8-0 rake test |
| 8.1 | 3.3, 3.4, 4.x | bundle exec appraisal rails-8-1 rake test |
| edge | head | bundle exec appraisal rails-edge rake test |
For detailed information on the multi-version testing strategy, see Multi-Version Testing Strategy.
Sources: .claude/CLAUDE.md14-34 .claude/CLAUDE.md94-103
The most fundamental testing pattern asserts on result types and their data:
Testing Success Results
Testing Failure Results
Sources: test/solid/process/result_test.rb21-46 test/solid/process/result_test.rb48-70
Processes that declare dependencies using the deps DSL can have those dependencies injected for testing:
For comprehensive coverage of testing patterns including mocking, stubbing, and input testing, see Testing Patterns and Best Practices.
Sources: test/solid/process/dependencies/result_test.rb21-40 test/solid/process/dependencies/result_test.rb42-69
Tests can verify that processes accept both raw hash data and pre-instantiated Input objects:
This pattern ensures processes handle both invocation styles correctly.
Sources: test/solid/process/result_test.rb17-19
The codebase includes several example processes that demonstrate framework features and serve as both tests and documentation.
| Process | File | Demonstrates |
|---|---|---|
UserCreationWithoutDeps | test/support/050_* | Basic process with input validation, no dependencies |
UserCreationWithDeps | test/support/050_* | Dependency injection with repository pattern |
User::Token::Creation | test/support/051_* | Namespaced process, token generation |
Account::OwnerCreation | test/support/052_* | Process composition using Steps DSL |
Sources: test/solid/process/result_test.rb21-46 test/solid/process/result_test.rb48-70
This process demonstrates the simplest pattern: input validation and database persistence without external dependencies.
Features Demonstrated:
:user_created, :invalid_input, :email_already_taken)Test Coverage:
Sources: test/solid/process/result_test.rb1-101
This process demonstrates dependency injection for improved testability.
Features Demonstrated:
deps DSL for declaring dependenciesUser model)Test Coverage:
:invalid_dependencies failureDependencies instance or individual attributesSources: test/solid/process/dependencies/result_test.rb1-111
This namespaced process demonstrates token generation patterns.
Features Demonstrated:
See Example Processes for detailed walkthrough.
Sources: .claude/CLAUDE.md86
This complex process demonstrates composition using the Steps DSL.
Features Demonstrated:
Given, and_then, Continue, and_expose)See Example Processes for detailed walkthrough.
Sources: .claude/CLAUDE.md86
The testing approach in Solid::Process emphasizes:
Success or Failure results.new(deps) to inject test doubles for isolationFor hands-on testing guidance, see Testing Patterns and Best Practices. For detailed process examples, see Example Processes.
Sources: test/solid/process/result_test.rb1-101 test/solid/process/dependencies/result_test.rb1-111 .claude/CLAUDE.md1-118
Refresh this wiki