<commit_before>describe EmailProcessor do
  describe "#process" do
    it "creates an entry based on the email" do
      user = create(:user)
      email = double('email', from: { email: user.email }, body: "I am great")

      EmailProcessor.new(email).process

      expect(user.newest_entry.body).to eq("I am great")
    end

    context "when a user can't be found" do
      it "raises an exception" do
        user = create(:user)
        email = double('email', from: { email: "<EMAIL>" })

        expect do
          EmailProcessor.new(email).process
        end.to raise_error(ActiveRecord::RecordNotFound)
      end
    end

    context "when the entry can't be created" do
      it "raises an exception" do
        user = create(:user)
        email = double('email', from: { email: user.email }, body: nil)

        expect do
          EmailProcessor.new(email).process
        end.to raise_error(ActiveRecord::StatementInvalid)
      end
    end
  end
end<commit_msg>Test ActiveRecordError instead<commit_after>describe EmailProcessor do
  describe "#process" do
    it "creates an entry based on the email" do
      user = create(:user)
      email = double('email', from: { email: user.email }, body: "I am great")

      EmailProcessor.new(email).process

      expect(user.newest_entry.body).to eq("I am great")
    end

    context "when a user can't be found" do
      it "raises an exception" do
        user = create(:user)
        email = double('email', from: { email: "<EMAIL>" })

        expect do
          EmailProcessor.new(email).process
        end.to raise_error(ActiveRecord::RecordNotFound)
      end
    end

    context "when the entry can't be created" do
      it "raises an exception" do
        user = create(:user)
        email = double('email', from: { email: user.email }, body: nil)

        expect do
          EmailProcessor.new(email).process
        end.to raise_error(ActiveRecord::ActiveRecordError)
      end
    end
  end
end
{'fraction_non_alphanumeric': 0.10414560161779575, 'fraction_numerical': 0.0, 'mean_word_length': 2.5150976909413854, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, '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': '1866497', 'n_tokens_mistral': 572, 'n_tokens_neox': 553, 'n_words': 181}