Sha256: b7c46baa99d6284ef67ceb1817ae9bcb36bd19b998e87d5d1b60102124b3aa0d
Contents?: true
Size: 1.02 KB
Versions: 1
Compression:
Stored size: 1.02 KB
Contents
FactoryGirl.define do factory :<%= singular_table_name %><%= explicit_class_option %> do <% i = 0 -%> <% for attribute in attributes -%> <% if attribute.reference? -%> association :<%= attribute.name %>, factory: :<%= attribute.name %> <% elsif attribute.name == 'email' -%> sequence(:<%= attribute.name %>) {|n| "email#{format "%02d", n}@gmail.com" } <% elsif attribute.name =~ /(.*)_url$/ -%> sequence(:<%= attribute.name %>) {|n| "http://<%= $1 %>#{format "%02d", n}.com" } <% elsif attribute.name == 'password' -%> password 'password' <% elsif attribute.name == 'position' -%> sequence(:<%= attribute.name %>) {|n| n } <% elsif [:string, :text].include? attribute.type -%> sequence(:<%= attribute.name %>) {|n| "<%= attribute.name.capitalize.gsub('_', ' ') %>#{format "%02d", n}" } <% elsif attribute.type == :integer -%> <% i += 1 -%> sequence(:<%= attribute.name %>) {|n| "<%= i %>#{format "%02d", n}" } <% else -%> <%= attribute.name %> <%= attribute.default.inspect %> <% end -%> <% end -%> end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
factory_girl_fixtures_template-1.1.0 | lib/templates/factory_girl/model/fixtures.erb |