File: test_question_asker.rb

package info (click to toggle)
ruby-highline 3.1.2-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 800 kB
  • sloc: ruby: 5,789; sh: 7; makefile: 4
file content (22 lines) | stat: -rw-r--r-- 473 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
# encoding: utf-8

require "test_helper"

class TestQuestion < Minitest::Test
  def setup
    @input    = StringIO.new
    @output   = StringIO.new
    @highline = HighLine.new(@input, @output)

    @question = HighLine::Question.new("How are you?", nil)
    @asker    = HighLine::QuestionAsker.new(@question, @highline)
  end

  def test_ask_once
    answer = "Very good, thanks for asking!"

    @input.string = answer

    assert_equal answer, @asker.ask_once
  end
end