Sha256: f6d41f658a1ada2929bd5b50e5d0155733b86f6f029f4ba6a04a4bec0d08831e

Contents?: true

Size: 522 Bytes

Versions: 2

Compression:

Stored size: 522 Bytes

Contents

# frozen_string_literal: true

def build_model(model)
  DirtySeed::Model.new(model)
end

def build_attribute(type, name = 'fake')
  DirtySeed::Attribute.new(
    build_column(type, name)
  )
end

def build_column(type, name = 'fake')
  ActiveRecord::ConnectionAdapters::Column.new(
    name,
    false,
    ActiveRecord::ConnectionAdapters::SqlTypeMetadata.new(
      type: sql_type(type)
    )
  )
end

private

def sql_type(type)
  case type
  when :float then :decimal
  when :time then :datetime
  else type
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
dirty_seed-0.2.1 spec/support/helpers.rb
dirty_seed-0.2.0 spec/support/helpers.rb