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 18:43:42 -0300
commitdea6a46a3e8a66f3ed0da4dad0cc81975151c73f (patch)
treee12b8fcc80b45919533840318de4ec4db2046979
parent60bfde3967cf38cc3ecbba308043ddae2066bc7d (diff)
downloadhighline-dea6a46a3e8a66f3ed0da4dad0cc81975151c73f.tar.gz
Add tests for HighLine::Simulator - Issue #142
As suggested by @bparanj on https://github.com/JEG2/highline/issues/142
-rw-r--r--test/tc_simulator.rb23
1 files changed, 23 insertions, 0 deletions
diff --git a/test/tc_simulator.rb b/test/tc_simulator.rb
new file mode 100644
index 0000000..ac81748
--- /dev/null
+++ b/test/tc_simulator.rb
@@ -0,0 +1,23 @@
+require 'test/unit'
+require 'highline/import'
+require 'highline/simulate'
+
+class SimulatorTest < Test::Unit::TestCase
+ 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