summaryrefslogtreecommitdiff
path: root/test/test_simulator.rb
blob: efbebf072cfc5d580828ff5ac4ea82965378f1a5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# encoding: utf-8

require "test_helper"

require "highline/import"
require "highline/simulate"

class SimulatorTest < Minitest::Test
  def setup
    input     = StringIO.new
    output    = StringIO.new
    HighLine.default_instance = HighLine.new(input, output)
  end

  def test_simulator
    HighLine::Simulate.with("Bugs Bunny", "18") do
      name = ask("What is your name?")

      assert_equal "Bugs Bunny", name

      age = ask("What is your age?")

      assert_equal "18", age
    end
  end
end