<commit_before># You might need to require 'spec_helper' if you use older version of rspec
# rails_helper and spec_helper used to be one file
require 'rails_helper'

# Let's do some TDD
# Red -> Green -> Refactor

# 1. Write a failing test

# Notice that we use the Dog class here instead of a string
# This is allows us to use the special rspec variable called described_class
# It we use that pattern, we can easily change the class only in one place instead changing it in many places
describe Dog do
  it 'has a name' do
    dog = Dog.create name: 'Boo'
    expect(dog.name).to eq 'Boo'
  end

  it 'requires a name' do
    unnamed_dog = Dog.new

    expect(unnamed_dog.valid?).to eq(false)
    expect(unnamed_dog.errors).to include(:name)
  end
end<commit_msg>Refactor a dog_spec.rb to use described_class<commit_after># You might need to require 'spec_helper' if you use older version of rspec
# rails_helper and spec_helper used to be one file
require 'rails_helper'

# Let's do some TDD
# Red -> Green -> Refactor

# 1. Write a failing test

# Notice that we use the Dog class here instead of a string
# This is allows us to use the special rspec variable called described_class
# It we use that pattern, we can easily change the class only in one place instead changing it in many places
describe Dog do
  it 'has a name' do
    dog = described_class.create name: 'Boo'
    expect(dog.name).to eq 'Boo'
  end

  it 'requires a name' do
    unnamed_dog = described_class.new

    expect(unnamed_dog.valid?).to eq(false)
    expect(unnamed_dog.errors).to include(:name)
  end
end
{'fraction_non_alphanumeric': 0.06746532156368222, 'fraction_numerical': 0.0012610340479192938, 'mean_word_length': 3.737313432835821, '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': '3184295', 'n_tokens_mistral': 493, 'n_tokens_neox': 474, 'n_words': 224}