Class: MarkdownExec::TestHashDelegatorYieldToBlock

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

Instance Method Summary collapse

Instance Method Details

#setupObject



7081
7082
7083
7084
7085
# File 'lib/hash_delegator.rb', line 7081

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



7087
7088
7089
7090
7091
7092
7093
7094
7095
# File 'lib/hash_delegator.rb', line 7087

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



7102
7103
7104
7105
7106
7107
7108
7109
# File 'lib/hash_delegator.rb', line 7102

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



7097
7098
7099
7100
# File 'lib/hash_delegator.rb', line 7097

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