Class: Servactory::TestKit::Rspec::Matchers::HaveServiceInternalMatcher
- Inherits:
-
Base::AttributeMatcher
- Object
- Base::AttributeMatcher
- Servactory::TestKit::Rspec::Matchers::HaveServiceInternalMatcher
- Defined in:
- lib/servactory/test_kit/rspec/matchers/have_service_internal_matcher.rb
Overview
RSpec matcher for validating Servactory service internal definitions.
## Purpose
Validates that a service class has the expected internal attribute with specified type, schema, and other options. Internal attributes are used for intermediate values during service execution.
## Usage
“‘ruby RSpec.describe MyService, type: :service do
it { is_expected.to have_service_internal(:processed_data).type(Hash) }
it { is_expected.to have_service_internal(:items).type(Array).consists_of(Item) }
it { is_expected.to have_service_internal(:config).schema({ key: String }) }
end “‘
## Chain Methods
-
‘.type(Class)` / `.types(Class, …)` - expected type(s)
-
‘.consists_of(Class)` - for Array/Hash element types
-
‘.schema(Hash)` - expected schema definition
-
‘.inclusion(Array)` - expected inclusion values
-
‘.must(Array)` - custom validation rules
-
‘.target(value, name:)` - target validation
-
‘.message(String)` - expected error message (after other chain)
## Architecture
Inherits from Base::AttributeMatcher with ‘for_attribute_type :internal`. Uses shared submatchers for common validations.
Instance Attribute Summary
Attributes inherited from Base::AttributeMatcher
#attribute_name, #described_class, #option_types
Method Summary
Methods inherited from Base::AttributeMatcher
#description, #failure_message, #failure_message_when_negated, for_attribute_type, #initialize, #matches?, #supports_block_expectations?
Methods included from Base::SubmatcherRegistry
Constructor Details
This class inherits a constructor from Servactory::TestKit::Rspec::Matchers::Base::AttributeMatcher