Class: MarkdownExec::TestHashDelegatorYieldToBlock

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

Instance Method Summary collapse

Instance Method Details

#setupObject



3264
3265
3266
3267
3268
# File 'lib/hash_delegator.rb', line 3264

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



3270
3271
3272
3273
3274
3275
3276
3277
3278
# File 'lib/hash_delegator.rb', line 3270

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



3285
3286
3287
3288
3289
3290
3291
3292
# File 'lib/hash_delegator.rb', line 3285

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



3280
3281
3282
3283
# File 'lib/hash_delegator.rb', line 3280

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