Permalink
Browse files

return EM:Timer from add_timer method

  • Loading branch information...
1 parent 572482b commit 50ee6ce5878947d01c18e630aa6b1572cb8a139f @Flcn Flcn committed May 3, 2012
Showing with 8 additions and 1 deletion.
  1. +1 −1 lib/em-synchrony.rb
  2. +7 −0 spec/timer_spec.rb
View
@@ -78,7 +78,7 @@ def self.sleep(secs)
# continue using synchrony methods
#
def self.add_timer(interval, &blk)
- EM.add_timer(interval) do
+ EM::Timer.new(interval) do
Fiber.new { blk.call }.resume
end
end
View
@@ -32,4 +32,11 @@
end
end
+ it 'should return instance of EventMachine::Timer from add_timer method' do
+ EM.synchrony do
+ timer = EM::Synchrony.add_timer(0.1){}
+ timer.should be_instance_of(EventMachine::Timer)
+ EventMachine.stop
+ end
+ end
end

0 comments on commit 50ee6ce

Please sign in to comment.