Sha256: c22887edaa776d421730c46a58f05235968f294417285e19ff931688df610022
Contents?: true
Size: 654 Bytes
Versions: 6
Compression:
Stored size: 654 Bytes
Contents
module Matchers module Type class EnumMatcher < TypeMatcher def initialize( attribute, valid_hash, enum_type, enum_types, nonsense_value: 'NONSENSE'.freeze ) 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
6 entries across 6 versions & 1 rubygems