Sha256: 949acfe79365948673f3f62946b1d269525ae048324767672a7f4f4f0c6f2ade

Contents?: true

Size: 444 Bytes

Versions: 5

Compression:

Stored size: 444 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

5 entries across 5 versions & 1 rubygems

Version Path
tty-prompt-0.10.0 spec/unit/converters/convert_file_spec.rb
tty-prompt-0.9.0 spec/unit/converters/convert_file_spec.rb
tty-prompt-0.8.0 spec/unit/converters/convert_file_spec.rb
tty-prompt-0.7.1 spec/unit/converters/convert_file_spec.rb
tty-prompt-0.7.0 spec/unit/converters/convert_file_spec.rb