<commit_before>require 'tempfile'
require 'spec_helper'
require 'github/auth'

describe Github::Auth::KeysFile do
  it 'writes and deletes keys from the keys file' do
    tempfile  = Tempfile.new 'authorized_keys'
    keys_file = described_class.new path: tempfile.path
    keys      = %w(<KEY>)

    keys_file.write! keys
    expect(tempfile.read).to include keys.join("\n")

    keys_file.delete! keys.first
    expect(tempfile.read).to_not include keys.first

    keys_file.delete! keys.last
    expect(tempfile.read).to_not include keys.last

    expect(tempfile.read).to be_empty
  end
end<commit_msg>Test that keys not deleted are still in keys file<commit_after>require 'tempfile'
require 'spec_helper'
require 'github/auth'

describe Github::Auth::KeysFile do
  it 'writes and deletes keys from the keys file' do
    tempfile  = Tempfile.new 'authorized_keys'
    keys_file = described_class.new path: tempfile.path
    keys      = %w(<KEY>)

    keys_file.write! keys
    expect(tempfile.read).to include keys.join("\n")

    tempfile.rewind

    keys_file.delete! keys.first
    tempfile.read.tap do |tempfile_content|
      expect(tempfile_content).to_not include keys.first
      expect(tempfile_content).to include keys.last
    end

    tempfile.rewind

    keys_file.delete! keys.last
    expect(tempfile.read).to be_empty
  end
end
{'fraction_non_alphanumeric': 0.09502598366740905, 'fraction_numerical': 0.0, 'mean_word_length': 3.6643598615916955, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, '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': '4255054', 'n_tokens_mistral': 442, 'n_tokens_neox': 427, 'n_words': 108}