Sha256: 72a0428a5f8ce7acf503f1a16d7e362835399e87ad926337115ba5a5a01799b3
Contents?: true
Size: 697 Bytes
Versions: 3
Compression:
Stored size: 697 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.keys.find { |x| x.name == @attribute }&.type @actual_type == @enum_type end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
fortnox-api-0.8.2 | spec/support/matchers/type/enum_matcher.rb |
fortnox-api-0.8.1 | spec/support/matchers/type/enum_matcher.rb |
fortnox-api-0.9.0 | spec/support/matchers/type/enum_matcher.rb |