Sha256: c21b150e06ce879bd23d2d97b368ea66d6fd8825832bbefd992effdd175dc7a2

Contents?: true

Size: 958 Bytes

Versions: 4

Compression:

Stored size: 958 Bytes

Contents

# frozen_string_literal: true

require 'faker'

module RSpec
  module Hive
    class QueryBuilder
      class TypeFaker
        class << self
          # rubocop:disable Metrics/CyclomaticComplexity
          def fake(type)
            case type
            when :int
              Faker::Number.number(9)
            when :smallint
              Faker::Number.number(4)
            when :tinyint
              Faker::Number.number(1)
            when :bigint
              Faker::Number.number(12)
            when :float
              Faker::Number.decimal(4, 4)
            when :double
              Faker::Number.decimal(8, 8)
            when :boolean
              Faker::Boolean.boolean
            when :string
              Faker::Lorem.word
            else
              raise ArgumentError, "Unsupported type: #{type}"
            end
          end
          # rubocop:enable Metrics/CyclomaticComplexity
        end
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
rspec-hive-0.6.3 lib/rspec/hive/query_builder/type_faker.rb
rspec-hive-0.6.2 lib/rspec/hive/query_builder/type_faker.rb
rspec-hive-0.6.1 lib/rspec/hive/query_builder/type_faker.rb
rspec-hive-0.6.0 lib/rspec/hive/query_builder/type_faker.rb