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)


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

def $stdin.gets; raise Interrupt; end

Instance Method Details

#setupObject



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

#teardownObject



5229
5230
5231
# File 'lib/hash_delegator.rb', line 5229

def teardown
  $stdin = @original_stdin
end

#test_prompt_for_filespec_with_empty_inputObject



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_interruptionObject



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_inputObject



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