<commit_before>require 'yaml/store'
require_relative '../spec_helper'
require_relative '../../lib/signore/sig_finder'

module Signore describe SigFinder do
  describe '#find_tagged' do
    it 'returns a random Signature by default' do
      store = YAML::Store.new 'spec/fixtures/signatures.yml'
      sigs  = store.transaction(true) { store['signatures'] }
      SigFinder.new(sigs, random: Random.new(1981)).find_tagged.text
        .must_include 'Amateur fighter pilot ignores orders'
      SigFinder.new(sigs, random: Random.new(2009)).find_tagged.text
        .must_include '// sometimes I believe compiler ignores all my comments'
    end
  end
end end
<commit_msg>spec SigFinder a bit more<commit_after>require 'yaml/store'
require_relative '../spec_helper'
require_relative '../../lib/signore/sig_finder'

module Signore describe SigFinder do
  let :sigs do
    store = YAML::Store.new 'spec/fixtures/signatures.yml'
    store.transaction(true) { store['signatures'] }
  end

  describe '#find_tagged' do
    it 'returns a random Signature by default' do
      SigFinder.new(sigs, random: Random.new(1981)).find_tagged.text
        .must_include 'Amateur fighter pilot ignores orders'
      SigFinder.new(sigs, random: Random.new(2009)).find_tagged.text
        .must_include '// sometimes I believe compiler ignores all my comments'
    end

    it 'returns a random signature if the tags are empty' do
      SigFinder.new(sigs, random: Random.new(2013))
        .find_tagged(forbidden_tags: [], required_tags: []).text
        .must_equal '// sometimes I believe compiler ignores all my comments'
    end
  end
end end

{'fraction_non_alphanumeric': 0.10558624923265807, 'fraction_numerical': 0.012277470841006752, 'mean_word_length': 3.5786516853932584, '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': '4417179', 'n_tokens_mistral': 508, 'n_tokens_neox': 483, 'n_words': 140}