Sha256: 25526ca0770f9c0c874a18ea58f45d5334c2726076c07c088447832196c0a30e

Contents?: true

Size: 448 Bytes

Versions: 3

Compression:

Stored size: 448 Bytes

Contents

# encoding: utf-8

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

    allow(::File).to receive(:open).with(/test\.txt/).and_return(file)
    expect(::File).to receive(:open).with(/test\.txt/)

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

    expect(answer).to eq(file)
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
tty-prompt-0.12.0 spec/unit/converters/convert_file_spec.rb
tty-prompt-0.11.0 spec/unit/converters/convert_file_spec.rb
tty-prompt-0.10.1 spec/unit/converters/convert_file_spec.rb