summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorDan Allen <dan.j.allen@gmail.com>2019-04-01 01:41:31 -0600
committerGitHub <noreply@github.com>2019-04-01 01:41:31 -0600
commitd7e2845bd4d7725dcbc74e36c42facbbb90db4e4 (patch)
tree84b4fc1238df718290fd936eb32f8b82776ab0fd /test
parent5c32e8826a326a3363acb91bdb72ed90d5c4fcbb (diff)
resolves #3226 CLI should use $stdin instead of STDIN (PR #3227)
Diffstat (limited to 'test')
-rw-r--r--test/invoker_test.rb18
1 files changed, 11 insertions, 7 deletions
diff --git a/test/invoker_test.rb b/test/invoker_test.rb
index 09320711..9a862108 100644
--- a/test/invoker_test.rb
+++ b/test/invoker_test.rb
@@ -70,15 +70,19 @@ context 'Invoker' do
end
test 'should not fail to rewind input if reading document from stdin' do
- io = STDIN.dup
- class << io
- def read
- 'paragraph'
+ begin
+ $stdin = STDIN.dup
+ class << $stdin
+ def read
+ 'paragraph'
+ end
end
+ invoker = invoke_cli_to_buffer(%w(-s), '-')
+ assert_equal 0, invoker.code
+ assert_equal 1, invoker.document.blocks.size
+ ensure
+ $stdin = STDIN
end
- invoker = invoke_cli_to_buffer(%w(-s), '-') { io }
- assert_equal 0, invoker.code
- assert_equal 1, invoker.document.blocks.size
end
test 'should accept document from stdin and write to output file' do