Class: MarkdownExec::PromptForFilespecWithWildcardTest

Inherits:
Minitest::Test
  • Object
show all
Defined in:
lib/hash_delegator.rb

Defined Under Namespace

Modules: PathUtils

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.getsObject

Raises:

  • (Interrupt)


7176
# File 'lib/hash_delegator.rb', line 7176

def $stdin.gets; raise Interrupt; end

Instance Method Details

#setupObject



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

#teardownObject



7164
7165
7166
# File 'lib/hash_delegator.rb', line 7164

def teardown
  $stdin = @original_stdin
end

#test_prompt_for_filespec_with_empty_inputObject



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_interruptionObject



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_inputObject



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