<commit_before>describe Member do
  describe 'instance' do
    it { should have_many :referrals }
    it { should allow_mass_assignment_of :first_name }
    it { should allow_mass_assignment_of :last_name }
    it { should allow_mass_assignment_of :email }
    it { should allow_mass_assignment_of :country_code }
    it { should allow_mass_assignment_of :state_code }
    it { should validate_presence_of :first_name }
    it { should validate_presence_of :last_name }
    it { should validate_presence_of :email }

    describe '#has_signed?' do
      let(:petition) { stub(:id => 42) }
      before { subject.stub_chain(:signatures, :where).and_return [signature] }

      context 'before signing a petition' do
        let(:signature) { nil }
        it { should_not have_signed petition }
      end

      context 'after signing a petition' do
        let(:signature) { anything }
        it { should have_signed petition }
      end
    end

    describe '#to_hash' do
      let(:id) { subject.id }
      before { MemberHasher.stub(:generate).with(id).and_return 'foo' }
      specify { subject.to_hash.should eql 'foo' }
    end

    describe '#full_name' do
      subject { build :member }
      specify { subject.full_name.should include subject.first_name }
      specify { subject.full_name.should include subject.last_name }
    end

    describe '#signature_for' do
      let(:petition) { build :petition, :id => 5 }
      let(:signature) { build :signature }

      before do
        subject.signatures.stub(:where).with(petition_id:5).and_return result
      end<commit_msg>improves assertion<commit_after>describe Member do
  describe 'instance' do
    it { should have_many :referrals }
    it { should allow_mass_assignment_of :first_name }
    it { should allow_mass_assignment_of :last_name }
    it { should allow_mass_assignment_of :email }
    it { should allow_mass_assignment_of :country_code }
    it { should allow_mass_assignment_of :state_code }
    it { should validate_presence_of :first_name }
    it { should validate_presence_of :last_name }
    it { should validate_presence_of :email }

    describe '#has_signed?' do
      let(:petition) { stub(:id => 42) }
      before { subject.stub_chain(:signatures, :where).and_return [signature] }

      context 'before signing a petition' do
        let(:signature) { nil }
        it { should_not have_signed petition }
      end

      context 'after signing a petition' do
        let(:signature) { anything }
        it { should have_signed petition }
      end
    end

    describe '#to_hash' do
      let(:id) { subject.id }
      before { MemberHasher.stub(:generate).with(id).and_return 'foo' }
      its(:to_hash) { should eql 'foo' }
    end

    describe '#full_name' do
      subject { build :member }
      specify { subject.full_name.should include subject.first_name }
      specify { subject.full_name.should include subject.last_name }
    end

    describe '#signature_for' do
      let(:petition) { build :petition, :id => 5 }
      let(:signature) { build :signature }

      before do
        subject.signatures.stub(:where).with(petition_id:5).and_return result
      end
{'fraction_non_alphanumeric': 0.09297195083517176, 'fraction_numerical': 0.0025212732429877086, 'mean_word_length': 2.9974811083123427, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 7, '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': '3485723', 'n_tokens_mistral': 964, 'n_tokens_neox': 941, 'n_words': 246}