<commit_before>require "spec_helper"

describe Terragov::Cleaner do
  describe "delete" do
  end
end<commit_msg>Add spec for cleaner<commit_after>require "spec_helper"

describe Terragov::Cleaner do
  describe "delete" do
    path = File.expand_path("spec/mocks")
    pattern = /foo\.txt/
    test_file = File.join(path, "foo.txt")

    it "should exit if no matching files found" do
      expect { Terragov::Cleaner.new.delete(path, 'some_fake_pattern', true) }.to raise_error(SystemExit)
    end

    it "should delete files matching pattern in a given path (with force option)" do
      File.write(test_file, "foo")
      expect { Terragov::Cleaner.new.delete(path, pattern, true) }.to output(/Done/).to_stdout
      expect(File.exist?(test_file)).to be false
    end
  end
end
{'fraction_non_alphanumeric': 0.11282051282051282, 'fraction_numerical': 0.0, 'mean_word_length': 3.88125, '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': '471312', 'n_tokens_mistral': 257, 'n_tokens_neox': 251, 'n_words': 71}