foobara 0.5.10 → 0.6.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.ruby-version +1 -1
- data/CHANGELOG.md +22 -0
- data/lib/foobara/all.rb +4 -2
- data/projects/command/src/command_pattern_implementation/concerns/command_data.rb +3 -3
- data/projects/command/src/command_pattern_implementation/concerns/domain_mappers.rb +2 -2
- data/projects/command/src/command_pattern_implementation/concerns/errors.rb +27 -27
- data/projects/command/src/command_pattern_implementation/concerns/errors_type.rb +7 -11
- data/projects/command/src/command_pattern_implementation/concerns/inputs.rb +4 -24
- data/projects/command/src/command_pattern_implementation/concerns/inputs_type.rb +9 -14
- data/projects/command/src/command_pattern_implementation/concerns/reflection.rb +7 -20
- data/projects/command/src/command_pattern_implementation/concerns/runtime.rb +3 -48
- data/projects/command/src/command_pattern_implementation/concerns/subcommands.rb +5 -5
- data/projects/command/src/command_pattern_implementation.rb +0 -1
- data/projects/command_connectors/lib/foobara/command_connectors.rb +1 -1
- data/projects/command_connectors/src/command_connector/concerns/desugarizers.rb +5 -5
- data/projects/command_connectors/src/command_connector/concerns/reflection.rb +63 -17
- data/projects/command_connectors/src/command_connector/request.rb +26 -10
- data/projects/command_connectors/src/command_connector/response.rb +2 -0
- data/projects/command_connectors/src/command_connector.rb +62 -58
- data/projects/command_connectors/src/command_registry/exposed_command.rb +7 -2
- data/projects/command_connectors/src/command_registry.rb +24 -18
- data/projects/command_connectors/src/desugarizer.rb +2 -2
- data/projects/command_connectors/src/desugarizers/attributes.rb +8 -8
- data/projects/command_connectors/src/desugarizers/auth.rb +1 -1
- data/projects/command_connectors/src/desugarizers/set_inputs.rb +3 -3
- data/projects/command_connectors/src/desugarizers/symbols_to_true.rb +2 -2
- data/projects/command_connectors/src/request_mutator.rb +6 -6
- data/projects/command_connectors/src/response_mutator.rb +6 -6
- data/projects/command_connectors/src/transformed_command.rb +39 -36
- data/projects/command_connectors/src/transformers/auth_errors_transformer.rb +2 -2
- data/projects/command_connectors/src/transformers/entity_to_primary_key_inputs_transformer.rb +2 -2
- data/projects/command_connectors/src/transformers/load_delegated_attributes_entities_pre_commit_transformer.rb +1 -1
- data/projects/domain_mapper/src/domain_mapper.rb +4 -4
- data/projects/domain_mapper/src/domain_mapper_lookups.rb +3 -3
- data/projects/entities/projects/detached_entity/lib/foobara/detached_entity.rb +1 -1
- data/projects/entities/projects/detached_entity/src/concerns/associations.rb +18 -18
- data/projects/entities/projects/detached_entity/src/concerns/initialization.rb +2 -2
- data/projects/entities/projects/detached_entity/src/concerns/primary_key.rb +4 -4
- data/projects/entities/projects/detached_entity/src/concerns/types.rb +2 -2
- data/projects/entities/projects/detached_entity/src/detached_entity_type.rb +4 -4
- data/projects/entities/projects/detached_entity/src/extensions/builtin_types/detached_entity/casters/primary_key.rb +1 -1
- data/projects/entities/projects/detached_entity/src/extensions/builtin_types/detached_entity/validators/model_instance_is_valid.rb +2 -2
- data/projects/entities/projects/detached_entity/src/extensions/type_declarations/handlers/registered_type_declaration/validate_primary_key_present.rb +30 -0
- data/projects/entities/projects/detached_entity/src/remove_sensitive_values_transformer_extensions.rb +2 -2
- data/projects/entities/projects/entity/lib/foobara/entity.rb +1 -1
- data/projects/entities/projects/entity/src/concerns/attributes.rb +6 -6
- data/projects/entities/projects/entity/src/concerns/callbacks.rb +1 -1
- data/projects/entities/projects/entity/src/concerns/initialization.rb +8 -8
- data/projects/entities/projects/entity/src/concerns/mutations.rb +4 -4
- data/projects/entities/projects/entity/src/concerns/persistence.rb +3 -3
- data/projects/entities/projects/entity/src/concerns/queries.rb +7 -7
- data/projects/entities/projects/entity/src/extensions/domain/domain_module_extension.rb +4 -4
- data/projects/entities/projects/entity/src/new_prepend.rb +2 -2
- data/projects/entities/projects/entity/src/not_found_error.rb +8 -8
- data/projects/entities/projects/entity/src/sensitive_value_removers/entity.rb +8 -5
- data/projects/entities/projects/in_memory_crud_driver_minimal/src/in_memory_minimal.rb +4 -4
- data/projects/entities/projects/model_attribute_helpers/lib/foobara/model_attribute_helpers.rb +0 -2
- data/projects/entities/projects/model_attribute_helpers/src/attribute_helper_aliases.rb +1 -1
- data/projects/entities/projects/model_attribute_helpers/src/attribute_helpers.rb +2 -2
- data/projects/entities/projects/nested_transactionable/lib/foobara/nested_transactionable.rb +5 -5
- data/projects/entities/projects/persistence/lib/foobara/persistence.rb +1 -1
- data/projects/entities/projects/persistence/src/entity_attributes_crud_driver.rb +35 -37
- data/projects/entities/projects/persistence/src/entity_base/transaction/concerns/entity_callback_handling.rb +25 -25
- data/projects/entities/projects/persistence/src/entity_base/transaction/concerns/state_transitions.rb +8 -8
- data/projects/entities/projects/persistence/src/entity_base/transaction/concerns/transaction_tracking.rb +1 -1
- data/projects/entities/projects/persistence/src/entity_base/transaction.rb +9 -9
- data/projects/entities/projects/persistence/src/entity_base/transaction_table/concerns/record_tracking.rb +4 -4
- data/projects/entities/projects/persistence/src/entity_base/transaction_table.rb +52 -52
- data/projects/entities/projects/persistence/src/entity_base.rb +7 -7
- data/projects/entities/projects/persistence/src/persistence.rb +23 -23
- data/projects/entities/projects/weak_object_set/src/weak_object_set.rb +16 -16
- data/projects/entities_plumbing/lib/foobara/entities_plumbing.rb +6 -2
- data/projects/entities_plumbing/src/extensions/command_pattern_implementation/concerns/entities.rb +21 -5
- data/projects/entities_plumbing/src/extensions/command_pattern_implementation/concerns/entity_errors_type.rb +23 -0
- data/projects/entities_plumbing/src/extensions/command_pattern_implementation/concerns/entity_inputs.rb +33 -0
- data/projects/entities_plumbing/src/extensions/command_pattern_implementation/concerns/entity_reflection.rb +39 -0
- data/projects/entities_plumbing/src/extensions/command_pattern_implementation/concerns/runtime.rb +39 -0
- data/projects/manifest/src/base_manifest.rb +9 -9
- data/projects/manifest/src/model.rb +4 -4
- data/projects/manifest/src/type.rb +3 -3
- data/projects/manifest/src/type_declaration.rb +4 -4
- data/projects/model_plumbing/lib/foobara/model_plumbing.rb +2 -0
- data/projects/model_plumbing/src/extensions/command_pattern_implementation/concerns/model_inputs_type.rb +35 -0
- data/projects/typesystem/projects/builtin_types/lib/foobara/builtin_types.rb +2 -1
- data/projects/typesystem/projects/builtin_types/src/builtin_types.rb +8 -8
- data/projects/typesystem/projects/builtin_types/src/duck/supported_validators/one_of/type_declaration_extension/extend_registered_type_declaration/desugarizers/module_desugarizer.rb +2 -2
- data/projects/typesystem/projects/builtin_types/src/email/validator_base.rb +4 -4
- data/projects/typesystem/projects/callback/src/block/concerns/block_parameter_required.rb +2 -2
- data/projects/typesystem/projects/callback/src/block/concerns/keyword_argumentable_block.rb +2 -2
- data/projects/typesystem/projects/callback/src/block/concerns/single_argument_block.rb +2 -2
- data/projects/typesystem/projects/callback/src/block.rb +4 -4
- data/projects/typesystem/projects/callback/src/registry/base.rb +10 -10
- data/projects/typesystem/projects/callback/src/registry/conditioned.rb +2 -2
- data/projects/typesystem/projects/callback/src/registry/multiple_action.rb +6 -6
- data/projects/typesystem/projects/callback/src/runner.rb +4 -4
- data/projects/typesystem/projects/callback/src/set.rb +4 -4
- data/projects/typesystem/projects/common/src/data_path.rb +14 -14
- data/projects/typesystem/projects/common/src/error.rb +11 -11
- data/projects/typesystem/projects/common/src/error_collection.rb +14 -14
- data/projects/typesystem/projects/common/src/error_key.rb +5 -3
- data/projects/typesystem/projects/common/src/outcome.rb +5 -5
- data/projects/typesystem/projects/common/src/possible_error.rb +2 -2
- data/projects/typesystem/projects/concerns/src/concern.rb +3 -3
- data/projects/typesystem/projects/delegate/src/extensions/module.rb +4 -4
- data/projects/typesystem/projects/domain/lib/foobara/domain.rb +2 -2
- data/projects/typesystem/projects/domain/src/domain.rb +5 -5
- data/projects/typesystem/projects/domain/src/domain_module_extension.rb +22 -22
- data/projects/typesystem/projects/domain/src/extensions/foobara.rb +14 -6
- data/projects/typesystem/projects/domain/src/module_extension.rb +4 -4
- data/projects/typesystem/projects/domain/src/organization.rb +6 -6
- data/projects/typesystem/projects/enumerated/src/accessors.rb +4 -4
- data/projects/typesystem/projects/enumerated/src/values.rb +14 -14
- data/projects/{entities → typesystem}/projects/model/lib/foobara/model.rb +1 -1
- data/projects/{entities → typesystem}/projects/model/src/concerns/classes.rb +4 -4
- data/projects/{entities → typesystem}/projects/model/src/concerns/types.rb +5 -5
- data/projects/{entities → typesystem}/projects/model/src/extensions/builtin_types/model/casters/hash.rb +1 -1
- data/projects/{entities → typesystem}/projects/model/src/extensions/type_declarations/handlers/extend_model_type_declaration/attributes_handler_desugarizer.rb +2 -2
- data/projects/{entities → typesystem}/projects/model/src/extensions/type_declarations/handlers/extend_model_type_declaration/model_class_desugarizer.rb +6 -6
- data/projects/{entities → typesystem}/projects/model/src/extensions/type_declarations/handlers/extend_model_type_declaration/to_type_transformer.rb +4 -4
- data/projects/{entities → typesystem}/projects/model/src/extensions/type_declarations/handlers/extend_registered_model_type_declaration.rb +2 -2
- data/projects/{entities → typesystem}/projects/model/src/extensions/type_declarations/handlers/registered_type_declaration/model_class_desugarizer.rb +6 -10
- data/projects/{entities → typesystem}/projects/model/src/model.rb +13 -13
- data/projects/{entities → typesystem}/projects/model/src/sensitive_value_removers/model.rb +1 -1
- data/projects/typesystem/projects/namespace/src/ambiguous_registry.rb +5 -5
- data/projects/typesystem/projects/namespace/src/base_registry.rb +8 -8
- data/projects/typesystem/projects/namespace/src/is_namespace.rb +19 -19
- data/projects/typesystem/projects/namespace/src/namespace/lookup_mode.rb +2 -2
- data/projects/typesystem/projects/namespace/src/namespace.rb +5 -5
- data/projects/typesystem/projects/namespace/src/namespace_helpers.rb +4 -4
- data/projects/typesystem/projects/namespace/src/prefixless_registry.rb +3 -3
- data/projects/typesystem/projects/namespace/src/scoped.rb +7 -7
- data/projects/typesystem/projects/project/src/foobara.rb +13 -7
- data/projects/typesystem/projects/project/src/project.rb +1 -1
- data/projects/typesystem/projects/state_machine/src/callbacks.rb +14 -14
- data/projects/typesystem/projects/state_machine/src/state_machine.rb +2 -2
- data/projects/typesystem/projects/state_machine/src/sugar.rb +3 -3
- data/projects/typesystem/projects/type_declarations/lib/foobara/type_declarations.rb +1 -1
- data/projects/typesystem/projects/type_declarations/src/attributes.rb +2 -2
- data/projects/typesystem/projects/type_declarations/src/attributes_transformers/from_yaml.rb +2 -2
- data/projects/typesystem/projects/type_declarations/src/attributes_transformers/only.rb +2 -2
- data/projects/typesystem/projects/type_declarations/src/attributes_transformers/reject.rb +2 -2
- data/projects/typesystem/projects/type_declarations/src/attributes_transformers/set.rb +4 -4
- data/projects/typesystem/projects/type_declarations/src/desugarizer.rb +2 -2
- data/projects/typesystem/projects/type_declarations/src/dsl/attributes.rb +9 -9
- data/projects/typesystem/projects/type_declarations/src/error_extension.rb +6 -6
- data/projects/typesystem/projects/type_declarations/src/handlers/extend_array_type_declaration/array_desugarizer.rb +3 -3
- data/projects/typesystem/projects/type_declarations/src/handlers/extend_array_type_declaration/element_type_declaration_desugarizer.rb +2 -2
- data/projects/typesystem/projects/type_declarations/src/handlers/extend_array_type_declaration/type_set_to_array_desugarizer.rb +2 -2
- data/projects/typesystem/projects/type_declarations/src/handlers/extend_attributes_type_declaration/element_type_declarations_desugarizer.rb +2 -2
- data/projects/typesystem/projects/type_declarations/src/handlers/extend_registered_type_declaration/to_type_transformer.rb +2 -2
- data/projects/typesystem/projects/type_declarations/src/handlers/extend_registered_type_declaration.rb +2 -2
- data/projects/typesystem/projects/type_declarations/src/handlers/extend_tuple_type_declaration/array_desugarizer.rb +2 -2
- data/projects/typesystem/projects/type_declarations/src/handlers/registered_type_declaration.rb +4 -3
- data/projects/typesystem/projects/type_declarations/src/remove_sensitive_values_transformer.rb +3 -3
- data/projects/typesystem/projects/type_declarations/src/type_builder.rb +5 -5
- data/projects/typesystem/projects/type_declarations/src/type_declaration.rb +7 -1
- data/projects/typesystem/projects/type_declarations/src/type_declaration_handler.rb +13 -13
- data/projects/typesystem/projects/type_declarations/src/type_declaration_handler_registry.rb +2 -2
- data/projects/typesystem/projects/type_declarations/src/type_declaration_validator.rb +2 -2
- data/projects/typesystem/projects/type_declarations/src/type_declarations.rb +2 -2
- data/projects/typesystem/projects/type_declarations/src/with_registries.rb +2 -2
- data/projects/typesystem/projects/types/lib/foobara/types.rb +0 -2
- data/projects/typesystem/projects/types/src/extensions/error.rb +5 -5
- data/projects/typesystem/projects/types/src/type/concerns/reflection.rb +22 -22
- data/projects/typesystem/projects/types/src/type/concerns/supported_processor_registration.rb +4 -4
- data/projects/typesystem/projects/types/src/type.rb +25 -25
- data/projects/typesystem/projects/value/src/caster.rb +11 -11
- data/projects/typesystem/projects/value/src/data_error.rb +1 -1
- data/projects/typesystem/projects/value/src/mutator.rb +3 -3
- data/projects/typesystem/projects/value/src/processor/casting.rb +6 -6
- data/projects/typesystem/projects/value/src/processor/pipeline.rb +2 -2
- data/projects/typesystem/projects/value/src/processor/runner.rb +1 -1
- data/projects/typesystem/projects/value/src/processor/selection.rb +3 -3
- data/projects/typesystem/projects/value/src/processor.rb +23 -23
- data/projects/typesystem/projects/value/src/transformer.rb +5 -5
- data/projects/typesystem/projects/value/src/validator.rb +3 -3
- data/version.rb +2 -2
- metadata +44 -160
- data/projects/command_connectors/Guardfile +0 -6
- data/projects/command_connectors/spec/allowed_rules_spec.rb +0 -77
- data/projects/command_connectors/spec/ambiguous_lookups_spec.rb +0 -143
- data/projects/command_connectors/spec/auth_mappers_spec.rb +0 -201
- data/projects/command_connectors/spec/command_connector_spec.rb +0 -2460
- data/projects/command_connectors/spec/command_registry_spec.rb +0 -9
- data/projects/command_connectors/spec/commands/describe_spec.rb +0 -83
- data/projects/command_connectors/spec/commands/ping_spec.rb +0 -14
- data/projects/command_connectors/spec/commands/query_git_commit_info_spec.rb +0 -55
- data/projects/command_connectors/spec/fixtures/command_connectors/manifest_with_errors_with_missing_command_parents.yaml +0 -1662
- data/projects/command_connectors/spec/not_found_error_spec.rb +0 -17
- data/projects/command_connectors/spec/pre_commit_transformers/load_atoms_pre_commit_transformer_spec.rb +0 -108
- data/projects/command_connectors/spec/request_spec.rb +0 -118
- data/projects/command_connectors/spec/serializer_spec.rb +0 -9
- data/projects/command_connectors/spec/serializers/aggregate_serializer_spec.rb +0 -45
- data/projects/command_connectors/spec/serializers/atomic_serializer_spec.rb +0 -68
- data/projects/command_connectors/spec/serializers/entities_to_primary_keys_serializer_spec.rb +0 -36
- data/projects/command_connectors/spec/serializers/json_serializer_spec.rb +0 -22
- data/projects/command_connectors/spec/serializers/noop_serializer_spec.rb +0 -22
- data/projects/command_connectors/spec/serializers/yaml_serializer_spec.rb +0 -22
- data/projects/command_connectors/spec/spec_helper.rb +0 -56
- data/projects/command_connectors/spec/support/rubyprof.rb +0 -32
- data/projects/command_connectors/spec/support/term_trap.rb +0 -6
- data/projects/command_connectors/spec/transformers/entity_to_primary_key_inputs_transformer_spec.rb +0 -119
- data/projects/entities/Guardfile +0 -6
- data/projects/entities/spec/builtin_types/detached_entity_spec.rb +0 -300
- data/projects/entities/spec/builtin_types/entity_spec.rb +0 -501
- data/projects/entities/spec/builtin_types/model_spec.rb +0 -420
- data/projects/entities/spec/detached_entity/casting_spec.rb +0 -31
- data/projects/entities/spec/entity/concerns/associations_spec.rb +0 -73
- data/projects/entities/spec/entity/concerns/attribute_helpers_spec.rb +0 -220
- data/projects/entities/spec/entity/concerns/callbacks_spec.rb +0 -61
- data/projects/entities/spec/entity/concerns/initialization_spec.rb +0 -213
- data/projects/entities/spec/entity/concerns/mutations_spec.rb +0 -38
- data/projects/entities/spec/entity/concerns/queries_spec.rb +0 -184
- data/projects/entities/spec/entity/entity_spec.rb +0 -240
- data/projects/entities/spec/entity/extending_existing_spec.rb +0 -137
- data/projects/entities/spec/entity/extensions/domain_module_extension_spec.rb +0 -42
- data/projects/entities/spec/entity/from_type_declaration_spec.rb +0 -34
- data/projects/entities/spec/entity/that_owns_spec.rb +0 -243
- data/projects/entities/spec/entity/weak_object_set_spec.rb +0 -91
- data/projects/entities/spec/model/model_spec.rb +0 -135
- data/projects/entities/spec/model/types_spec.rb +0 -397
- data/projects/entities/spec/nested_transactionable/nested_transactionable_spec.rb +0 -67
- data/projects/entities/spec/persistence/entity_attributes_crud_drivers/in_memory_minimal_spec.rb +0 -13
- data/projects/entities/spec/persistence/entity_base/transaction_spec.rb +0 -509
- data/projects/entities/spec/persistence/entity_base/transaction_table_spec.rb +0 -58
- data/projects/entities/spec/persistence/persistence_spec.rb +0 -148
- data/projects/entities/spec/spec_helper.rb +0 -54
- data/projects/entities/spec/support/rubyprof.rb +0 -32
- data/projects/entities/spec/support/term_trap.rb +0 -6
- data/projects/entities/spec/type_declarations/sensitive_type_removers_spec.rb +0 -90
- data/projects/entities_plumbing/Guardfile +0 -6
- data/projects/entities_plumbing/spec/auth_mappers_spec.rb +0 -159
- data/projects/entities_plumbing/spec/spec_helper.rb +0 -55
- data/projects/entities_plumbing/spec/support/rubyprof.rb +0 -32
- data/projects/entities_plumbing/spec/support/term_trap.rb +0 -6
- data/projects/entities_plumbing/spec/transaction_spec.rb +0 -534
- data/projects/manifest/Guardfile +0 -6
- data/projects/manifest/spec/associations_spec.rb +0 -67
- data/projects/manifest/spec/manifest_spec.rb +0 -382
- data/projects/manifest/spec/model_spec.rb +0 -126
- data/projects/manifest/spec/spec_helper.rb +0 -54
- data/projects/manifest/spec/type_declaration_spec.rb +0 -39
- data/projects/manifest/spec/type_spec.rb +0 -30
- data/projects/typesystem/spec/builtin_types/allow_nil_spec.rb +0 -138
- data/projects/typesystem/spec/builtin_types/array_spec.rb +0 -140
- data/projects/typesystem/spec/builtin_types/associative_array_spec.rb +0 -228
- data/projects/typesystem/spec/builtin_types/attributes_spec.rb +0 -490
- data/projects/typesystem/spec/builtin_types/big_decimal_spec.rb +0 -42
- data/projects/typesystem/spec/builtin_types/boolean_spec.rb +0 -43
- data/projects/typesystem/spec/builtin_types/class_type_desugarizer_spec.rb +0 -17
- data/projects/typesystem/spec/builtin_types/custom_type_spec.rb +0 -430
- data/projects/typesystem/spec/builtin_types/date_spec.rb +0 -37
- data/projects/typesystem/spec/builtin_types/datetime_spec.rb +0 -49
- data/projects/typesystem/spec/builtin_types/email_spec.rb +0 -44
- data/projects/typesystem/spec/builtin_types/float_spec.rb +0 -59
- data/projects/typesystem/spec/builtin_types/instance_of_spec.rb +0 -75
- data/projects/typesystem/spec/builtin_types/one_of_spec.rb +0 -73
- data/projects/typesystem/spec/builtin_types/string_spec.rb +0 -117
- data/projects/typesystem/spec/builtin_types/symbol_spec.rb +0 -24
- data/projects/typesystem/spec/builtin_types/tuple_spec.rb +0 -125
- data/projects/typesystem/spec/callback/callback_spec.rb +0 -155
- data/projects/typesystem/spec/callback/registry/conditioned_spec.rb +0 -152
- data/projects/typesystem/spec/callback/registry/multiple_action_spec.rb +0 -144
- data/projects/typesystem/spec/callback/registry/single_action_spec.rb +0 -114
- data/projects/typesystem/spec/common/data_path_spec.rb +0 -268
- data/projects/typesystem/spec/common/error_collection_spec.rb +0 -77
- data/projects/typesystem/spec/common/error_key_spec.rb +0 -56
- data/projects/typesystem/spec/common/outcome_spec.rb +0 -65
- data/projects/typesystem/spec/common/possible_error_spec.rb +0 -17
- data/projects/typesystem/spec/concerns/concern_spec.rb +0 -122
- data/projects/typesystem/spec/enumerated/accessors_spec.rb +0 -182
- data/projects/typesystem/spec/enumerated/enumerated_spec.rb +0 -32
- data/projects/typesystem/spec/enumerated/values_spec.rb +0 -67
- data/projects/typesystem/spec/foobara/foobara_spec.rb +0 -45
- data/projects/typesystem/spec/namespace/ambiguous_registry_spec.rb +0 -70
- data/projects/typesystem/spec/namespace/foobara_simulation_spec.rb +0 -254
- data/projects/typesystem/spec/namespace/is_namespace_spec.rb +0 -103
- data/projects/typesystem/spec/namespace/namespace_helpers_spec.rb +0 -67
- data/projects/typesystem/spec/namespace/namespace_spec.rb +0 -335
- data/projects/typesystem/spec/namespace/prefixless_registry_spec.rb +0 -30
- data/projects/typesystem/spec/namespace/unambiguous_registry_spec.rb +0 -50
- data/projects/typesystem/spec/spec_helper.rb +0 -52
- data/projects/typesystem/spec/state_machine/callbacks_spec.rb +0 -144
- data/projects/typesystem/spec/state_machine/state_machine_spec.rb +0 -224
- data/projects/typesystem/spec/state_machine/target_attribute_spec.rb +0 -46
- data/projects/typesystem/spec/support/rubyprof.rb +0 -32
- data/projects/typesystem/spec/support/term_trap.rb +0 -6
- data/projects/typesystem/spec/type_declarations/attributes_spec.rb +0 -14
- data/projects/typesystem/spec/type_declarations/attributes_transformer_spec.rb +0 -95
- data/projects/typesystem/spec/type_declarations/dsl/attributes_spec.rb +0 -107
- data/projects/typesystem/spec/type_declarations/handlers/extend_registered_type_declaration_spec.rb +0 -13
- data/projects/typesystem/spec/type_declarations/sensitive_type_removers_spec.rb +0 -210
- data/projects/typesystem/spec/type_declarations/type_builder_spec.rb +0 -47
- data/projects/typesystem/spec/type_declarations/type_declaration_spec.rb +0 -252
- data/projects/typesystem/spec/type_declarations/type_declarations_spec.rb +0 -11
- data/projects/typesystem/spec/type_declarations/typed_transformer_spec.rb +0 -65
- data/projects/typesystem/spec/types/sensitive_spec.rb +0 -36
- data/projects/typesystem/spec/types/type_spec.rb +0 -102
- data/projects/typesystem/spec/value/caster_spec.rb +0 -23
- data/projects/typesystem/spec/value/processor/runner_spec.rb +0 -34
- data/projects/typesystem/spec/value/processor/selection_spec.rb +0 -71
- data/projects/typesystem/spec/value/processor_spec.rb +0 -76
- data/projects/typesystem/spec/value/transformer_spec.rb +0 -27
- /data/projects/{command/src → entities_plumbing/src/extensions}/command_pattern_implementation/concerns/transactions.rb +0 -0
- /data/projects/{entities → typesystem}/projects/model/src/concerns/aliases.rb +0 -0
- /data/projects/{entities → typesystem}/projects/model/src/concerns/reflection.rb +0 -0
- /data/projects/{entities → typesystem}/projects/model/src/extensions/builtin_types/model/supported_transformers/mutable.rb +0 -0
- /data/projects/{entities → typesystem}/projects/model/src/extensions/builtin_types/model/validators/model_instance_is_valid.rb +0 -0
- /data/projects/{entities → typesystem}/projects/model/src/extensions/type_declarations/handlers/extend_model_type_declaration/array_with_symbolic_elements.rb +0 -0
- /data/projects/{entities → typesystem}/projects/model/src/extensions/type_declarations/handlers/extend_model_type_declaration/delegates_desugarizer.rb +0 -0
- /data/projects/{entities → typesystem}/projects/model/src/extensions/type_declarations/handlers/extend_model_type_declaration/delegates_validator.rb +0 -0
- /data/projects/{entities → typesystem}/projects/model/src/extensions/type_declarations/handlers/extend_model_type_declaration/hash_desugarizer.rb +0 -0
- /data/projects/{entities → typesystem}/projects/model/src/extensions/type_declarations/handlers/extend_model_type_declaration/move_private_from_element_types_to_root.rb +0 -0
- /data/projects/{entities → typesystem}/projects/model/src/extensions/type_declarations/handlers/extend_model_type_declaration/symbolize_private.rb +0 -0
- /data/projects/{entities → typesystem}/projects/model/src/extensions/type_declarations/handlers/extend_model_type_declaration/valid_attribute_names.rb +0 -0
- /data/projects/{entities → typesystem}/projects/model/src/extensions/type_declarations/handlers/extend_model_type_declaration.rb +0 -0
- /data/projects/{entities → typesystem}/projects/model/src/extensions/type_declarations/handlers/extend_registered_model_type_declaration/hash_desugarizer.rb +0 -0
- /data/projects/{entities → typesystem}/projects/model/src/extensions/type_declarations/handlers/extend_registered_model_type_declaration/model_class_type_desugarizer.rb +0 -0
- /data/projects/{entities → typesystem}/projects/model/src/extensions/type_declarations/handlers/extend_registered_model_type_declaration/mutable_validator.rb +0 -0
- /data/projects/{entities → typesystem}/projects/model/src/extensions/type_declarations/handlers/extend_registered_model_type_declaration/normalize_mutable_attributes_desugarizer.rb +0 -0
- /data/projects/{entities → typesystem}/projects/model/src/extensions/type_declarations/handlers/extend_registered_model_type_declaration/to_type_transformer.rb +0 -0
- /data/projects/{entities → typesystem}/projects/model/src/extensions/type_declarations/lazy_element_types/model.rb +0 -0
- /data/projects/{entities → typesystem}/projects/model/src/sensitive_type_removers/extended_model.rb +0 -0
- /data/projects/{entities → typesystem}/projects/model/src/sensitive_type_removers/model.rb +0 -0
|
@@ -1,210 +0,0 @@
|
|
|
1
|
-
RSpec.describe Foobara::TypeDeclarations do
|
|
2
|
-
after { Foobara.reset_alls }
|
|
3
|
-
|
|
4
|
-
describe ".remove_sensitive_types" do
|
|
5
|
-
let(:strict_type_declaration) do
|
|
6
|
-
type.declaration_data
|
|
7
|
-
end
|
|
8
|
-
|
|
9
|
-
let(:type_declaration_without_sensitive_types) do
|
|
10
|
-
described_class.remove_sensitive_types(strict_type_declaration)
|
|
11
|
-
end
|
|
12
|
-
|
|
13
|
-
context "when attributes" do
|
|
14
|
-
let(:type) do
|
|
15
|
-
Foobara::Domain.current.foobara_type_from_declaration do
|
|
16
|
-
foo :string, :required, default: "foo"
|
|
17
|
-
bar :string, :required, default: "bar"
|
|
18
|
-
bar2 :string, :sensitive, :required, default: "bar2"
|
|
19
|
-
baz :string
|
|
20
|
-
end
|
|
21
|
-
end
|
|
22
|
-
|
|
23
|
-
it "strips out the sensitive attributes" do
|
|
24
|
-
expect(type_declaration_without_sensitive_types).to eq(
|
|
25
|
-
type: :attributes,
|
|
26
|
-
element_type_declarations: {
|
|
27
|
-
baz: :string,
|
|
28
|
-
bar: :string,
|
|
29
|
-
foo: :string
|
|
30
|
-
},
|
|
31
|
-
required: [:bar, :foo],
|
|
32
|
-
defaults: { foo: "foo", bar: "bar" }
|
|
33
|
-
)
|
|
34
|
-
end
|
|
35
|
-
|
|
36
|
-
context "when nested sensitive stuff" do
|
|
37
|
-
let(:type) do
|
|
38
|
-
Foobara::Domain.current.foobara_type_from_declaration do
|
|
39
|
-
foo :string, :required, default: "foo"
|
|
40
|
-
bar :string, :sensitive, :required, default: "bar"
|
|
41
|
-
baz :string
|
|
42
|
-
nested do
|
|
43
|
-
foo :string, :required, default: "foo"
|
|
44
|
-
bar :string, :sensitive, :required, default: "bar"
|
|
45
|
-
baz :string
|
|
46
|
-
end
|
|
47
|
-
baz2 :array do
|
|
48
|
-
baz3 :string, :sensitive
|
|
49
|
-
foo :string
|
|
50
|
-
end
|
|
51
|
-
end
|
|
52
|
-
end
|
|
53
|
-
|
|
54
|
-
it "strips out the sensitive attributes all the way down" do
|
|
55
|
-
expect(type_declaration_without_sensitive_types).to eq(
|
|
56
|
-
type: :attributes,
|
|
57
|
-
element_type_declarations: {
|
|
58
|
-
baz: :string,
|
|
59
|
-
foo: :string,
|
|
60
|
-
nested: {
|
|
61
|
-
type: :attributes,
|
|
62
|
-
element_type_declarations: {
|
|
63
|
-
baz: :string,
|
|
64
|
-
foo: :string
|
|
65
|
-
},
|
|
66
|
-
required: [:foo],
|
|
67
|
-
defaults: { foo: "foo" }
|
|
68
|
-
},
|
|
69
|
-
baz2: {
|
|
70
|
-
type: :array,
|
|
71
|
-
element_type_declaration: {
|
|
72
|
-
type: :attributes,
|
|
73
|
-
element_type_declarations: { foo: :string }
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
},
|
|
77
|
-
required: [:foo],
|
|
78
|
-
defaults: { foo: "foo" }
|
|
79
|
-
)
|
|
80
|
-
end
|
|
81
|
-
end
|
|
82
|
-
|
|
83
|
-
context "when no sensitive attributes" do
|
|
84
|
-
let(:type) do
|
|
85
|
-
Foobara::Domain.current.foobara_type_from_declaration do
|
|
86
|
-
foo :string, :required, default: "foo"
|
|
87
|
-
bar :string, :required, default: "bar"
|
|
88
|
-
baz :string
|
|
89
|
-
end
|
|
90
|
-
end
|
|
91
|
-
|
|
92
|
-
it "gives the type declaration unchanged" do
|
|
93
|
-
expect(type_declaration_without_sensitive_types).to eq(
|
|
94
|
-
type: :attributes,
|
|
95
|
-
element_type_declarations: {
|
|
96
|
-
baz: :string,
|
|
97
|
-
bar: :string,
|
|
98
|
-
foo: :string
|
|
99
|
-
},
|
|
100
|
-
required: [:bar, :foo],
|
|
101
|
-
defaults: { foo: "foo", bar: "bar" }
|
|
102
|
-
)
|
|
103
|
-
end
|
|
104
|
-
end
|
|
105
|
-
|
|
106
|
-
context "when there's no direct sensitive attributes but an attribute contains a sensitive attribute" do
|
|
107
|
-
let(:type) do
|
|
108
|
-
Foobara::Domain.current.foobara_type_from_declaration do
|
|
109
|
-
foo do
|
|
110
|
-
foo :string
|
|
111
|
-
baz :string, :sensitive
|
|
112
|
-
end
|
|
113
|
-
end
|
|
114
|
-
end
|
|
115
|
-
|
|
116
|
-
it "strips out the nested sensitive attribute" do
|
|
117
|
-
expect(type_declaration_without_sensitive_types[:element_type_declarations]).to eq(
|
|
118
|
-
foo: {
|
|
119
|
-
type: :attributes,
|
|
120
|
-
element_type_declarations: {
|
|
121
|
-
foo: :string
|
|
122
|
-
}
|
|
123
|
-
}
|
|
124
|
-
)
|
|
125
|
-
end
|
|
126
|
-
end
|
|
127
|
-
end
|
|
128
|
-
|
|
129
|
-
context "when array" do
|
|
130
|
-
let(:type) do
|
|
131
|
-
Foobara::Domain.current.foobara_type_from_declaration(
|
|
132
|
-
[
|
|
133
|
-
{ type: :attributes,
|
|
134
|
-
element_type_declarations:
|
|
135
|
-
{ foo: { type: :string },
|
|
136
|
-
bar: { type: :string },
|
|
137
|
-
bar2: { sensitive: true, type: :string },
|
|
138
|
-
baz: { type: :string },
|
|
139
|
-
nested:
|
|
140
|
-
{ type: :attributes,
|
|
141
|
-
element_type_declarations: {
|
|
142
|
-
foo: { type: :string },
|
|
143
|
-
bar: { type: :string },
|
|
144
|
-
bar2: {
|
|
145
|
-
sensitive: true, type: :string
|
|
146
|
-
}, baz: { type: :string }
|
|
147
|
-
},
|
|
148
|
-
required: [:foo, :bar],
|
|
149
|
-
defaults: { foo: "foo", bar: "bar" } },
|
|
150
|
-
baz2: {
|
|
151
|
-
type: :array,
|
|
152
|
-
element_type_declaration: {
|
|
153
|
-
type: :attributes,
|
|
154
|
-
element_type_declarations: {
|
|
155
|
-
baz3: { sensitive: true, type: :string },
|
|
156
|
-
foo: { type: :string }
|
|
157
|
-
}
|
|
158
|
-
}
|
|
159
|
-
} },
|
|
160
|
-
required: [:foo, :bar],
|
|
161
|
-
defaults: { foo: "foo", bar: "bar" } }
|
|
162
|
-
|
|
163
|
-
]
|
|
164
|
-
)
|
|
165
|
-
end
|
|
166
|
-
|
|
167
|
-
it "strips out the sensitive attributes all the way down" do
|
|
168
|
-
expect(type_declaration_without_sensitive_types).to eq(
|
|
169
|
-
type: :array,
|
|
170
|
-
element_type_declaration: {
|
|
171
|
-
type: :attributes,
|
|
172
|
-
element_type_declarations: {
|
|
173
|
-
foo: :string,
|
|
174
|
-
bar: :string,
|
|
175
|
-
baz: :string,
|
|
176
|
-
nested: {
|
|
177
|
-
type: :attributes,
|
|
178
|
-
element_type_declarations: {
|
|
179
|
-
foo: :string,
|
|
180
|
-
bar: :string,
|
|
181
|
-
baz: :string
|
|
182
|
-
},
|
|
183
|
-
required: [:bar, :foo], defaults: { foo: "foo", bar: "bar" }
|
|
184
|
-
},
|
|
185
|
-
baz2: {
|
|
186
|
-
type: :array,
|
|
187
|
-
element_type_declaration: {
|
|
188
|
-
type: :attributes,
|
|
189
|
-
element_type_declarations: { foo: :string }
|
|
190
|
-
}
|
|
191
|
-
}
|
|
192
|
-
},
|
|
193
|
-
required: [:bar, :foo],
|
|
194
|
-
defaults: { foo: "foo", bar: "bar" }
|
|
195
|
-
}
|
|
196
|
-
)
|
|
197
|
-
end
|
|
198
|
-
end
|
|
199
|
-
|
|
200
|
-
context "when non-sensitive built-in type" do
|
|
201
|
-
let(:type) do
|
|
202
|
-
Foobara::BuiltinTypes[:integer]
|
|
203
|
-
end
|
|
204
|
-
|
|
205
|
-
it "returns the declaration unmodified" do
|
|
206
|
-
expect(type_declaration_without_sensitive_types).to eq(strict_type_declaration)
|
|
207
|
-
end
|
|
208
|
-
end
|
|
209
|
-
end
|
|
210
|
-
end
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
RSpec.describe Foobara::TypeDeclarations::TypeBuilder do
|
|
2
|
-
after do
|
|
3
|
-
Foobara.reset_alls
|
|
4
|
-
end
|
|
5
|
-
|
|
6
|
-
let(:type_builder) do
|
|
7
|
-
Foobara::GlobalDomain.foobara_type_builder
|
|
8
|
-
end
|
|
9
|
-
|
|
10
|
-
describe "#type_for_declaration" do
|
|
11
|
-
context "when declaring an array of attributes" do
|
|
12
|
-
context "when via :array and a block" do
|
|
13
|
-
it "builds the expected type" do
|
|
14
|
-
type = type_builder.type_for_declaration(:array) do
|
|
15
|
-
foo :string, :required
|
|
16
|
-
end
|
|
17
|
-
|
|
18
|
-
expect(type.declaration_data).to eq(
|
|
19
|
-
type: :array,
|
|
20
|
-
element_type_declaration: {
|
|
21
|
-
type: :attributes,
|
|
22
|
-
element_type_declarations: { foo: :string },
|
|
23
|
-
required: [:foo]
|
|
24
|
-
}
|
|
25
|
-
)
|
|
26
|
-
end
|
|
27
|
-
end
|
|
28
|
-
|
|
29
|
-
context "when via array literal with a lambda" do
|
|
30
|
-
it "builds the expected type" do
|
|
31
|
-
type = type_builder.type_for_declaration([-> {
|
|
32
|
-
foo :string, :required
|
|
33
|
-
}])
|
|
34
|
-
|
|
35
|
-
expect(type.declaration_data).to eq(
|
|
36
|
-
type: :array,
|
|
37
|
-
element_type_declaration: {
|
|
38
|
-
type: :attributes,
|
|
39
|
-
element_type_declarations: { foo: :string },
|
|
40
|
-
required: [:foo]
|
|
41
|
-
}
|
|
42
|
-
)
|
|
43
|
-
end
|
|
44
|
-
end
|
|
45
|
-
end
|
|
46
|
-
end
|
|
47
|
-
end
|
|
@@ -1,252 +0,0 @@
|
|
|
1
|
-
RSpec.describe Foobara::TypeDeclaration do
|
|
2
|
-
let(:declaration_data) do
|
|
3
|
-
{
|
|
4
|
-
foo: :integer,
|
|
5
|
-
bar: :integer
|
|
6
|
-
}
|
|
7
|
-
end
|
|
8
|
-
|
|
9
|
-
let(:type_declaration) do
|
|
10
|
-
described_class.new(declaration_data)
|
|
11
|
-
end
|
|
12
|
-
|
|
13
|
-
describe "#delete" do
|
|
14
|
-
it "deletes the expected attribute and results in a duped declaration" do
|
|
15
|
-
expect(type_declaration.key?(:foo)).to be true
|
|
16
|
-
expect(type_declaration).to_not be_duped
|
|
17
|
-
|
|
18
|
-
type_declaration.delete(:foo)
|
|
19
|
-
|
|
20
|
-
expect(type_declaration.key?(:foo)).to be false
|
|
21
|
-
expect(type_declaration).to be_duped
|
|
22
|
-
end
|
|
23
|
-
|
|
24
|
-
context "when strict" do
|
|
25
|
-
let(:declaration_data) do
|
|
26
|
-
{
|
|
27
|
-
type: :attributes,
|
|
28
|
-
element_type_declarations: {
|
|
29
|
-
foo: :integer,
|
|
30
|
-
bar: :integer
|
|
31
|
-
},
|
|
32
|
-
required: [:foo, :bar]
|
|
33
|
-
}
|
|
34
|
-
end
|
|
35
|
-
let(:type_declaration) do
|
|
36
|
-
described_class.new(declaration_data, true)
|
|
37
|
-
end
|
|
38
|
-
|
|
39
|
-
context "when removing :type key" do
|
|
40
|
-
it "clears the absolutified flag" do
|
|
41
|
-
expect {
|
|
42
|
-
type_declaration.delete(:type)
|
|
43
|
-
|
|
44
|
-
expect(type_declaration.declaration_data).to eq(
|
|
45
|
-
element_type_declarations: {
|
|
46
|
-
foo: :integer,
|
|
47
|
-
bar: :integer
|
|
48
|
-
},
|
|
49
|
-
required: [:foo, :bar]
|
|
50
|
-
)
|
|
51
|
-
}.to change(type_declaration, :absolutified?).from(true).to(false)
|
|
52
|
-
end
|
|
53
|
-
end
|
|
54
|
-
end
|
|
55
|
-
|
|
56
|
-
context "when absolutified" do
|
|
57
|
-
let(:declaration_data) do
|
|
58
|
-
{
|
|
59
|
-
type: :attributes,
|
|
60
|
-
element_type_declarations: {
|
|
61
|
-
foo: :integer,
|
|
62
|
-
bar: :integer
|
|
63
|
-
},
|
|
64
|
-
required: [:foo, :bar]
|
|
65
|
-
}
|
|
66
|
-
end
|
|
67
|
-
let(:type_declaration) do
|
|
68
|
-
super().tap do |declaration|
|
|
69
|
-
declaration.is_strict = true
|
|
70
|
-
end
|
|
71
|
-
end
|
|
72
|
-
|
|
73
|
-
it "removes the strict flag" do
|
|
74
|
-
expect {
|
|
75
|
-
type_declaration.delete(:required)
|
|
76
|
-
}.to change(type_declaration, :strict?).from(true).to(false)
|
|
77
|
-
end
|
|
78
|
-
|
|
79
|
-
context "when removing :type key" do
|
|
80
|
-
it "clears the absolutified flag" do
|
|
81
|
-
expect {
|
|
82
|
-
type_declaration.delete(:type)
|
|
83
|
-
|
|
84
|
-
expect(type_declaration.declaration_data).to eq(
|
|
85
|
-
element_type_declarations: {
|
|
86
|
-
foo: :integer,
|
|
87
|
-
bar: :integer
|
|
88
|
-
},
|
|
89
|
-
required: [:foo, :bar]
|
|
90
|
-
)
|
|
91
|
-
}.to change(type_declaration, :absolutified?).from(true).to(false)
|
|
92
|
-
end
|
|
93
|
-
end
|
|
94
|
-
end
|
|
95
|
-
end
|
|
96
|
-
|
|
97
|
-
describe "#except" do
|
|
98
|
-
context "when strict" do
|
|
99
|
-
let(:declaration_data) do
|
|
100
|
-
{
|
|
101
|
-
type: :attributes,
|
|
102
|
-
element_type_declarations: {
|
|
103
|
-
foo: :integer,
|
|
104
|
-
bar: :integer
|
|
105
|
-
},
|
|
106
|
-
required: [:foo, :bar]
|
|
107
|
-
}
|
|
108
|
-
end
|
|
109
|
-
let(:type_declaration) do
|
|
110
|
-
Foobara::TypeDeclarations.strict do
|
|
111
|
-
super()
|
|
112
|
-
end
|
|
113
|
-
end
|
|
114
|
-
|
|
115
|
-
it "removes the strict flag" do
|
|
116
|
-
declaration = type_declaration
|
|
117
|
-
|
|
118
|
-
expect {
|
|
119
|
-
declaration = declaration.except(:required)
|
|
120
|
-
|
|
121
|
-
expect(declaration.declaration_data).to eq(
|
|
122
|
-
type: :attributes,
|
|
123
|
-
element_type_declarations: {
|
|
124
|
-
foo: :integer,
|
|
125
|
-
bar: :integer
|
|
126
|
-
}
|
|
127
|
-
)
|
|
128
|
-
# Hmmm rubocop complains about !! use... TODO: disable that?
|
|
129
|
-
}.to change { declaration.strict? == true }.from(true).to(false)
|
|
130
|
-
end
|
|
131
|
-
end
|
|
132
|
-
|
|
133
|
-
context "when strict_stringified" do
|
|
134
|
-
let(:declaration_data) do
|
|
135
|
-
{
|
|
136
|
-
"type" => "attributes",
|
|
137
|
-
"element_type_declarations" => {
|
|
138
|
-
"foo" => "integer",
|
|
139
|
-
"bar" => "integer"
|
|
140
|
-
},
|
|
141
|
-
"required" => ["foo", "bar"]
|
|
142
|
-
}
|
|
143
|
-
end
|
|
144
|
-
|
|
145
|
-
let(:type_declaration) do
|
|
146
|
-
Foobara::TypeDeclarations.strict_stringified do
|
|
147
|
-
super()
|
|
148
|
-
end
|
|
149
|
-
end
|
|
150
|
-
|
|
151
|
-
it "removes the element" do
|
|
152
|
-
declaration = type_declaration.except(:required)
|
|
153
|
-
|
|
154
|
-
expect(declaration.declaration_data).to eq(
|
|
155
|
-
type: :attributes,
|
|
156
|
-
element_type_declarations: {
|
|
157
|
-
"foo" => "integer",
|
|
158
|
-
"bar" => "integer"
|
|
159
|
-
}
|
|
160
|
-
)
|
|
161
|
-
end
|
|
162
|
-
end
|
|
163
|
-
end
|
|
164
|
-
|
|
165
|
-
describe "#clone" do
|
|
166
|
-
context "when strict with a type" do
|
|
167
|
-
let(:type_declaration) do
|
|
168
|
-
super().tap do |declaration|
|
|
169
|
-
declaration.is_strict = true
|
|
170
|
-
declaration.type = Foobara::Domain.current.foobara_type_from_declaration(declaration_data)
|
|
171
|
-
end
|
|
172
|
-
end
|
|
173
|
-
|
|
174
|
-
it "preserves the strict flag and type" do
|
|
175
|
-
clone = type_declaration.clone
|
|
176
|
-
|
|
177
|
-
expect(clone.type).to be_a(Foobara::Type)
|
|
178
|
-
expect(clone).to be_strict
|
|
179
|
-
end
|
|
180
|
-
end
|
|
181
|
-
end
|
|
182
|
-
|
|
183
|
-
describe "#assign" do
|
|
184
|
-
context "when strict" do
|
|
185
|
-
let(:declaration_data) do
|
|
186
|
-
{
|
|
187
|
-
type: :attributes,
|
|
188
|
-
element_type_declarations: {
|
|
189
|
-
foo: :integer,
|
|
190
|
-
bar: :integer
|
|
191
|
-
},
|
|
192
|
-
required: [:foo, :bar]
|
|
193
|
-
}
|
|
194
|
-
end
|
|
195
|
-
let(:type_declaration) do
|
|
196
|
-
super().tap do |declaration|
|
|
197
|
-
declaration.is_strict = true
|
|
198
|
-
end
|
|
199
|
-
end
|
|
200
|
-
|
|
201
|
-
it "copies everything over" do
|
|
202
|
-
clone = described_class.new(foo: :bar)
|
|
203
|
-
|
|
204
|
-
clone.assign(type_declaration)
|
|
205
|
-
|
|
206
|
-
expect(clone.declaration_data).to eq(
|
|
207
|
-
type: :attributes,
|
|
208
|
-
element_type_declarations: {
|
|
209
|
-
foo: :integer,
|
|
210
|
-
bar: :integer
|
|
211
|
-
},
|
|
212
|
-
required: [:foo, :bar]
|
|
213
|
-
)
|
|
214
|
-
expect(clone).to be_absolutified
|
|
215
|
-
end
|
|
216
|
-
end
|
|
217
|
-
end
|
|
218
|
-
|
|
219
|
-
describe "#initialize" do
|
|
220
|
-
context "when a type symbol" do
|
|
221
|
-
let(:declaration_data) { :integer }
|
|
222
|
-
|
|
223
|
-
it "sets the type and various flags" do
|
|
224
|
-
expect(type_declaration.type).to be(Foobara::BuiltinTypes[:integer])
|
|
225
|
-
|
|
226
|
-
expect(type_declaration.declaration_data).to eq(:integer)
|
|
227
|
-
|
|
228
|
-
expect(type_declaration).to be_strict
|
|
229
|
-
expect(type_declaration).to be_absolutified
|
|
230
|
-
expect(type_declaration).to be_duped
|
|
231
|
-
expect(type_declaration).to be_deep_duped
|
|
232
|
-
end
|
|
233
|
-
|
|
234
|
-
context "when absolutified" do
|
|
235
|
-
let(:type_declaration) do
|
|
236
|
-
described_class.new(declaration_data, true)
|
|
237
|
-
end
|
|
238
|
-
|
|
239
|
-
it "sets the type and various flags" do
|
|
240
|
-
expect(type_declaration.type).to be(Foobara::BuiltinTypes[:integer])
|
|
241
|
-
|
|
242
|
-
expect(type_declaration.declaration_data).to eq(:integer)
|
|
243
|
-
|
|
244
|
-
expect(type_declaration).to be_strict
|
|
245
|
-
expect(type_declaration).to be_absolutified
|
|
246
|
-
expect(type_declaration).to be_duped
|
|
247
|
-
expect(type_declaration).to be_deep_duped
|
|
248
|
-
end
|
|
249
|
-
end
|
|
250
|
-
end
|
|
251
|
-
end
|
|
252
|
-
end
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
RSpec.describe Foobara::TypeDeclarations do
|
|
2
|
-
describe ".strict" do
|
|
3
|
-
it "puts it in strict mode" do
|
|
4
|
-
expect(described_class.strict?).to be(false)
|
|
5
|
-
described_class.strict do
|
|
6
|
-
expect(described_class.strict?).to be(true)
|
|
7
|
-
end
|
|
8
|
-
expect(described_class.strict?).to be(false)
|
|
9
|
-
end
|
|
10
|
-
end
|
|
11
|
-
end
|
|
@@ -1,65 +0,0 @@
|
|
|
1
|
-
RSpec.describe Foobara::TypeDeclarations::TypedTransformer do
|
|
2
|
-
after { Foobara.reset_alls }
|
|
3
|
-
|
|
4
|
-
describe ".to/.to_type .from/.from_type" do
|
|
5
|
-
context "when .type_declaration is a type" do
|
|
6
|
-
let(:transformer_class) do
|
|
7
|
-
stub_class :SomeTransformer, described_class do
|
|
8
|
-
from :integer
|
|
9
|
-
to :string
|
|
10
|
-
|
|
11
|
-
def transform(int)
|
|
12
|
-
int.to_s
|
|
13
|
-
end
|
|
14
|
-
end
|
|
15
|
-
end
|
|
16
|
-
|
|
17
|
-
it "results in typed transformer instances with those types" do
|
|
18
|
-
transformer = transformer_class.instance
|
|
19
|
-
|
|
20
|
-
expect(transformer_class.from_type).to eq(Foobara::BuiltinTypes[:integer])
|
|
21
|
-
expect(transformer_class.to_type).to eq(Foobara::BuiltinTypes[:string])
|
|
22
|
-
|
|
23
|
-
expect(transformer.from_type).to eq(Foobara::BuiltinTypes[:integer])
|
|
24
|
-
expect(transformer.to_type).to eq(Foobara::BuiltinTypes[:string])
|
|
25
|
-
|
|
26
|
-
expect(transformer.process_value!(5)).to eq("5")
|
|
27
|
-
end
|
|
28
|
-
end
|
|
29
|
-
end
|
|
30
|
-
|
|
31
|
-
describe "#from_type_declaration" do
|
|
32
|
-
let(:transformer_class) do
|
|
33
|
-
stub_class "Dearrayify", described_class do
|
|
34
|
-
def from_type_declaration
|
|
35
|
-
[to_type.declaration_data]
|
|
36
|
-
end
|
|
37
|
-
end
|
|
38
|
-
end
|
|
39
|
-
|
|
40
|
-
it "gives a way to define the define the from type in terms of the to type" do
|
|
41
|
-
transformer = transformer_class.new(to: :integer)
|
|
42
|
-
|
|
43
|
-
expect(transformer.from_type.declaration_data).to eq(
|
|
44
|
-
Foobara::Domain.current.foobara_type_from_declaration([:integer]).declaration_data
|
|
45
|
-
)
|
|
46
|
-
end
|
|
47
|
-
|
|
48
|
-
context "with no types" do
|
|
49
|
-
let(:transformer_class) do
|
|
50
|
-
stub_class :SomeTransformer, described_class do
|
|
51
|
-
def transform(int)
|
|
52
|
-
int.to_s
|
|
53
|
-
end
|
|
54
|
-
end
|
|
55
|
-
end
|
|
56
|
-
|
|
57
|
-
it "pointless, but it can still translate" do
|
|
58
|
-
expect(transformer_class.from_type).to be_nil
|
|
59
|
-
expect(transformer_class.to_type).to be_nil
|
|
60
|
-
|
|
61
|
-
expect(transformer_class.instance.process_value!(5)).to eq("5")
|
|
62
|
-
end
|
|
63
|
-
end
|
|
64
|
-
end
|
|
65
|
-
end
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
RSpec.describe Foobara::Types do
|
|
2
|
-
after { Foobara.reset_alls }
|
|
3
|
-
|
|
4
|
-
describe "#foobara_manifest" do
|
|
5
|
-
context "when type is registered" do
|
|
6
|
-
before do
|
|
7
|
-
Foobara::GlobalDomain.foobara_register_type(:some_type, type)
|
|
8
|
-
end
|
|
9
|
-
|
|
10
|
-
context "when type is sensitive" do
|
|
11
|
-
let(:type) do
|
|
12
|
-
Foobara::GlobalDomain.foobara_type_from_declaration(:string, :sensitive)
|
|
13
|
-
end
|
|
14
|
-
|
|
15
|
-
it "includes a sensitive flag" do
|
|
16
|
-
expect(type).to be_sensitive
|
|
17
|
-
expect(type.foobara_manifest[:sensitive]).to be true
|
|
18
|
-
# TODO: come up with a better name for sensitive_exposed and/or sensitive
|
|
19
|
-
expect(type.foobara_manifest.key?(:sensitive_exposed)).to be false
|
|
20
|
-
end
|
|
21
|
-
end
|
|
22
|
-
|
|
23
|
-
context "when it is sensitive_exposed" do
|
|
24
|
-
let(:type) do
|
|
25
|
-
Foobara::GlobalDomain.foobara_type_from_declaration(:string, :sensitive_exposed)
|
|
26
|
-
end
|
|
27
|
-
|
|
28
|
-
it "includes a sensitive_exposed flag" do
|
|
29
|
-
expect(type).to be_sensitive_exposed
|
|
30
|
-
expect(type.foobara_manifest.key?(:sensitive)).to be false
|
|
31
|
-
expect(type.foobara_manifest[:sensitive_exposed]).to be true
|
|
32
|
-
end
|
|
33
|
-
end
|
|
34
|
-
end
|
|
35
|
-
end
|
|
36
|
-
end
|