Class: MarkdownExec::TestHashDelegatorIterBlocksFromNestedFiles

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

Instance Method Summary collapse

Instance Method Details

#setupObject



4937
4938
4939
4940
4941
4942
4943
4944
4945
# File 'lib/hash_delegator.rb', line 4937

def setup
  @hd = HashDelegator.new
  @hd.instance_variable_set(:@delegate_object,
                            { 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



4947
4948
4949
4950
4951
4952
4953
4954
4955
4956
# File 'lib/hash_delegator.rb', line 4947

def test_iter_blocks_from_nested_files
  @hd.cfile.expect(:readlines, ['line 1', 'line 2'], ['test.md'],
                   import_paths: nil)
  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



4958
4959
4960
4961
4962
4963
4964
# File 'lib/hash_delegator.rb', line 4958

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