summaryrefslogtreecommitdiff
path: root/test/test_question_asker.rb
blob: 28ab47a11a6064d556de0bcddeaf3cdb63d20b3a (plain)
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