Class: MarkdownExec::TestHashDelegator::TestHashDelegatorCollectRequiredCodeLines

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

Instance Method Summary collapse

Instance Method Details

#setupObject



2774
2775
2776
2777
2778
2779
2780
2781
2782
# File 'lib/hash_delegator.rb', line 2774

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



2784
2785
2786
2787
2788
2789
2790
# File 'lib/hash_delegator.rb', line 2784

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