Class: MarkdownExec::TestHashDelegatorWaitForUserSelectedBlock

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

Instance Method Summary collapse

Instance Method Details

#setupObject



5110
5111
5112
5113
# File 'lib/hash_delegator.rb', line 5110

def setup
  @hd = HashDelegator.new
  HashDelegator.stubs(:error_handler)
end

#test_wait_for_user_selected_block_with_back_stateObject



5115
5116
5117
5118
5119
5120
5121
5122
5123
5124
5125
5126
5127
# File 'lib/hash_delegator.rb', line 5115

def test_wait_for_user_selected_block_with_back_state
  mock_block_state = Struct.new(:state, :block)
                           .new(MenuState::BACK, { oname: 'back_block' })
  @hd.stubs(:wait_for_user_selection).returns(mock_block_state)

  result = @hd.wait_for_user_selected_block([], ['Block 1', 'Block 2'],
                                            nil)

  assert_equal 'back_block',
               @hd.instance_variable_get(:@delegate_object)[:block_name]
  assert @hd.instance_variable_get(:@menu_user_clicked_back_link)
  assert_equal mock_block_state, result
end

#test_wait_for_user_selected_block_with_continue_stateObject



5129
5130
5131
5132
5133
5134
5135
5136
5137
5138
5139
5140
5141
5142
# File 'lib/hash_delegator.rb', line 5129

def test_wait_for_user_selected_block_with_continue_state
  mock_block_state = Struct.new(:state, :block).new(
    MenuState::CONTINUE, { oname: 'continue_block' }
  )
  @hd.stubs(:wait_for_user_selection).returns(mock_block_state)

  result = @hd.wait_for_user_selected_block([], ['Block 1', 'Block 2'],
                                            nil)

  assert_equal 'continue_block',
               @hd.instance_variable_get(:@delegate_object)[:block_name]
  refute @hd.instance_variable_get(:@menu_user_clicked_back_link)
  assert_equal mock_block_state, result
end