<commit_before>require 'rails_helper'

RSpec.describe Version, :type => :model do
  let!(:zoo) { Service.create(name: "Map of Zoos", description: "Description needs to be 12 characters.", organization_id: 1) }
  let(:zoo_v1) {Version.create(number: 1, service_id: zoo.id, active: true, total_records: 0)}

  describe "#set_total_records" do
    it "sets total records to count of existing records" do
      10.times { zoo_v1.records.create() }
      zoo_v1.set_total_records
      expect(zoo_v1.total_records).to eq(zoo_v1.records.count)
    end
  end
end
<commit_msg>Initial total records set to 0<commit_after>require 'rails_helper'

RSpec.describe Version, :type => :model do
  let(:zoo) { Service.create(name: "Map of Zoos", description: "Description needs to be 12 characters.", organization_id: 1) }
  let(:zoo_v1) {Version.create(number: 1, service_id: zoo.id, active: true)}

  describe "#set_total_records" do
    it "sets total records to count of existing records" do
      10.times { zoo_v1.records.create() }
      zoo_v1.set_total_records
      expect(zoo_v1.total_records).to eq(zoo_v1.records.count)
    end
  end

  describe "#set_initial_total_records" do
    it "sets total records to 0 when a version is created" do
      union = Service.create(name: "The Union", description: "How old are these civil war analogies getting?", organization_id: 1)
      union.make_version
      expect(union.latest_version.total_records).to eq(0)
    end
  end

end

{'fraction_non_alphanumeric': 0.10755616065350579, 'fraction_numerical': 0.018379850238257316, 'mean_word_length': 4.121951219512195, 'pattern_counts': {'":': 0, '<': 3, '<?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': '2983927', 'n_tokens_mistral': 508, 'n_tokens_neox': 479, 'n_words': 140}