Class: MarkdownExec::TestHashDelegator::TestHashDelegatorBlockFind

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

Instance Method Summary collapse

Instance Method Details

#setupObject



2723
2724
2725
# File 'lib/hash_delegator.rb', line 2723

def setup
  @hd = HashDelegator.new
end

#test_block_find_with_defaultObject



2739
2740
2741
2742
2743
# File 'lib/hash_delegator.rb', line 2739

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



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

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



2733
2734
2735
2736
2737
# File 'lib/hash_delegator.rb', line 2733

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