Class: MarkdownExec::TestHashDelegator::TestHashDelegatorCollectRequiredCodeLines

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

Instance Method Summary collapse

Instance Method Details

#setupObject



2716
2717
2718
2719
2720
2721
2722
2723
2724
# File 'lib/hash_delegator.rb', line 2716

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



2726
2727
2728
2729
2730
2731
2732
# File 'lib/hash_delegator.rb', line 2726

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