Class: MarkdownExec::TestHashDelegator::TestHashDelegatorCollectRequiredCodeLines

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

Instance Method Summary collapse

Instance Method Details

#setupObject



2660
2661
2662
2663
2664
2665
2666
2667
2668
# File 'lib/hash_delegator.rb', line 2660

def setup
  @hd = HashDelegator.new
  @hd.instance_variable_set(:@delegate_object, {})
  @mdoc = mock('YourMDocClass')
  @selected = { shell: BlockType::VARS, body: ['key: value'] }
  HashDelegator.stubs(:read_required_blocks_from_temp_file).returns([])
  @hd.stubs(:string_send_color)
  @hd.stubs(:print)
end

#test_collect_required_code_lines_with_varsObject



2670
2671
2672
2673
2674
2675
2676
# File 'lib/hash_delegator.rb', line 2670

def test_collect_required_code_lines_with_vars
  YAML.stubs(:load).returns({ 'key' => 'value' })
  @mdoc.stubs(:collect_recursively_required_code).returns({ code: ['code line'] })
  result = @hd.collect_required_code_lines(mdoc: @mdoc, selected: @selected, block_source: {})

  assert_equal ['code line', 'key="value"'], result
end