class MarkdownExec::TestHashDelegatorYieldToBlock
def setup
def setup @hd = HashDelegator.new @fcb = mock('Fcb') MarkdownExec::Filter.stubs(:fcb_select?).returns(true) end
def test_yield_to_block_if_applicable_with_correct_conditions
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
def test_yield_to_block_if_applicable_with_incorrect_conditions
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
def test_yield_to_block_if_applicable_without_block
def test_yield_to_block_if_applicable_without_block result = Filter.yield_to_block_if_applicable(@fcb, [:blocks]) assert_nil result end