Class: Servactory::TestKit::Rspec::Matchers::Submatchers::Input::ValidWithSubmatcher
- Inherits:
-
Base::Submatcher
- Object
- Base::Submatcher
- Servactory::TestKit::Rspec::Matchers::Submatchers::Input::ValidWithSubmatcher
- Defined in:
- lib/servactory/test_kit/rspec/matchers/submatchers/input/valid_with_submatcher.rb
Overview
Submatcher for integration testing of input validation.
## Purpose
Performs integration testing of input attributes by calling the actual service and verifying validation behavior. Tests type checks, required/optional status, inclusion, and target validations.
## Usage
“‘ruby it { is_expected.to have_service_input(:status).valid_with(valid_attributes) } it { is_expected.to have_service_input(:count).valid_with(false) } “`
## Deprecation Notice
This submatcher is planned to be decommissioned. Consider using direct service call tests instead.
## Validation Steps
-
‘success_passes?` - service succeeds with valid attributes
-
‘failure_type_passes?` - fails correctly with wrong type
-
‘failure_required_passes?` - fails when required input is nil
-
‘failure_optional_passes?` - succeeds when optional input is nil
-
‘failure_inclusion_passes?` - fails with value outside inclusion
-
‘failure_target_passes?` - fails with value outside target
Instance Attribute Summary
Attributes inherited from Base::Submatcher
Instance Method Summary collapse
-
#description ⇒ String
Returns description for RSpec output.
-
#initialize(context, attributes) ⇒ ValidWithSubmatcher
constructor
Creates a new valid_with submatcher.
Methods inherited from Base::Submatcher
#failure_message, #failure_message_when_negated, #matches?
Methods included from Concerns::ValueComparison
Methods included from Concerns::ErrorMessageBuilder
Methods included from Concerns::AttributeDataAccess
Constructor Details
#initialize(context, attributes) ⇒ ValidWithSubmatcher
Creates a new valid_with submatcher.
43 44 45 46 |
# File 'lib/servactory/test_kit/rspec/matchers/submatchers/input/valid_with_submatcher.rb', line 43 def initialize(context, attributes) super(context) @attributes = attributes.is_a?(FalseClass) ? attributes : Servactory::Utils.adapt(attributes) end |
Instance Method Details
#description ⇒ String
Returns description for RSpec output.
51 52 53 |
# File 'lib/servactory/test_kit/rspec/matchers/submatchers/input/valid_with_submatcher.rb', line 51 def description "valid_with attribute checking" end |