• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

foodcoops / foodsoft / 24880436804

24 Apr 2026 08:38AM UTC coverage: 45.376% (+2.4%) from 42.955%
24880436804

push

github

lentschi
Closes #1297 - Optionally display demo mode warning in header

3317 of 7310 relevant lines covered (45.38%)

12.53 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

73.33
/app/models/concerns/extendable_enum.rb
1
module ExtendableEnum
1✔
2
  extend ActiveSupport::Concern
1✔
3

4
  class ExtendableEnumType < ActiveRecord::Enum::EnumType
1✔
5
    def add_value(value)
1✔
6
      @mapping[value] = value.to_s
×
7
    end
8

9
    def values
1✔
10
      @mapping.freeze
×
11
    end
12
  end
13

14
  class_methods do
1✔
15
    def extendable_enum(name, values)
1✔
16
      enum_type = ExtendableEnumType.new(name, values, ActiveModel::Type::String.new)
1✔
17
      attribute name, enum_type
1✔
18

19
      define_singleton_method("add_#{name}_value") do |value|
1✔
20
        enum_type.add_value(value)
×
21
      end
22

23
      define_singleton_method("#{name}s") do
1✔
24
        enum_type.values
×
25
      end
26
    end
27
  end
28
end
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc