Class: MarkdownExec::PromptForFilespecWithWildcardTest
- Inherits:
-
Minitest::Test
- Object
- Minitest::Test
- MarkdownExec::PromptForFilespecWithWildcardTest
- Defined in:
- lib/hash_delegator.rb
Defined Under Namespace
Modules: PathUtils
Class Method Summary collapse
Instance Method Summary collapse
- #setup ⇒ Object
- #teardown ⇒ Object
- #test_prompt_for_filespec_with_empty_input ⇒ Object
- #test_prompt_for_filespec_with_interruption ⇒ Object
- #test_prompt_for_filespec_with_normal_input ⇒ Object
Class Method Details
Instance Method Details
#setup ⇒ Object
5221 5222 5223 5224 5225 5226 5227 |
# File 'lib/hash_delegator.rb', line 5221 def setup @delegate_object = { prompt_show_expr_format: 'Current expression: %{expr}', prompt_enter_filespec: 'Please enter a filespec:' } @original_stdin = $stdin end |
#teardown ⇒ Object
5229 5230 5231 |
# File 'lib/hash_delegator.rb', line 5229 def teardown $stdin = @original_stdin end |
#test_prompt_for_filespec_with_empty_input ⇒ Object
5246 5247 5248 5249 5250 |
# File 'lib/hash_delegator.rb', line 5246 def test_prompt_for_filespec_with_empty_input $stdin = StringIO.new("\n") result = prompt_for_filespec_with_wildcard('*.txt') assert_equal 'resolved_path_or_substituted_value', result end |
#test_prompt_for_filespec_with_interruption ⇒ Object
5239 5240 5241 5242 5243 5244 |
# File 'lib/hash_delegator.rb', line 5239 def test_prompt_for_filespec_with_interruption $stdin = StringIO.new def $stdin.gets; raise Interrupt; end result = prompt_for_filespec_with_wildcard('*.txt') assert_nil result end |
#test_prompt_for_filespec_with_normal_input ⇒ Object
5233 5234 5235 5236 5237 |
# File 'lib/hash_delegator.rb', line 5233 def test_prompt_for_filespec_with_normal_input $stdin = StringIO.new("test_input\n") result = prompt_for_filespec_with_wildcard('*.txt') assert_equal 'resolved_path_or_substituted_value', result end |