Skip to content

Commit

Permalink
synchrony_spec: Rewrite the second example
Browse files Browse the repository at this point in the history
Not only it was broken (args undefined), which created failure in some
example that ran after it, it also didn't test what it said.
  • Loading branch information
dgutov committed Mar 15, 2015
1 parent 838a179 commit e7df4de
Showing 1 changed file with 15 additions and 6 deletions.
21 changes: 15 additions & 6 deletions spec/synchrony_spec.rb
Expand Up @@ -19,14 +19,23 @@

describe "#next_tick" do
it "should wrap next_tick into a Fiber context" do
Fiber.new {
df = EM::DefaultDeferrable.new
EM.synchrony {
begin
fired = false
f = Fiber.current

EM::Synchrony.next_tick do
fired = true
Fiber.current.should_not eq(f)
end

EM::Synchrony.next_tick do
df.succeed args
EM::Synchrony.sync(df).should == args
EM::Synchrony.interrupt

fired.should eq(true)
ensure
EM.stop
end
}.resume
}
end
end

Expand Down

0 comments on commit e7df4de

Please sign in to comment.