Class: Servactory::TestKit::Rspec::Matchers::Submatchers::Input::DefaultSubmatcher
- Inherits:
-
Base::Submatcher
- Object
- Base::Submatcher
- Servactory::TestKit::Rspec::Matchers::Submatchers::Input::DefaultSubmatcher
- Defined in:
- lib/servactory/test_kit/rspec/matchers/submatchers/input/default_submatcher.rb
Overview
Submatcher for validating input default values.
## Purpose
Validates that a service input has the expected default value. Useful for testing optional inputs with predefined fallback values.
## Usage
“‘ruby it { is_expected.to have_service_input(:limit).default(10) } it { is_expected.to have_service_input(:enabled).default(true) } it { is_expected.to have_service_input(:options).default({}) } “`
## Comparison
Uses case-insensitive string comparison for value matching. Handles nil values specially - matches only when expected is also nil.
Instance Attribute Summary
Attributes inherited from Base::Submatcher
Instance Method Summary collapse
-
#description ⇒ String
Returns description for RSpec output.
-
#initialize(context, expected_value) ⇒ DefaultSubmatcher
constructor
Creates a new default 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, expected_value) ⇒ DefaultSubmatcher
Creates a new default submatcher.
34 35 36 37 |
# File 'lib/servactory/test_kit/rspec/matchers/submatchers/input/default_submatcher.rb', line 34 def initialize(context, expected_value) super(context) @expected_value = expected_value end |
Instance Method Details
#description ⇒ String
Returns description for RSpec output.
42 43 44 |
# File 'lib/servactory/test_kit/rspec/matchers/submatchers/input/default_submatcher.rb', line 42 def description "default: #{expected_value.inspect}" end |