Sha256: 4013dbf5ee0ced5e42b504544d874b6a647eb25e5fd12a161dbb08671932ec58

Contents?: true

Size: 450 Bytes

Versions: 8

Compression:

Stored size: 450 Bytes

Contents

# encoding: utf-8

RSpec.describe TTY::Prompt::Question, 'convert path' do
  subject(:prompt) { TTY::TestPrompt.new }

  it "converts pathname" do
    path = double(:path)
    prompt.input << "/path/to/file"
    prompt.input.rewind

    allow(Pathname).to receive(:new).and_return(path)
    expect(Pathname).to receive(:new).with(/path\/to\/file/)

    answer = prompt.ask('File location?', convert: :path)

    expect(answer).to eql(path)
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
tty-prompt-0.12.0 spec/unit/converters/convert_path_spec.rb
tty-prompt-0.11.0 spec/unit/converters/convert_path_spec.rb
tty-prompt-0.10.1 spec/unit/converters/convert_path_spec.rb
tty-prompt-0.10.0 spec/unit/converters/convert_path_spec.rb
tty-prompt-0.9.0 spec/unit/converters/convert_path_spec.rb
tty-prompt-0.8.0 spec/unit/converters/convert_path_spec.rb
tty-prompt-0.7.1 spec/unit/converters/convert_path_spec.rb
tty-prompt-0.7.0 spec/unit/converters/convert_path_spec.rb