Module: Servactory::TestKit::Rspec::Helpers
- Includes:
- ArgumentMatchers, Fluent, Legacy
- Defined in:
- lib/servactory/test_kit/rspec/helpers.rb,
lib/servactory/test_kit/rspec/helpers/fluent.rb,
lib/servactory/test_kit/rspec/helpers/legacy.rb,
lib/servactory/test_kit/rspec/helpers/mock_executor.rb,
lib/servactory/test_kit/rspec/helpers/input_validator.rb,
lib/servactory/test_kit/rspec/helpers/output_validator.rb,
lib/servactory/test_kit/rspec/helpers/argument_matchers.rb,
lib/servactory/test_kit/rspec/helpers/service_mock_config.rb,
lib/servactory/test_kit/rspec/helpers/service_mock_builder.rb,
lib/servactory/test_kit/rspec/helpers/concerns/error_messages.rb,
lib/servactory/test_kit/rspec/helpers/concerns/service_class_validation.rb
Overview
RSpec helper methods for mocking Servactory services.
## Purpose
Provides convenient helper methods for mocking Servactory service calls in RSpec tests. Supports both a modern fluent API and backward-compatible legacy methods.
## Usage
Include in RSpec configuration:
“‘ruby RSpec.configure do |config|
config.include Servactory::TestKit::Rspec::Helpers, type: :service
end “‘
## Available Helpers
**Fluent API (recommended):**
-
‘allow_service(ServiceClass)` - mock `.call` method (returns Result)
-
‘allow_service!(ServiceClass)` - mock `.call!` method (raises on failure)
**Backward-Compatible API:**
-
‘allow_service_as_success!` / `allow_service_as_success`
-
‘allow_service_as_failure!` / `allow_service_as_failure`
**Argument Matchers:**
-
‘including(hash)` - partial hash matching
-
‘excluding(hash)` - exclusion matching
-
‘any_inputs` - match any arguments
-
‘no_inputs` - match no arguments
Defined Under Namespace
Modules: ArgumentMatchers, Concerns, Fluent, Legacy Classes: InputValidator, MockExecutor, OutputValidator, ServiceMockBuilder, ServiceMockConfig
Method Summary
Methods included from Legacy
#allow_service_as_failure, #allow_service_as_failure!, #allow_service_as_success, #allow_service_as_success!
Methods included from Fluent
#allow_service, #allow_service!