Class: MarkdownExec::TestHashDelegatorAppendDivider

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

Instance Method Summary collapse

Instance Method Details

#setupObject



4381
4382
4383
4384
4385
4386
4387
4388
4389
4390
4391
# File 'lib/hash_delegator.rb', line 4381

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



4401
4402
4403
4404
4405
4406
4407
# File 'lib/hash_delegator.rb', line 4401

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



4393
4394
4395
4396
4397
4398
4399
# File 'lib/hash_delegator.rb', line 4393

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



4409
4410
4411
4412
4413
4414
4415
# File 'lib/hash_delegator.rb', line 4409

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