Guest User

Untitled

a guest
Jun 22nd, 2018
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.50 KB | None | 0 0
  1. if __FILE__ == $0
  2. require 'eventmachine'
  3.  
  4. require 'minitest/unit'
  5.  
  6.  
  7. class TestEventMachineTestUtilsCranking < MiniTest::Unit::TestCase
  8. Thread.abort_on_exception = true
  9.  
  10. include EventMachine::Test::Utils::Cranking
  11.  
  12. def test_crank_counter
  13. count = 0
  14. counter = lambda { count += 1; EM.next_tick &counter }
  15. EM.next_tick &counter
  16.  
  17. 1000.times { |n|
  18. assert_equal n, count
  19. crank!
  20. }
  21. end
  22. end
  23.  
  24. MiniTest::Unit.autorun
  25.  
  26. end
Add Comment
Please, Sign In to add comment