<commit_before>require "spec_helper"

describe Duplicati::Clean do

  context "#initialize" do
    it "raises an Exception if backup store path is not provided" do
      expect {
        Duplicati::Clean.new(:backup_paths => [])
      }.to raise_error(RuntimeError, ":backup_store_path option is missing!")
    end
  end

  context "#command" do

    it "generates clean command for Duplicati using different options" do
      Duplicati::Clean.new(
        :duplicati_path => "/bin/duplicati-commandline",
        :backup_store_path => "file:///foo/backup",
        :log_path => "/zzz/output.log"
      ).command.should == %Q["/bin/duplicati-commandline" delete-all-but-n 2 "file:///foo/backup"
             --no-encryption
             --force
             1>>"/zzz/output.log"
             2>&1]
    end

    it "generates clean command for Duplicati using backup encryption" do
      Duplicati::Clean.new(
        :duplicati_path => "/bin/duplicati-commandline",
        :backup_store_path => "file:///foo/backup",
        :backup_encryption_key => "foobar",
        :log_path => "/zzz/output.log"
      ).command.should == %Q["/bin/duplicati-commandline" delete-all-but-n 2 "file:///foo/backup"
             --passphrase="<PASSWORD>"
             --force
             1>>"/zzz/output.log"
             2>&1]
    end

  end
end<commit_msg>Fix spec.<commit_after>require "spec_helper"

describe Duplicati::Clean do

  context "#initialize" do
    it "raises an Exception if backup store path is not provided" do
      expect {
        Duplicati::Clean.new(:backup_paths => [])
      }.to raise_error(RuntimeError, ":backup_store_path option is missing!")
    end
  end

  context "#command" do

    it "generates clean command for Duplicati using different options" do
      Duplicati::Clean.new(
        :duplicati_path => "/bin/duplicati-commandline",
        :backup_store_path => "file:///foo/backup",
        :log_path => "/zzz/output.log"
      ).command.should == %Q["/bin/duplicati-commandline" delete-all-but-n 1 "file:///foo/backup"
             --no-encryption
             --force
             1>>"/zzz/output.log"
             2>&1]
    end

    it "generates clean command for Duplicati using backup encryption" do
      Duplicati::Clean.new(
        :duplicati_path => "/bin/duplicati-commandline",
        :backup_store_path => "file:///foo/backup",
        :backup_encryption_key => "foobar",
        :log_path => "/zzz/output.log"
      ).command.should == %Q["/bin/duplicati-commandline" delete-all-but-n 1 "file:///foo/backup"
             --passphrase="<PASSWORD>"
             --force
             1>>"/zzz/output.log"
             2>&1]
    end

  end
end
{'fraction_non_alphanumeric': 0.13992537313432835, 'fraction_numerical': 0.005970149253731343, 'mean_word_length': 2.2815177478580173, 'pattern_counts': {'":': 2, '<': 5, '<?xml version=': 0, '>': 33, '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': '5873110', 'n_tokens_mistral': 858, 'n_tokens_neox': 833, 'n_words': 182}