Class: MarkdownExec::TestHashDelegator::TestHashDelegatorBlockFind
- Inherits:
-
Minitest::Test
- Object
- Minitest::Test
- MarkdownExec::TestHashDelegator::TestHashDelegatorBlockFind
- Defined in:
- lib/hash_delegator.rb
Instance Method Summary collapse
- #setup ⇒ Object
- #test_block_find_with_default ⇒ Object
- #test_block_find_with_match ⇒ Object
- #test_block_find_without_match ⇒ Object
Instance Method Details
#setup ⇒ Object
2511 2512 2513 |
# File 'lib/hash_delegator.rb', line 2511 def setup @hd = HashDelegator.new end |
#test_block_find_with_default ⇒ Object
2527 2528 2529 2530 2531 |
# File 'lib/hash_delegator.rb', line 2527 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_match ⇒ Object
2515 2516 2517 2518 2519 |
# File 'lib/hash_delegator.rb', line 2515 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_match ⇒ Object
2521 2522 2523 2524 2525 |
# File 'lib/hash_delegator.rb', line 2521 def test_block_find_without_match blocks = [{ key: 'value1' }, { key: 'value2' }] result = HashDelegator.block_find(blocks, :key, 'value3') assert_nil result end |