Class: MarkdownExec::TestHashDelegator::TestHashDelegatorAppendDivider

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

Instance Method Summary collapse

Instance Method Details

#setupObject



2571
2572
2573
2574
2575
2576
2577
2578
2579
2580
2581
# File 'lib/hash_delegator.rb', line 2571

def setup
  @hd = HashDelegator.new
  @hd.instance_variable_set(:@delegate_object, {
                              menu_divider_format: 'Format',
                              menu_initial_divider: 'Initial Divider',
                              menu_final_divider: 'Final Divider',
                              menu_divider_color: :color
                            })
  @hd.stubs(:string_send_color).returns('Formatted Divider')
  HashDelegator.stubs(:safeval).returns('Safe Value')
end

#test_append_divider_finalObject



2591
2592
2593
2594
2595
2596
2597
# File 'lib/hash_delegator.rb', line 2591

def test_append_divider_final
  menu_blocks = []
  @hd.append_divider(menu_blocks: menu_blocks, position: :final)

  assert_equal 1, menu_blocks.size
  assert_equal 'Formatted Divider', menu_blocks.last.dname
end

#test_append_divider_initialObject



2583
2584
2585
2586
2587
2588
2589
# File 'lib/hash_delegator.rb', line 2583

def test_append_divider_initial
  menu_blocks = []
  @hd.append_divider(menu_blocks: menu_blocks, position: :initial)

  assert_equal 1, menu_blocks.size
  assert_equal 'Formatted Divider', menu_blocks.first.dname
end

#test_append_divider_without_formatObject



2599
2600
2601
2602
2603
2604
2605
# File 'lib/hash_delegator.rb', line 2599

def test_append_divider_without_format
  @hd.instance_variable_set(:@delegate_object, {})
  menu_blocks = []
  @hd.append_divider(menu_blocks: menu_blocks, position: :initial)

  assert_empty menu_blocks
end