<commit_before>require 'spec_helper'

describe Fabrication do

  context 'with an active record object' do

    before(:all) { TestMigration.up }
    after(:all) { TestMigration.down }

    before do
      Fabricator(:company) do
        name { Faker::Company.name }
        divisions(:force) { [Fabricate(:division)] }
      end

      Fabricator(:division) do
        name "Awesome Division"
      end
    end

    let(:company) { Fabricate(:company) }

    it 'generates field blocks immediately' do
      company.name.should be
    end
    it 'overrides associations'

    it 'generates associations immediately when forced' do
      Division.find_all_by_company_id(company.id).count.should == 1
    end
  end

end<commit_msg>Override associations spec<commit_after>require 'spec_helper'

describe Fabrication do

  context 'with an active record object' do

    before(:all) { TestMigration.up }
    after(:all) { TestMigration.down }

    before do
      Fabricator(:company) do
        name { Faker::Company.name }
        divisions(:force) { [Fabricate(:division)] }
      end

      Fabricator(:division) do
        name "Awesome Division"
      end
    end

    let(:company) { Fabricate(:company) }

    it 'generates field blocks immediately' do
      company.name.should be
    end

    it 'generates associations immediately when forced' do
      Division.find_all_by_company_id(company.id).count.should == 1
    end

    it 'overrides associations' do
      Fabricate(:company, :divisions => []).divisions.should == []
    end
  end

end
{'fraction_non_alphanumeric': 0.09471649484536082, 'fraction_numerical': 0.001288659793814433, 'mean_word_length': 2.844059405940594, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 4, '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': '7116244', 'n_tokens_mistral': 472, 'n_tokens_neox': 454, 'n_words': 122}