Class: MarkdownExec::TestHashDelegator::TestHashDelegatorCollectRequiredCodeLines

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

Instance Method Summary collapse

Instance Method Details

#setupObject



2562
2563
2564
2565
2566
2567
2568
2569
2570
# File 'lib/hash_delegator.rb', line 2562

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



2572
2573
2574
2575
2576
2577
2578
# File 'lib/hash_delegator.rb', line 2572

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