Class: Committee::Test::ExceptParameter
- Inherits:
-
Object
- Object
- Committee::Test::ExceptParameter
- Defined in:
- lib/committee/test/except_parameter.rb
Overview
Handles temporary parameter exclusion during schema validation. Allows testing error responses without validation failures for intentionally missing parameters.
Defined Under Namespace
Modules: StringDummyLookup Classes: BaseHashParameterHandler, BodyHandler, HeaderHandler, QueryHandler
Constant Summary collapse
- FORMAT_DUMMIES =
{ 'date-time': '2000-01-01T00:00:00Z', date: '2000-01-01', email: '[email protected]', uuid: '00000000-0000-0000-0000-000000000000' }.freeze
Instance Method Summary collapse
-
#apply(except) ⇒ void
Apply dummy values to excepted parameters.
-
#initialize(request, committee_options) ⇒ ExceptParameter
constructor
A new instance of ExceptParameter.
-
#restore ⇒ void
Restore original parameter values.
Constructor Details
#initialize(request, committee_options) ⇒ ExceptParameter
Returns a new instance of ExceptParameter.
12 13 14 15 16 |
# File 'lib/committee/test/except_parameter.rb', line 12 def initialize(request, ) @request = request = @handlers = {} end |
Instance Method Details
#apply(except) ⇒ void
This method returns an undefined value.
Apply dummy values to excepted parameters
22 23 24 25 26 27 |
# File 'lib/committee/test/except_parameter.rb', line 22 def apply(except) except.each do |param_type, param_names| handler = (@handlers[param_type] ||= handler_for(param_type)) handler&.apply(param_names) end end |
#restore ⇒ void
This method returns an undefined value.
Restore original parameter values
31 32 33 |
# File 'lib/committee/test/except_parameter.rb', line 31 def restore @handlers.each_value(&:restore) end |