Sha256: a75100fe0e02813d6359627fcdb8aa4600cd48258e76f3ead91fe10d27abf5a4
Contents?: true
Size: 506 Bytes
Versions: 2
Compression:
Stored size: 506 Bytes
Contents
require "minitest/autorun" require "shenanigans/kernel/prompt" require "stringio" class Prompt < Minitest::Test def setup @orig_stdin = $stderr @orig_stdout = $stdout $stdin = StringIO.new("42\n") $stdout = StringIO.new end def teardown $stdin = @orig_stdin $stdout = @orig_stdout end def test_prompt result = prompt("Foo> ") assert result == "42" end def test_prompt_with_conversion result = prompt("Foo> ", :to_f) assert result == 42.0 end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
shenanigans-1.0.15 | test/kernel/prompt_test.rb |
shenanigans-1.0.14 | test/kernel/prompt_test.rb |