Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- if __FILE__ == $0
- require 'eventmachine'
- require 'minitest/unit'
- class TestEventMachineTestUtilsCranking < MiniTest::Unit::TestCase
- Thread.abort_on_exception = true
- include EventMachine::Test::Utils::Cranking
- def test_crank_counter
- count = 0
- counter = lambda { count += 1; EM.next_tick &counter }
- EM.next_tick &counter
- 1000.times { |n|
- assert_equal n, count
- crank!
- }
- end
- end
- MiniTest::Unit.autorun
- end
Add Comment
Please, Sign In to add comment