<commit_before># == Schema Information
#
# Table name: report_types
#
#  id            :integer          not null, primary key
#  abbr          :string           not null
#  full_name     :string           not null
#  class_name    :string           not null
#  custom_report :boolean          default(FALSE)
#  seq_id        :integer          not null
#

require 'rails_helper'

RSpec.describe ReportType, type: :model do


  it { should have_many(:reports) }

  describe 'custom scope' do

    before do
      ReportType.destroy_all
    end

    it 'returns only closed cases in most recently closed first' do
      create :report_type
      custom_report_1 = create :report_type, custom_report: true
      custom_report_2 = create :report_type, custom_report: true
      expect(ReportType.custom).to match_array [ custom_report_1, custom_report_2 ]
    end
  end

  describe '#filename' do
    it 'formats the class name into a filename' do
      r003 = find_or_create :r003_report_type
      expect(r003.filename).to eq 'r003_business_unit_performance_report.csv'
    end
  end
end
<commit_msg>CT-1234 add spec for ReportType#class_constant<commit_after># == Schema Information
#
# Table name: report_types
#
#  id            :integer          not null, primary key
#  abbr          :string           not null
#  full_name     :string           not null
#  class_name    :string           not null
#  custom_report :boolean          default(FALSE)
#  seq_id        :integer          not null
#

require 'rails_helper'

RSpec.describe ReportType, type: :model do


  it { should have_many(:reports) }

  describe 'custom scope' do

    before do
      ReportType.destroy_all
    end

    it 'returns only closed cases in most recently closed first' do
      create :report_type
      custom_report_1 = create :report_type, custom_report: true
      custom_report_2 = create :report_type, custom_report: true
      expect(ReportType.custom).to match_array [ custom_report_1, custom_report_2 ]
    end
  end

  describe '#class_constant' do
    it 'returns the report class name as a constant' do
      r003 = create :r003_report_type
      expect(r003.class_constant)
        .to eq Stats::R003BusinessUnitPerformanceReport
    end
  end

  describe '#filename' do
    it 'formats the class name into a filename' do
      r003 = find_or_create :r003_report_type
      expect(r003.filename).to eq 'r003_business_unit_performance_report.csv'
    end
  end
end

{'fraction_non_alphanumeric': 0.06463414634146342, 'fraction_numerical': 0.01951219512195122, 'mean_word_length': 2.6513353115727, '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': '4915652', 'n_tokens_mistral': 769, 'n_tokens_neox': 717, 'n_words': 224}