<commit_before>require 'spec_helper'

describe Signature do
  context "validation" do
    subject { build(:signature) }
    it { should validate_presence_of :email }
    it { should validate_presence_of :name }
    it_behaves_like "email validator"
  end

  context "given a really long user agent" do
    it "truncates it to 255 characters" do
      signature = build(:signature, user_agent: "0" * 512)
      signature.save!
      signature.user_agent.length.should == 255
    end
  end

  it "should allow only predefined types of references" do
    Signature.new(:name => "bob" , :email => "<EMAIL>", :reference_type => "facebook").valid?.should == true
    Signature.new(:name => "bob" , :email => "<EMAIL>", :reference_type => "email" ).valid?.should == true
    Signature.new(:name => "bob" , :email => "<EMAIL>", :reference_type => "twitter" ).valid?.should == true
    Signature.new(:name => "bob" , :email => "<EMAIL>", :reference_type => "wrong" ).valid?.should == false
  end
end<commit_msg>Fixed signature test for fb like ref type<commit_after>require 'spec_helper'

describe Signature do
  context "validation" do
    subject { build(:signature) }
    it { should validate_presence_of :email }
    it { should validate_presence_of :name }
    it_behaves_like "email validator"
  end

  context "given a really long user agent" do
    it "truncates it to 255 characters" do
      signature = build(:signature, user_agent: "0" * 512)
      signature.save!
      signature.user_agent.length.should == 255
    end
  end

  it "should allow only predefined types of references" do
    Signature.new(:name => "bob" , :email => "<EMAIL>", :reference_type => "facebook_like").valid?.should == true
    Signature.new(:name => "bob" , :email => "<EMAIL>", :reference_type => "email" ).valid?.should == true
    Signature.new(:name => "bob" , :email => "<EMAIL>", :reference_type => "twitter" ).valid?.should == true
    Signature.new(:name => "bob" , :email => "<EMAIL>", :reference_type => "wrong" ).valid?.should == false
  end
end
{'fraction_non_alphanumeric': 0.14727540500736377, 'fraction_numerical': 0.009818360333824251, 'mean_word_length': 3.8523809523809525, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 35, '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': '944651', 'n_tokens_mistral': 653, 'n_tokens_neox': 599, 'n_words': 184}