<commit_before>require 'spec_helper'

describe Node do

  subject { build :node, title: "Example Title",
                         description: "Example description",
                         contact: "Example contact",
                         email: "<EMAIL>" }

  its(:title) { should eq "Example Title" }
  its(:description) { should eq "Example description" }
  its(:contact) { should eq "Example contact" }
  its(:email) { should eq "<EMAIL>" }
  it("with valid attributes should be valid") { should be_valid }

  [:title, :description, :contact, :email].each do |attr|
    it "blank #{attr} is not valid" do
      subject.send("#{attr}=", "")
      subject.should_not be_valid
    end
  end

  describe "#email" do
    it do
      subject.email = "unvalid_email@example"
      subject.should_not be_valid
      expect(subject.errors.messages).to be_has_key :email
    end

    it do
      subject.email = "<EMAIL>"
      subject.should be_valid
      expect(subject.errors.messages).not_to be_has_key :email<commit_msg>better array<commit_after>require 'spec_helper'

describe Node do

  subject { build :node, title: "Example Title",
                         description: "Example description",
                         contact: "Example contact",
                         email: "<EMAIL>" }

  its(:title) { should eq "Example Title" }
  its(:description) { should eq "Example description" }
  its(:contact) { should eq "Example contact" }
  its(:email) { should eq "<EMAIL>" }
  it("with valid attributes should be valid") { should be_valid }

  %w(title description contact email).each do |attr|
    it "blank #{attr} is not valid" do
      subject.send("#{attr}=", "")
      subject.should_not be_valid
    end
  end

  describe "#email" do
    it do
      subject.email = "unvalid_email@example"
      subject.should_not be_valid
      expect(subject.errors.messages).to be_has_key :email
    end

    it do
      subject.email = "<EMAIL>"
      subject.should be_valid
      expect(subject.errors.messages).not_to be_has_key :email
{'fraction_non_alphanumeric': 0.11448140900195694, 'fraction_numerical': 0.0, 'mean_word_length': 2.6387900355871885, 'pattern_counts': {'":': 0, '<': 9, '<?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': '2193786', 'n_tokens_mistral': 594, 'n_tokens_neox': 575, 'n_words': 172}