<commit_before>require 'spec_helper'

module QueryMethodsSpec
  extend GenealogyTestModel
  
  describe "query methods" do

    before(:all) do
      QueryMethodsSpec.define_test_model_class({:spouse => true })
    end

    let(:uccio) {TestModel.create!(:name => "Uccio", :sex => "M", )}
    let(:narduccio) {TestModel.create!(:name => "Narduccio", :sex => "M", )}
    let(:maria) {TestModel.create!(:name => "Maria", :sex => "F", )}
    let(:tetta) {TestModel.create!(:name => "Tetta", :sex => "F", )}
    let(:antonio) {TestModel.create!(:name => "Antonio", :sex => "M", )}
    let(:assunta) {TestModel.create!(:name => "Assunta", :sex => "F", )}
    let(:gina) {TestModel.create!(:name => "Gina", :sex => "F")}
    let(:stefano) {TestModel.create!(:name => "Stefano", :sex => "M")}
    let(:corrado) {TestModel.create!(:name => "Corrado", :sex => "M")}
    let(:walter) {TestModel.create!(:name => "Walter", :sex => "M")}
    let(:manu) {TestModel.create!(:name => "Manu", :sex => "F")}
    let(:alessandro) {TestModel.create!(:name => "Alessandro", :sex => "M")}

    before(:each) do
      corrado.add_father(uccio)
      corrado.add_mother(tetta)
      corrado.add_siblings([stefano])
      walter.add_father(uccio)
      walter.add_mother(gina)
      corrado.add_paternal_grandfather(narduccio)
      corrado.add_paternal_grandmother(maria)
      corrado.add_maternal_grandfather(antonio)
      corrado.add_maternal_grandmother(assunta)
      alessandro.add_father(stefano)
      alessandro.add_mother(manu)
    end

    describe "corrado" do
      subject {corrado}
      its(:parents) {should =~ [tetta,uccio]}
      its(:paternal_grandfather) {should == narduccio}
      its(:paternal_grandmother) {should == maria}
      its(:maternal_grandfather) {should == antonio}
      its(:maternal_grandmother) {should == assunta}
      its(:siblings) {pending}
      its(:offspring) {pending}
      its(:half_siblings) {pending}
      its(:descendants) {pending}
      its(:ancestors) {pending}
    end

    describe "stefano" do
      subject {stefano}
      its(:parents) {should =~ [tetta,uccio]}
      its(:paternal_grandfather) {should == narduccio}
      its(:paternal_grandmother) {should == maria}
      its(:maternal_grandfather) {should == antonio}
      its(:maternal_grandmother) {should == assunta}
      its(:siblings) {pending}
      its(:offspring) {pending}
      its(:half_siblings) {pending}
      its(:descendants) {pending}
      its(:ancestors) {pending}
    end


  end

end<commit_msg>no message<commit_after>require 'spec_helper'

module QueryMethodsSpec
  extend GenealogyTestModel
  
  describe "query methods" do

    before(:all) do
      QueryMethodsSpec.define_test_model_class({:spouse => true })
    end

    let(:uccio) {TestModel.create!(:name => "Uccio", :sex => "M", )}
    let(:narduccio) {TestModel.create!(:name => "Narduccio", :sex => "M", )}
    let(:maria) {TestModel.create!(:name => "Maria", :sex => "F", )}
    let(:tetta) {TestModel.create!(:name => "Tetta", :sex => "F", )}
    let(:antonio) {TestModel.create!(:name => "Antonio", :sex => "M", )}
    let(:assunta) {TestModel.create!(:name => "Assunta", :sex => "F", )}
    let(:gina) {TestModel.create!(:name => "Gina", :sex => "F")}
    let(:stefano) {TestModel.create!(:name => "Stefano", :sex => "M")}
    let(:corrado) {TestModel.create!(:name => "Corrado", :sex => "M")}
    let(:walter) {TestModel.create!(:name => "Walter", :sex => "M")}
    let(:manu) {TestModel.create!(:name => "Manu", :sex => "F")}
    let(:alessandro) {TestModel.create!(:name => "Alessandro", :sex => "M")}

    before(:each) do
      corrado.add_father(uccio)
      corrado.add_mother(tetta)
      corrado.add_siblings([stefano])
      walter.add_father(uccio)
      walter.add_mother(gina)
      corrado.add_paternal_grandfather(narduccio)
      corrado.add_paternal_grandmother(maria)
      corrado.add_maternal_grandfather(antonio)
      corrado.add_maternal_grandmother(assunta)
      alessandro.add_father(stefano)
      alessandro.add_mother(manu)
    end

    describe "corrado" do
      subject {corrado}
      its(:parents) {should =~ [tetta,uccio]}
      its(:paternal_grandfather) {should == narduccio}
      its(:paternal_grandmother) {should == maria}
      its(:maternal_grandfather) {should == antonio}
      its(:maternal_grandmother) {should == assunta}
      its(:grandparents) {should =~ [assunta,antonio,narduccio,maria]}
      its(:siblings) {pending}
      its(:offspring) {pending}
      its(:half_siblings) {pending}
      its(:descendants) {pending}
      its(:ancestors) {pending}
    end

    describe "stefano" do
      subject {stefano}
      its(:parents) {should =~ [tetta,uccio]}
      its(:paternal_grandfather) {should == narduccio}
      its(:paternal_grandmother) {should == maria}
      its(:maternal_grandfather) {should == antonio}
      its(:maternal_grandmother) {should == assunta}
      its(:siblings) {pending}
      its(:offspring) {pending}
      its(:half_siblings) {pending}
      its(:descendants) {pending}
      its(:ancestors) {pending}
    end


  end

end
{'fraction_non_alphanumeric': 0.17360565593087196, 'fraction_numerical': 0.0, 'mean_word_length': 3.841254752851711, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 53, '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': '5920076', 'n_tokens_mistral': 1893, 'n_tokens_neox': 1828, 'n_words': 309}