Sha256: 02ea97fd952134633b25682a8d9826bc17647f10e9c70f1efeeaad494eef579d
Contents?: true
Size: 664 Bytes
Versions: 8
Compression:
Stored size: 664 Bytes
Contents
# frozen_string_literal: true module Matchers module Type class EnumMatcher < TypeMatcher def initialize(attribute, valid_hash, enum_type, enum_types, nonsense_value: 'NONSENSE') valid_value = Fortnox::API::Types.const_get(enum_types).values.first super(attribute, valid_hash, enum_type, valid_value, nonsense_value) @enum_type = Fortnox::API::Types.const_get(enum_type) @expected_error = "Exception missing for nonsense value #{@invalid_value.inspect}" end private def expected_type? @actual_type = @klass.schema[@attribute] @actual_type == @enum_type end end end end
Version data entries
8 entries across 8 versions & 1 rubygems