Class: Servactory::TestKit::Rspec::Matchers::Submatchers::Input::OptionalSubmatcher

Inherits:
Base::Submatcher
  • Object
show all
Defined in:
lib/servactory/test_kit/rspec/matchers/submatchers/input/optional_submatcher.rb

Overview

Submatcher for validating that an input is optional.

## Purpose

Validates that a service input has ‘required: false` option set, meaning the input can be omitted when calling the service.

## Usage

“‘ruby it { is_expected.to have_service_input(:nickname).optional } it { is_expected.to have_service_input(:description).optional } “`

## Note

Mutually exclusive with ‘required` submatcher - only one can be used per matcher chain.

Instance Attribute Summary

Attributes inherited from Base::Submatcher

#missing_option

Instance Method Summary collapse

Methods inherited from Base::Submatcher

#failure_message, #failure_message_when_negated, #initialize, #matches?

Methods included from Concerns::ValueComparison

included

Methods included from Concerns::ErrorMessageBuilder

included

Methods included from Concerns::AttributeDataAccess

included

Constructor Details

This class inherits a constructor from Servactory::TestKit::Rspec::Matchers::Base::Submatcher

Instance Method Details

#descriptionString

Returns description for RSpec output.

Returns:

  • (String)

    Human-readable description



31
32
33
# File 'lib/servactory/test_kit/rspec/matchers/submatchers/input/optional_submatcher.rb', line 31

def description
  "required: false"
end