Class: MarkdownExec::TestHashDelegatorYieldToBlock

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

Instance Method Summary collapse

Instance Method Details

#setupObject



3320
3321
3322
3323
3324
# File 'lib/hash_delegator.rb', line 3320

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



3326
3327
3328
3329
3330
3331
3332
3333
3334
# File 'lib/hash_delegator.rb', line 3326

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



3341
3342
3343
3344
3345
3346
3347
3348
# File 'lib/hash_delegator.rb', line 3341

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



3336
3337
3338
3339
# File 'lib/hash_delegator.rb', line 3336

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