<commit_before>require 'rails_helper'

RSpec.describe Offspring, type: :model do
  let(:user1) { FactoryGirl.build(:user) }
  active_record_offspring = 'activerecord.errors.models.offspring.attributes'
  describe "validating belongs_to" do
    it "adds offspring to users" do

    end
  end

  describe "validating attribute first_name " do
    it "is invalid without first_name" do
      off = FactoryGirl.build(:offspring, first_name: "")
      off.valid?
      expect(off.errors[:first_name]).to include(I18n.t('first_name.blank', scope: active_record_offspring))
      off.first_name = "Foo"
      expect(off).to be_valid
    end

    it "is invalid with less than 1 character" do
      off = FactoryGirl.build(:offspring, first_name: 'a')
      off.valid?
      expect(off.errors[:first_name]).to include(I18n.t('first_name.too_short', count:2, scope: active_record_offspring))
      off.first_name = 'aa'
      expect(off).to be_valid
    end

    it "is invalid with more than 60 characters" do
      off = FactoryGirl.build(:offspring, first_name: 'a' * 61)
      off.valid?
      expect(off.errors[:first_name]).to include(I18n.t('first_name.too_long', count:60, scope: active_record_offspring))
      off.first_name = 'a' * 60
      expect(off).to be_valid
    end
  end
  describe "validating attribute last_name " do
    it "is invalid without last_name" do
      off = FactoryGirl.build(:offspring, last_name: "")
      off.valid?<commit_msg>Edited specs<commit_after>require 'rails_helper'

RSpec.describe Offspring, type: :model do
  active_record_offspring = 'activerecord.errors.models.offspring.attributes'
  describe "validating attribute first_name " do
    it "is invalid without first_name" do
      off = FactoryGirl.build(:offspring, first_name: "")
      off.valid?
      expect(off.errors[:first_name]).to include(I18n.t('first_name.blank', scope: active_record_offspring))
      off.first_name = "Foo"
      expect(off).to be_valid
    end

    it "is invalid with less than 1 character" do
      off = FactoryGirl.build(:offspring, first_name: 'a')
      off.valid?
      expect(off.errors[:first_name]).to include(I18n.t('first_name.too_short', count:2, scope: active_record_offspring))
      off.first_name = 'aa'
      expect(off).to be_valid
    end

    it "is invalid with more than 60 characters" do
      off = FactoryGirl.build(:offspring, first_name: 'a' * 61)
      off.valid?
      expect(off.errors[:first_name]).to include(I18n.t('first_name.too_long', count:60, scope: active_record_offspring))
      off.first_name = 'a' * 60
      expect(off).to be_valid
    end
  end
  describe "validating attribute last_name " do
    it "is invalid without last_name" do
      off = FactoryGirl.build(:offspring, last_name: "")
      off.valid?
{'fraction_non_alphanumeric': 0.1127521613832853, 'fraction_numerical': 0.011887608069164265, 'mean_word_length': 3.60530679933665, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '750790', 'n_tokens_mistral': 936, 'n_tokens_neox': 886, 'n_words': 212}