Module: OMU::Support::Minitest::EnumerationHelper

Defined in:
lib/omu_support/minitest/enumeration_helper.rb

Instance Method Summary collapse

Instance Method Details

#enum(definitions) ⇒ Object



7
8
9
10
11
12
13
14
15
16
17
# File 'lib/omu_support/minitest/enumeration_helper.rb', line 7

def enum(definitions)
  definitions.each do |attribute, values|
    values.each do |key, value|
      test "has a enum key (#{key}) with a value of #{value}" do
        klass         = class_name.delete_suffix('Test').constantize
        defined_value = klass.defined_enums.dig(attribute.to_s, key.to_s)
        assert_equal defined_value, value, "Enum: #{attribute}"
      end
    end
  end
end