Sha256: 3661a5528c695ff1178b46aea44addbbc267ffb8412f64cb3e94c9c1aadfb8ef

Contents?: true

Size: 1.12 KB

Versions: 10

Compression:

Stored size: 1.12 KB

Contents

FactoryGirl.define do
  #
  # pass :price => 2000 just like anything else
  #
  factory :chart do
    ignore do
      price nil
      capacity nil
    end

    name 'Test Chart'
    is_template false
    organization

    after(:create) do |chart, evaluator|
      unless evaluator.capacity.nil?
        chart.sections.first.capacity = evaluator.capacity
        chart.sections.first.save
      end

      unless evaluator.price.nil?
        chart.sections.first.ticket_types.first.price = evaluator.price
        chart.sections.first.ticket_types.first.save
      end
    end
  end

  factory :chart_with_sections, :parent => :chart do
    skip_create_first_section true
    after(:create) do |chart|
      2.times do
        chart.sections << FactoryGirl.create(:section)
      end
    end
  end

  factory :chart_with_free_sections, :parent => :chart do
    after(:create) do |chart|
      2.times do
        chart.sections << FactoryGirl.create(:free_section)
      end
    end
  end

  factory :assigned_chart, :parent => :chart_with_sections do
    event
  end

  factory :chart_template, :parent => :chart do
    is_template true
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
artfully_ose-1.2.0 spec/factories/chart_factories.rb
artfully_ose-1.2.0.beta.1 spec/factories/chart_factories.rb
artfully_ose-1.2.0.alpha.2 spec/factories/chart_factories.rb
artfully_ose-1.2.0.alpha.1 spec/factories/chart_factories.rb
artfully_ose-1.2.0.pre.27 spec/factories/chart_factories.rb
artfully_ose-1.2.0.pre.26 spec/factories/chart_factories.rb
artfully_ose-1.2.0.pre.24 spec/factories/chart_factories.rb
artfully_ose-1.2.0.pre.23 spec/factories/chart_factories.rb
artfully_ose-1.2.0.pre.21 spec/factories/chart_factories.rb
artfully_ose-1.2.0.pre.20 spec/factories/chart_factories.rb