Module: Servactory::TestKit::Rspec::Matchers::Concerns::AttributeDataAccess

Included in:
Base::Submatcher
Defined in:
lib/servactory/test_kit/rspec/matchers/concerns/attribute_data_access.rb

Overview

Concern providing accessor methods for attribute data in submatchers.

## Purpose

AttributeDataAccess provides convenient methods for submatchers to access attribute definition data from the context. This includes the service class, attribute metadata, and helper methods for fetching specific options.

## Usage

Include in submatcher classes:

“‘ruby class MySubmatcher < Base::Submatcher

include Concerns::AttributeDataAccess

def passes?
  # Access attribute data directly
  fetch_option(:required) == true
end

end “‘

## Methods Provided

  • ‘described_class` - the service class being tested

  • ‘attribute_type` - :input, :internal, or :output

  • ‘attribute_name` - name of the attribute

  • ‘attribute_data` - full attribute definition hash

  • ‘fetch_option` - get specific option from attribute data

  • ‘option_present?` - check if option exists and has value

Defined Under Namespace

Modules: InstanceMethods

Class Method Summary collapse

Class Method Details

.included(base) ⇒ void

This method returns an undefined value.

Includes InstanceMethods in the including class.

Parameters:

  • base (Class)

    The class including this concern



44
45
46
# File 'lib/servactory/test_kit/rspec/matchers/concerns/attribute_data_access.rb', line 44

def self.included(base)
  base.include(InstanceMethods)
end