<commit_before>require 'spec/spec_helper'

module Family
  describe Address do
    it "should serialize an address" do
      a = Address.new(:street1 => '16 Elm St', :city => 'Peoria', :state => 'IL')
      j = JSON[a.to_json]
      j.street1.should == a.street1
      j.city.should == a.city
      j.state.should == a.state
    end
  end
  
  describe Household do
    it "should serialize the address" do
      a = Address.new(:street1 => '16 Elm St', :city => 'Peoria', :state => 'IL')
      h = Household.new(:address => a)
      j = JSON[h.to_json]
      j.address.street1.should == a.street1
      j.address.city.should == a.city
      j.address.state.should == a.state
    end
  end
  
  describe Parent do
    it "should serialize the children" do
      p = Parent.new(:name => 'Oscar')
      c = Child.new(:name => 'Beauregard', :parents => [p])
      p.children << c
      j = JSON[p.to_json]
      j.children.first.name.should == c.name
    end
  end
  
  describe Child do
    it "should only serialize the owner key" do
      h = Household.new
      p = Parent.new(:name => 'Oscar', :household => h)
      c = Child.new(:name => 'Beauregard', :parents => [p])
      p.children << c
      j = JSON[c.to_json]
      j.parents.first.name.should be nil
      j.parents.first.household.should be nil
    end
  end
end
<commit_msg>Cosmetic changes.<commit_after>require 'spec/spec_helper'

module Family
  describe Address do
    it 'should serialize an address' do
      addr = Address.new(:street1 => '16 Elm St', :city => 'Peoria', :state => 'IL')
      j = JSON[addr.to_json]
      j.street1.should == addr.street1
      j.city.should == addr.city
      j.state.should == addr.state
    end
  end
  
  describe Household do
    it 'should serialize the address' do
      addr = Address.new(:street1 => '16 Elm St', :city => 'Peoria', :state => 'IL')
      hshd = Household.new(:address => addr)
      j = JSON[hshd.to_json]
      j.address.street1.should == addr.street1
      j.address.city.should == addr.city
      j.address.state.should == addr.state
    end
  end
  
  describe Parent do
    it 'should serialize the children' do
      p = Parent.new(:name => 'Oscar')
      c = Child.new(:name => 'Beauregard', :parents => [p])
      p.children << c
      j = JSON[p.to_json]
      j.children.first.name.should == c.name
    end
  end
  
  describe Child do
    it 'should serialize the parent' do
      hshd = Household.new
      p = Parent.new(:name => 'Oscar', :household => hshd)
      c = Child.new(:name => 'Beauregard', :parents => [p])
      p.children << c
      j = JSON[c.to_json]
      j.parents.first.name.should_not be nil
      j.parents.first.household.should_not be nil
    end
    
    describe 'Date' do
      it 'should serialize a Java date as a Ruby date' do
        date = Java.now
        j = JSON[date.to_json]
        j.should be_within(0.005).of(date.to_ruby_date)
      end
    end
  end
end

{'fraction_non_alphanumeric': 0.1338100102145046, 'fraction_numerical': 0.008171603677221655, 'mean_word_length': 2.3085585585585586, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 31, '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': '6577366', 'n_tokens_mistral': 1029, 'n_tokens_neox': 1004, 'n_words': 269}