Class: MarkdownExec::TestHashDelegatorIterBlocksFromNestedFiles

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

Instance Method Summary collapse

Instance Method Details

#setupObject



6876
6877
6878
6879
6880
6881
6882
# File 'lib/hash_delegator.rb', line 6876

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



6884
6885
6886
6887
6888
6889
6890
6891
6892
6893
# File 'lib/hash_delegator.rb', line 6884

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



6895
6896
6897
6898
6899
6900
6901
# File 'lib/hash_delegator.rb', line 6895

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