Class: MarkdownExec::TestHashDelegator::TestHashDelegatorDetermineBlockState

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

Instance Method Summary collapse

Instance Method Details

#setupObject



2782
2783
2784
2785
# File 'lib/hash_delegator.rb', line 2782

def setup
  @hd = HashDelegator.new
  @hd.stubs(:menu_chrome_formatted_option).returns('Formatted Option')
end

#test_determine_block_state_backObject



2797
2798
2799
2800
2801
2802
2803
2804
# File 'lib/hash_delegator.rb', line 2797

def test_determine_block_state_back
  selected_option = { oname: 'Formatted Back Option' }
  @hd.stubs(:menu_chrome_formatted_option).with(:menu_option_back_name).returns('Formatted Back Option')
  result = @hd.determine_block_state(selected_option)

  assert_equal MenuState::BACK, result.state
  assert_equal selected_option, result.block
end

#test_determine_block_state_continueObject



2806
2807
2808
2809
2810
2811
2812
2813
# File 'lib/hash_delegator.rb', line 2806

def test_determine_block_state_continue
  selected_option = { oname: 'Other Option' }

  result = @hd.determine_block_state(selected_option)

  assert_equal MenuState::CONTINUE, result.state
  assert_equal selected_option, result.block
end

#test_determine_block_state_exitObject



2787
2788
2789
2790
2791
2792
2793
2794
2795
# File 'lib/hash_delegator.rb', line 2787

def test_determine_block_state_exit
  selected_option = { oname: 'Formatted Option' }
  @hd.stubs(:menu_chrome_formatted_option).with(:menu_option_exit_name).returns('Formatted Option')

  result = @hd.determine_block_state(selected_option)

  assert_equal MenuState::EXIT, result.state
  assert_nil result.block
end