<commit_before>require 'spec_helper'

describe Problem do

  subject { Problem.new }

  it { should respond_to(:title) }
  it { should respond_to(:record_num) }
  it { should respond_to(:record_type) }
  it { should respond_to(:description) }

  it "is valid with title" do
    expect(build(:problem, title: 'My Title')).to be_valid
  end

  it "is invalid without title" do
    expect(build(:problem, title: nil)).to be_invalid
  end

  it "is valid with record number" do
    expect(build(:problem, record_num: 12345678)).to be_valid
  end

  it "is invalid without record number" do
    expect(build(:problem, record_num: nil)).to be_invalid
  end

  it "is valid with record_type" do
    expect(build(:problem, record_type: 'o')).to be_valid
  end

  it "is invalid wihtout record_type" do 
    expect(build(:problem, record_type: nil)).to be_invalid
  end

  it "is valid with description" do
    expect(build(:problem, description: 'My Text')).to be_valid
  end

  it "is invalid without description" do
    expect(build(:problem, description: nil)).to be_invalid
  end
end<commit_msg>add spec for blankrdate problem<commit_after>require 'spec_helper'

describe BlankRdate do

  class OrderRecord < Struct.new(:order_status_code, :order_date_gmt, :received_date_gmt, :bib_view, :acq_type_code, :record_type_code)
  end

  class OrderRecordMetadata < Struct.new(:cataloging_date_gmt, :title)
  end
  
  it "is valid if record matches query" do
    order_records = [OrderRecord.new('a', DateTime.parse('2001-01-01'), nil, OrderRecordMetadata.new(DateTime.parse('2001-01-01'), 'test title'), 'p', 'o')]
    OrderView.stub(:where).and_return(order_records)
    record = BlankRdate.new(record_num: 907215)
    record.should be_valid
  end

  it "is invalid if record doesn't match query" do
    order_records = [OrderRecord.new('m', DateTime.parse('2001-01-01'), DateTime.parse('2001-01-01'), OrderRecordMetadata.new(DateTime.parse('2001-01-01'), 'test title'), 'p', 'o')]
    OrderView.stub(:where).and_return(order_records)
    record = BlankRdate.new(record_num: 907215)
    record.should_not be_valid
  end
end
{'fraction_non_alphanumeric': 0.11962174940898346, 'fraction_numerical': 0.028368794326241134, 'mean_word_length': 4.58311345646438, 'pattern_counts': {'":': 0, '<': 5, '<?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': '6323002', 'n_tokens_mistral': 752, 'n_tokens_neox': 686, 'n_words': 184}