summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAbinoam Praxedes Marques Jr <abinoam@gmail.com>2015-06-29 18:41:13 -0300
committerAbinoam Praxedes Marques Jr <abinoam@gmail.com>2015-06-29 22:39:13 -0300
commit88978cd2ff5da525f4feb81abcf32767e40790fa (patch)
treea6c353544c203e4e1ccf4b33436c6fae8d3d6fcc
parent73bb8790d499bb7d5ad6b1205e13d917e12bae38 (diff)
downloadhighline-88978cd2ff5da525f4feb81abcf32767e40790fa.tar.gz
Add tests for HighLine::Simulator - Issue #142
As suggested by @bparanj on https://github.com/JEG2/highline/issues/142 Note: cherry picked from master and adapted to develop branch.
-rw-r--r--test/test_simulator.rb25
1 files changed, 25 insertions, 0 deletions
diff --git a/test/test_simulator.rb b/test/test_simulator.rb
new file mode 100644
index 0000000..15691d9
--- /dev/null
+++ b/test/test_simulator.rb
@@ -0,0 +1,25 @@
+require "minitest/autorun"
+require "test_helper"
+
+require "highline/import"
+require "highline/simulate"
+
+class SimulatorTest < Minitest::Test
+ def setup
+ input = StringIO.new
+ output = StringIO.new
+ $terminal = 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 \ No newline at end of file