Class: MarkdownExec::TestHashDelegatorBlockFind

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

Instance Method Summary collapse

Instance Method Details

#setupObject



6471
6472
6473
# File 'lib/hash_delegator.rb', line 6471

def setup
  @hd = HashDelegator.new
end

#test_block_find_with_defaultObject



6487
6488
6489
6490
6491
6492
# File 'lib/hash_delegator.rb', line 6487

def test_block_find_with_default
  blocks = [FCB.new(text: 'value1'), FCB.new(text: 'value2')]
  result = HashDelegator.block_find(blocks, :text, 'missing_value',
                                    'default')
  assert_equal 'default', result
end

#test_block_find_with_matchObject



6475
6476
6477
6478
6479
# File 'lib/hash_delegator.rb', line 6475

def test_block_find_with_match
  blocks = [FCB.new(text: 'value1'), FCB.new(text: 'value2')]
  result = HashDelegator.block_find(blocks, :text, 'value1')
  assert_equal('value1', result.text)
end

#test_block_find_without_matchObject



6481
6482
6483
6484
6485
# File 'lib/hash_delegator.rb', line 6481

def test_block_find_without_match
  blocks = [FCB.new(text: 'value1'), FCB.new(text: 'value2')]
  result = HashDelegator.block_find(blocks, :text, 'missing_value')
  assert_nil result
end