Class: MarkdownExec::TestHashDelegatorHandleBlockState

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

Instance Method Summary collapse

Instance Method Details

#setupObject



6898
6899
6900
6901
# File 'lib/hash_delegator.rb', line 6898

def setup
  @hd = HashDelegator.new
  @mock_block_state = mock('block_state')
end

#test_handle_back_or_continue_with_backObject



6903
6904
6905
6906
6907
6908
6909
6910
6911
6912
# File 'lib/hash_delegator.rb', line 6903

def test_handle_back_or_continue_with_back
  @mock_block_state.stubs(:state).returns(MenuState::BACK)
  @mock_block_state.stubs(:block).returns({ oname: 'sample_block' })

  @hd.handle_back_or_continue(@mock_block_state)

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

#test_handle_back_or_continue_with_continueObject



6914
6915
6916
6917
6918
6919
6920
6921
6922
6923
# File 'lib/hash_delegator.rb', line 6914

def test_handle_back_or_continue_with_continue
  @mock_block_state.stubs(:state).returns(MenuState::CONTINUE)
  @mock_block_state.stubs(:block).returns({ oname: 'another_block' })

  @hd.handle_back_or_continue(@mock_block_state)

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

#test_handle_back_or_continue_with_otherObject



6925
6926
6927
6928
6929
6930
6931
6932
6933
# File 'lib/hash_delegator.rb', line 6925

def test_handle_back_or_continue_with_other
  @mock_block_state.stubs(:state).returns(nil) # MenuState::OTHER
  @mock_block_state.stubs(:block).returns({ oname: 'other_block' })

  @hd.handle_back_or_continue(@mock_block_state)

  assert_nil @hd.instance_variable_get(:@delegate_object)[:block_name]
  assert_nil @hd.instance_variable_get(:@menu_user_clicked_back_link)
end