Sha256: 24265bd62c4c94d42bb34292f4edd1e7df513ad2bfb6d88e809335e73927ed08
Contents?: true
Size: 948 Bytes
Versions: 1
Compression:
Stored size: 948 Bytes
Contents
<%- unless ModelBase.config.frozen_string_literal.nil? -%> # frozen_string_literal: <%= ModelBase.config.frozen_string_literal.inspect %> <%- end -%> <%- columns = model.columns_for(:factory) rescue nil-%> <%- if columns -%> FactoryBot.define do factory :<%= model.full_resource_name %> do <%- model.columns_for(:factory).each do |col| -%> <%- if col.reference -%> <%- if col.required? -%> association :<%= col.reference.name %>, factory: :<%= col.ref_model.full_resource_name %> <%- else -%> <%= col.reference.name %> nil <%- end -%> <%- else -%> <%= col.name %> <%= col.sample_value(context: :factory).inspect.gsub(/\A\"|\"\z/, "'") %> <%- end -%> <%- end -%> end end <%- else -%> FactoryBot.define do factory :<%= singular_table_name %><%= explicit_class_option %> do <%- attributes.map do |attribute| -%> <%= attribute.name %> <%= attribute.default.inspect %> <%- end -%> end end <%- end -%>
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
model_base_generators-0.4.0 | lib/templates/factory_bot/factory.rb |