Class: MarkdownExec::TestHashDelegatorBlockFind

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

Instance Method Summary collapse

Instance Method Details

#setupObject



6367
6368
6369
# File 'lib/hash_delegator.rb', line 6367

def setup
  @hd = HashDelegator.new
end

#test_block_find_with_defaultObject



6383
6384
6385
6386
6387
6388
# File 'lib/hash_delegator.rb', line 6383

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



6371
6372
6373
6374
6375
# File 'lib/hash_delegator.rb', line 6371

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



6377
6378
6379
6380
6381
# File 'lib/hash_delegator.rb', line 6377

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