<commit_before>require 'spec_helper'

describe BqFactory::TableRegistory do
  describe '#register' do
    subject { described_class.new.register(name, table) }
    let(:table) { double('Table') }
    let(:name)  { :dummy_table }

    context 'when not registered table' do
      before { allow_any_instance_of(described_class).to receive(:registered?).and_return(false) }
      it { expect { subject }.not_to raise_error }
    end

    context 'when registered table' do
      before { allow_any_instance_of(described_class).to receive(:registered?).and_return(true) }
      it { expect { subject }.to raise_error BqFactory::DuplicateDefinitionError }
    end
  end
end<commit_msg>Refactor TableRegistory spec<commit_after>require 'spec_helper'

describe BqFactory::TableRegistory do
  let(:table_registory) { described_class.new }

  describe '#register' do
    subject { table_registory.register(name, table) }
    let(:table) { double('Table') }
    let(:name)  { :dummy_table }

    context 'when not registered table' do
      before { allow(table_registory).to receive(:registered?).and_return(false) }
      it { expect { subject }.not_to raise_error }
    end

    context 'when registered table' do
      before { allow(table_registory).to receive(:registered?).and_return(true) }
      it { expect { subject }.to raise_error BqFactory::DuplicateDefinitionError }
    end
  end
end
{'fraction_non_alphanumeric': 0.10719424460431655, 'fraction_numerical': 0.0, 'mean_word_length': 4.151851851851852, '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': '2258494', 'n_tokens_mistral': 431, 'n_tokens_neox': 406, 'n_words': 97}