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:



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

def $stdin.gets; raise Interrupt; end

Instance Method Details

#setupObject



7291
7292
7293
7294
7295
7296
7297
# File 'lib/hash_delegator.rb', line 7291

def setup
  @delegate_object = {
    prompt_show_expr_format: 'Current expression: %{expr}',
    prompt_enter_filespec: 'Please enter a filespec:'
  }
  @original_stdin = $stdin
end

#teardownObject



7299
7300
7301
# File 'lib/hash_delegator.rb', line 7299

def teardown
  $stdin = @original_stdin
end

#test_prompt_for_filespec_with_empty_inputObject



7316
7317
7318
7319
7320
# File 'lib/hash_delegator.rb', line 7316

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



7309
7310
7311
7312
7313
7314
# File 'lib/hash_delegator.rb', line 7309

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



7303
7304
7305
7306
7307
# File 'lib/hash_delegator.rb', line 7303

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