Sha256: 5f128d4430f931d461681ea750a6177d517eede5fc6319581e51fa0dca8da14b

Contents?: true

Size: 1.45 KB

Versions: 4

Compression:

Stored size: 1.45 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                { FFaker::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     { FFaker::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

4 entries across 4 versions & 2 rubygems

Version Path
fat_free_crm-0.14.2 spec/factories/opportunity_factories.rb
fat_free_crm-0.14.1 spec/factories/opportunity_factories.rb
fat_free_crm-0.14.0 spec/factories/opportunity_factories.rb
reduced_fat_crm-0.14.0 spec/factories/opportunity_factories.rb