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
2609 2610 2611 |
# File 'lib/hash_delegator.rb', line 2609 def setup @hd = HashDelegator.new end |
#test_block_find_with_default ⇒ Object
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_match ⇒ Object
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_match ⇒ Object
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 |