Class: MarkdownExec::TestHashDelegatorIterBlocksFromNestedFiles

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

Instance Method Summary collapse

Instance Method Details

#setupObject



7011
7012
7013
7014
7015
7016
7017
# File 'lib/hash_delegator.rb', line 7011

def setup
  @hd = HashDelegator.new(filename: 'test.md')
  @hd.stubs(:check_file_existence).with('test.md').returns(true)
  @hd.stubs(:initial_state).returns({})
  @hd.stubs(:cfile).returns(Minitest::Mock.new)
  @hd.stubs(:update_line_and_block_state)
end

#test_iter_blocks_from_nested_filesObject



7019
7020
7021
7022
7023
7024
7025
7026
7027
7028
# File 'lib/hash_delegator.rb', line 7019

def test_iter_blocks_from_nested_files
  @hd.cfile.expect(:readlines, ['line 1', 'line 2'], ['test.md'],
                   import_paths: '')
  selected_types = ['filtered message']

  result = @hd.iter_blocks_from_nested_files { selected_types }
  assert_equal ['line 1', 'line 2'], result

  @hd.cfile.verify
end

#test_iter_blocks_from_nested_files_with_no_fileObject



7030
7031
7032
7033
7034
7035
7036
# File 'lib/hash_delegator.rb', line 7030

def test_iter_blocks_from_nested_files_with_no_file
  @hd.stubs(:check_file_existence).with('test.md').returns(false)

  assert_nil(@hd.iter_blocks_from_nested_files do
               ['filtered message']
             end)
end