<commit_before>require 'spec_helper'

describe Profile do
  it "should not be valid when no reference to user exists" do
    profile = Profile.new
    profile.user = nil
    profile.should_not be_valid
  end
  it "should have versions" do
    user = Factory.build(:user)
    profile = Profile.new
    profile.name = Name.new
    profile.name.first = 'Jack'
    profile.name.last = 'Johnson'
    profile.birthday = '2010-07-01'
    profile.user = user
    profile.save
    profile.version.should == 1
    profile.revise
    profile.birthday = '2010-07-05'
    profile.save
    profile.version.should == 2
    profile.versions.last.birthday.should == Date.parse('2010-07-01')
  end
   it "should create an empty name on initializing" do
     user = Factory.build(:valid_user, :profile => Profile.new)
     user.save
     user.profile.name.should_not be_nil
     user.profile.name.full.should be_nil 
   end
end<commit_msg>spec for saving public profile<commit_after>require 'spec_helper'

describe Profile do
  it "should not be valid when no reference to user exists" do
    profile = Profile.new
    profile.user = nil
    profile.should_not be_valid
  end
  it "should have versions" do
    user = Factory.build(:user)
    profile = Profile.new
    profile.name = Name.new
    profile.name.first = 'Jack'
    profile.name.last = 'Johnson'
    profile.birthday = '2010-07-01'
    profile.user = user
    profile.save
    profile.version.should == 1
    profile.revise
    profile.birthday = '2010-07-05'
    profile.save
    profile.version.should == 2
    profile.versions.last.birthday.should == Date.parse('2010-07-01')
  end
   it "should create an empty name on initializing" do
     user = Factory.build(:valid_user, :profile => Profile.new)
     user.save
     user.profile.name.should_not be_nil
     user.profile.name.full.should be_nil 
   end
   it "should create a public profile on saving" do
     user = Factory.build(:valid_user, :profile => Profile.new)
     user.profile.create_name(:first => "Check", :last => "Bauer" )
     user.save

     user.profile.public_profile.should_not be_nil
     user.profile.public_profile.fullname.should == "<NAME>"
     

   end

end
{'fraction_non_alphanumeric': 0.10302197802197802, 'fraction_numerical': 0.023809523809523808, 'mean_word_length': 2.929856115107914, 'pattern_counts': {'":': 0, '<': 4, '<?xml version=': 0, '>': 9, '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': '1332942', 'n_tokens_mistral': 723, 'n_tokens_neox': 674, 'n_words': 176}