Sha256: 5058b4ee3037e091e09254cd763efe92f0e5c64bdb882d2c89f294125969accf

Contents?: true

Size: 1.48 KB

Versions: 11

Compression:

Stored size: 1.48 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 :opportunity_status do |s|
    %w(prospecting analysis presentation proposal negotiation final_review won lost).sample
  end

  sequence :opportunity_open_status do |s|
    %w(prospecting analysis presentation proposal negotiation final_review).sample
  end

  factory :opportunity do
    user
    campaign
    account             { FactoryGirl.create(:account) }
    assigned_to         nil
    name                { Faker::Lorem.sentence[0,64] }
    access              "Public"
    source              { %w(campaign cold_call conference online referral self web word_of_mouth other).sample }
    stage               { FactoryGirl.generate(:opportunity_status) }
    probability         { rand(50) }
    amount              { rand(1000) }
    discount            { rand(100) }
    closes_on           { FactoryGirl.generate(:date) }
    background_info     { Faker::Lorem.paragraph[0,255] }
    deleted_at          nil
    updated_at          { FactoryGirl.generate(:time) }
    created_at          { FactoryGirl.generate(:time) }
  end

  factory :opportunity_in_pipeline, :parent => :opportunity do
    stage               { FactoryGirl.generate(:opportunity_open_status) }
  end

end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
fat_free_crm-0.13.6 spec/factories/opportunity_factories.rb
fat_free_crm-0.13.5 spec/factories/opportunity_factories.rb
fat_free_crm-0.13.4 spec/factories/opportunity_factories.rb
fat_free_crm-0.13.3 spec/factories/opportunity_factories.rb
fat_free_crm-0.13.2 spec/factories/opportunity_factories.rb
fat_free_crm-0.12.3 spec/factories/opportunity_factories.rb
fat_free_crm-0.12.2 spec/factories/opportunity_factories.rb
fat_free_crm-0.13.1 spec/factories/opportunity_factories.rb
fat_free_crm-0.12.1 spec/factories/opportunity_factories.rb
fat_free_crm-0.13.0 spec/factories/opportunity_factories.rb
fat_free_crm-0.12.0 spec/factories/opportunity_factories.rb