Sha256: 92372174f0f1fe19890fbdd95d81fa5d45b642f2d5d75ef5331b9fa5d5d5aee9

Contents?: true

Size: 425 Bytes

Versions: 15

Compression:

Stored size: 425 Bytes

Contents

# encoding: utf-8

RSpec.describe TTY::Prompt::Question, 'convert custom' do

  subject(:prompt) { TTY::TestPrompt.new }

  it 'converts response with custom conversion' do
    prompt.input << "one,two,three\n"
    prompt.input.rewind
    conversion = proc { |input| input.split(/,\s*/) }
    answer = prompt.ask('Ingredients? (comma sep list)', convert: conversion)
    expect(answer).to eq(['one','two','three'])
  end
end

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
tty-prompt-0.17.2 spec/unit/converters/convert_custom_spec.rb
tty-prompt-0.17.1 spec/unit/converters/convert_custom_spec.rb
tty-prompt-0.17.0 spec/unit/converters/convert_custom_spec.rb
tty-prompt-0.12.0 spec/unit/converters/convert_custom_spec.rb
tty-prompt-0.11.0 spec/unit/converters/convert_custom_spec.rb
tty-prompt-0.10.1 spec/unit/converters/convert_custom_spec.rb
tty-prompt-0.10.0 spec/unit/converters/convert_custom_spec.rb
tty-prompt-0.9.0 spec/unit/converters/convert_custom_spec.rb
tty-prompt-0.8.0 spec/unit/converters/convert_custom_spec.rb
tty-prompt-0.7.1 spec/unit/converters/convert_custom_spec.rb
tty-prompt-0.7.0 spec/unit/converters/convert_custom_spec.rb
tty-prompt-0.6.0 spec/unit/converters/convert_custom_spec.rb
tty-prompt-0.5.0 spec/unit/converters/convert_custom_spec.rb
tty-prompt-0.4.0 spec/unit/converters/convert_custom_spec.rb
tty-prompt-0.3.0 spec/unit/converters/convert_custom_spec.rb