<commit_before>FactoryGirl.define do
  factory :order, :class => Spree::Order do
    # associations:
    association(:user, :factory => :user)
    association(:bill_address, :factory => :address)
    completed_at nil
    bill_address_id nil
    ship_address_id nil
    email '<EMAIL>'
  end

  factory :order_with_totals, :parent => :order do
    after(:create) do |order|
      FactoryGirl.create(:line_item, :order => order)
      order.line_items.reload # to ensure order.line_items is accessible after
    end
  end

  factory :order_with_inventory_unit_shipped, :parent => :order do
    after(:create) do |order|
      FactoryGirl.create(:line_item, :order => order)
      FactoryGirl.create(:inventory_unit, :order => order, :state => 'shipped')
    end
  end

  factory :completed_order_with_totals, :parent => :order_with_totals do
    bill_address { FactoryGirl.create(:address) }
    ship_address { FactoryGirl.create(:address) }
    after(:create) do |order|
      FactoryGirl.create(:inventory_unit, :order => order, :state => 'shipped')
    end
    state 'complete'
    completed_at Time.now
  end
end
<commit_msg>use factory girl inheritance for order factory<commit_after>FactoryGirl.define do
  factory :order, :class => Spree::Order do
    # associations:
    association(:user, :factory => :user)
    association(:bill_address, :factory => :address)
    completed_at nil
    bill_address_id nil
    ship_address_id nil
    email '<EMAIL>'

    factory :order_with_totals, :parent => :order do
      after(:create) do |order|
        FactoryGirl.create(:line_item, :order => order)
        order.line_items.reload # to ensure order.line_items is accessible after
      end
    end

    factory :order_with_line_items do
      ignore do
        line_items_count 5
      end
      after(:create) do |order, evaluator|
        FactoryGirl.create_list(:line_item, evaluator.line_items_count, :order => order)
      end
    end

    factory :order_with_inventory_unit_shipped do
      after(:create) do |order|
        FactoryGirl.create(:line_item, :order => order)
        FactoryGirl.create(:inventory_unit, :order => order, :state => 'shipped')
      end
    end

    factory :completed_order_with_totals do
      bill_address { FactoryGirl.create(:address) }
      ship_address { FactoryGirl.create(:address) }
      after(:create) do |order|
        FactoryGirl.create(:inventory_unit, :order => order, :state => 'shipped')
      end
      state 'complete'
      completed_at Time.now
    end
  end

end

{'fraction_non_alphanumeric': 0.10507533703409992, 'fraction_numerical': 0.0003965107057890563, 'mean_word_length': 3.3802083333333335, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 28, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5828564', 'n_tokens_mistral': 784, 'n_tokens_neox': 759, 'n_words': 190}