Class: MarkdownExec::TestHashDelegatorBlockFind

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

Instance Method Summary collapse

Instance Method Details

#setupObject



4419
4420
4421
# File 'lib/hash_delegator.rb', line 4419

def setup
  @hd = HashDelegator.new
end

#test_block_find_with_defaultObject



4435
4436
4437
4438
4439
4440
# File 'lib/hash_delegator.rb', line 4435

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



4423
4424
4425
4426
4427
# File 'lib/hash_delegator.rb', line 4423

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



4429
4430
4431
4432
4433
# File 'lib/hash_delegator.rb', line 4429

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