Class: MarkdownExec::TestHashDelegatorYieldToBlock

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

Instance Method Summary collapse

Instance Method Details

#setupObject



5146
5147
5148
5149
5150
# File 'lib/hash_delegator.rb', line 5146

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



5152
5153
5154
5155
5156
5157
5158
5159
5160
# File 'lib/hash_delegator.rb', line 5152

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



5167
5168
5169
5170
5171
5172
5173
5174
# File 'lib/hash_delegator.rb', line 5167

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



5162
5163
5164
5165
# File 'lib/hash_delegator.rb', line 5162

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