<commit_before>require 'spec_helper'
require 'compo'

describe Compo::Parentless do
  let(:child) { double(:child) }

  describe '#add!' do
    it 'returns the given child exactly' do
      expect(subject.add!(:id, child)).to be(child)
    end
  end

  describe '#remove' do
    it 'returns the given child exactly' do
      expect(subject.remove(child)).to be(child)
    end<commit_msg>Allow and expect #remove_parent.<commit_after>require 'spec_helper'
require 'compo'

describe Compo::Parentless do
  let(:child) { double(:child) }

  describe '#add' do
    before(:each) do
      allow(child).to receive(:remove_parent)
    end

    it 'returns the given child exactly' do
      expect(subject.add(:id, child)).to be(child)
    end

    it 'sends #remove_parent to the given child' do
      expect(child).to receive(:remove_parent).with(no_args)
      subject.add(:id, child)
    end
  end

  describe '#remove' do
    it 'returns the given child exactly' do
      expect(subject.remove(child)).to be(child)
    end
{'fraction_non_alphanumeric': 0.11776251226692837, 'fraction_numerical': 0.0, 'mean_word_length': 3.533333333333333, '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': '2064090', 'n_tokens_mistral': 323, 'n_tokens_neox': 314, 'n_words': 94}