summaryrefslogtreecommitdiff
path: root/test/test_simulator.rb
blob: f22abe61e5c684ae343e2bd8e4a85ae670462d7b (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
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