Class: MarkdownExec::TestHashDelegatorYieldToBlock

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

Instance Method Summary collapse

Instance Method Details

#setupObject



3378
3379
3380
3381
3382
# File 'lib/hash_delegator.rb', line 3378

def setup
  @hd = HashDelegator.new
  @fcb = mock('Fcb')
  MarkdownExec::Filter.stubs(:fcb_select?).returns(true)
end

#test_yield_to_block_if_applicable_with_correct_conditionsObject



3384
3385
3386
3387
3388
3389
3390
3391
3392
# File 'lib/hash_delegator.rb', line 3384

def test_yield_to_block_if_applicable_with_correct_conditions
  block_called = false
  Filter.yield_to_block_if_applicable(@fcb, [:blocks]) do |type, fcb|
    block_called = true
    assert_equal :blocks, type
    assert_equal @fcb, fcb
  end
  assert block_called
end

#test_yield_to_block_if_applicable_with_incorrect_conditionsObject



3399
3400
3401
3402
3403
3404
3405
3406
# File 'lib/hash_delegator.rb', line 3399

def test_yield_to_block_if_applicable_with_incorrect_conditions
  block_called = false
  MarkdownExec::Filter.stubs(:fcb_select?).returns(false)
  Filter.yield_to_block_if_applicable(@fcb, [:non_blocks]) do |_|
    block_called = true
  end
  refute block_called
end

#test_yield_to_block_if_applicable_without_blockObject



3394
3395
3396
3397
# File 'lib/hash_delegator.rb', line 3394

def test_yield_to_block_if_applicable_without_block
  result = Filter.yield_to_block_if_applicable(@fcb, [:blocks])
  assert_nil result
end