Sha256: 45c2736a5d91aa5579a771508cde8f961375b3ef8df3ea97a99afa1a3740e6cb

Contents?: true

Size: 1.11 KB

Versions: 3

Compression:

Stored size: 1.11 KB

Contents

# Copyright (c) 2008-2013 Michael Dvorkin and contributors.
#
# Fat Free CRM is freely distributable under the terms of MIT license.
# See MIT-LICENSE file or http://www.opensource.org/licenses/mit-license.php
#------------------------------------------------------------------------------
FactoryGirl.define do
  sequence :klass_name do |_x|
    %w(Contact Account Opportunity Lead Campaign).sample
  end

  sequence(:field_position) { |x| x }

  sequence :field_label do |x|
    FFaker::Internet.user_name + x.to_s
  end

  factory :field_group do
    klass_name          { FactoryGirl.generate(:klass_name) }
    label               { FactoryGirl.generate(:field_label) }
    tag
  end

  factory :field do
    type "Field"
    field_group
    position            { FactoryGirl.generate(:field_position) }
    label               { FactoryGirl.generate(:field_label) }
    name                { |f| f.label.downcase.gsub(/[^a-z0-9]+/, '_') }
    as "string"
    updated_at          { FactoryGirl.generate(:time) }
    created_at          { FactoryGirl.generate(:time) }
  end

  factory :custom_field do
    type "CustomField"
  end
end

Version data entries

3 entries across 3 versions & 2 rubygems

Version Path
fat_free_crm-0.15.0.beta.2 spec/factories/field_factories.rb
fat_free_crm-0.15.0.beta spec/factories/field_factories.rb
reduced_fat_crm-0.15.0.beta spec/factories/field_factories.rb