Sha256: a3cb9f1c0899b91cb22072841ff432088b654122d115e525462547f6e9cd311f

Contents?: true

Size: 813 Bytes

Versions: 1

Compression:

Stored size: 813 Bytes

Contents

FactoryBot.define do
  factory :<%= name %>, class: <%= record.class %> do
  <%- columns.each do |column| -%>
    <%- quote = FactoryBotGenerator::Base::QUOTE_AROUND_VALUE_TYPES.include?(record.class.columns_hash[column].type) -%>
    <%= "%-#{indent}s" % column %> <%= "'" if quote %><%= record.public_send(column) %><%= "'" if quote %>
  <%- end -%>
  end
end

--------------------------------

FactoryBot.define do
  factory :<%= name %>, class: <%= record.class %> do
  <%- columns.each do |column| -%>
    <%- next if record.public_send(column).blank? -%>
    <%- quote = FactoryBotGenerator::Base::QUOTE_AROUND_VALUE_TYPES.include?(record.class.columns_hash[column].type) -%>
    <%= "%-#{indent}s" % column %> <%= "'" if quote %><%= record.public_send(column) %><%= "'" if quote %>
  <%- end -%>
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
factory_bot_generator-0.3.0 lib/factory_bot_generator.erb