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

umbrellio / table_sync / 18192685574

02 Oct 2025 12:17PM UTC coverage: 99.722% (-0.3%) from 100.0%
18192685574

push

github

web-flow
Validate data types of fields upon receive (#94)

95 of 98 new or added lines in 10 files covered. (96.94%)

1075 of 1078 relevant lines covered (99.72%)

161.01 hits per line

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

94.74
/lib/table_sync/utils/schema/validator/type.rb
1
# frozen_string_literal: true
2

3
class TableSync::Utils::Schema
4✔
4
  class Validator
4✔
5
    class Type
4✔
6
      attr_reader :display_name
4✔
7
      attr_reader :klasses
4✔
8

9
      def initialize(display_name, klasses)
4✔
10
        @display_name = display_name
20✔
11
        @klasses = klasses
20✔
12
      end
13

14
      # rubocop:disable Layout/ClassStructure
15
      STRING = new("String", [String]).freeze
4✔
16
      DATETIME = new("DateTime", [::Sequel::SQLTime, Date, Time, DateTime]).freeze
4✔
17
      INTEGER = new("Integer", [Integer]).freeze
4✔
18
      DECIMAL = new("Decimal", [Numeric]).freeze
4✔
19
      BOOLEAN = new("Boolean", [TrueClass, FalseClass]).freeze
4✔
20
      # rubocop:enable Layout/ClassStructure
21

22
      def validate(value)
4✔
23
        return if value.nil?
872✔
24
        return if klasses.any? { |klass| value.is_a?(klass) }
1,352✔
25
        "expected #{display_name}, got: #{value.class}"
32✔
26
      end
27

28
      def inspect
4✔
NEW
29
        display_name.inspect
×
30
      end
31
    end
32
  end
33
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