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
7156 7157 7158 7159 7160 7161 7162 |
# File 'lib/hash_delegator.rb', line 7156 def setup @delegate_object = { prompt_show_expr_format: 'Current expression: %{expr}', prompt_enter_filespec: 'Please enter a filespec:' } @original_stdin = $stdin end |
#teardown ⇒ Object
7164 7165 7166 |
# File 'lib/hash_delegator.rb', line 7164 def teardown $stdin = @original_stdin end |
#test_prompt_for_filespec_with_empty_input ⇒ Object
7181 7182 7183 7184 7185 |
# File 'lib/hash_delegator.rb', line 7181 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
7174 7175 7176 7177 7178 7179 |
# File 'lib/hash_delegator.rb', line 7174 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
7168 7169 7170 7171 7172 |
# File 'lib/hash_delegator.rb', line 7168 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 |