Class: MarkdownExec::TestHashDelegator::TestHashDelegatorBlockFind

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

Instance Method Summary collapse

Instance Method Details

#setupObject



2609
2610
2611
# File 'lib/hash_delegator.rb', line 2609

def setup
  @hd = HashDelegator.new
end

#test_block_find_with_defaultObject



2625
2626
2627
2628
2629
# File 'lib/hash_delegator.rb', line 2625

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



2613
2614
2615
2616
2617
# File 'lib/hash_delegator.rb', line 2613

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



2619
2620
2621
2622
2623
# File 'lib/hash_delegator.rb', line 2619

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