Class: MarkdownExec::TestHashDelegator::TestHashDelegatorBlockFind

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

Instance Method Summary collapse

Instance Method Details

#setupObject



2665
2666
2667
# File 'lib/hash_delegator.rb', line 2665

def setup
  @hd = HashDelegator.new
end

#test_block_find_with_defaultObject



2681
2682
2683
2684
2685
# File 'lib/hash_delegator.rb', line 2681

def test_block_find_with_default
  blocks = [{ key: 'value1' }, { key: 'value2' }]
  result = HashDelegator.block_find(blocks, :key, 'value3', 'default')
  assert_equal 'default', result
end

#test_block_find_with_matchObject



2669
2670
2671
2672
2673
# File 'lib/hash_delegator.rb', line 2669

def test_block_find_with_match
  blocks = [{ key: 'value1' }, { key: 'value2' }]
  result = HashDelegator.block_find(blocks, :key, 'value1')
  assert_equal({ key: 'value1' }, result)
end

#test_block_find_without_matchObject



2675
2676
2677
2678
2679
# File 'lib/hash_delegator.rb', line 2675

def test_block_find_without_match
  blocks = [{ key: 'value1' }, { key: 'value2' }]
  result = HashDelegator.block_find(blocks, :key, 'value3')
  assert_nil result
end