Class: MarkdownExec::TestMDocCollectDependencies

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

Instance Method Summary collapse

Instance Method Details

#setupObject



454
455
456
# File 'lib/mdoc.rb', line 454

def setup
  @mdoc = MDoc.new
end

#test_collect_dependencies_with_no_sourceObject



458
459
460
# File 'lib/mdoc.rb', line 458

def test_collect_dependencies_with_no_source
  assert_empty @mdoc.collect_dependencies(nil)
end

#test_collect_dependencies_with_nonexistent_sourceObject

must raise error



463
464
465
466
467
# File 'lib/mdoc.rb', line 463

def test_collect_dependencies_with_nonexistent_source
  assert_raises(RuntimeError) do
    @mdoc.collect_dependencies('nonexistent')
  end
end

#test_collect_dependencies_with_valid_sourceObject



469
470
471
472
473
474
475
# File 'lib/mdoc.rb', line 469

def test_collect_dependencies_with_valid_source
  @mdoc.stubs(:get_block_by_anyname).with('source1').returns(OpenStruct.new(reqs: ['source2']))
  @mdoc.stubs(:get_block_by_anyname).with('source2').returns(OpenStruct.new(reqs: []))

  expected = { 'source1' => ['source2'], 'source2' => [] }
  assert_equal expected, @mdoc.collect_dependencies('source1')
end