<commit_before># encoding: utf-8

require 'fileutils'

RSpec.describe TTY::Prompt::Question, 'convert file' do
  it "converts to file" do
    ::File.write('test.txt', 'foobar')
    prompt = TTY::TestPrompt.new
    prompt.input << "test.txt"
    prompt.input.rewind

    answer = prompt.ask("Which file to open?", convert: :file)

    expect(::File.basename(answer)).to eq('test.txt')
    expect(::File.read(answer)).to eq('foobar')

    FileUtils.rm(::File.join(Dir.pwd, 'test.txt'))
  end
end<commit_msg>Change to fix windows file deletion<commit_after># encoding: utf-8

RSpec.describe TTY::Prompt::Question, 'convert file' do
  it "converts to file" do
    file = ::File.open('test.txt', 'w')
    file.write('foobar')
    file.close

    prompt = TTY::TestPrompt.new
    prompt.input << "test.txt"
    prompt.input.rewind

    answer = prompt.ask("Which file to open?", convert: :file)

    expect(::File.basename(answer)).to eq('test.txt')
    expect(::File.read(answer)).to eq('foobar')

    ::File.delete(file)
  end
end
{'fraction_non_alphanumeric': 0.1705653021442495, 'fraction_numerical': 0.001949317738791423, 'mean_word_length': 3.8443396226415096, 'pattern_counts': {'":': 0, '<': 7, '<?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': '2127494', 'n_tokens_mistral': 371, 'n_tokens_neox': 354, 'n_words': 78}