Sha256: c66c15a47e8f037c5b00c6d6fcc21454702aef83627c8139fd7f370e64855c31

Contents?: true

Size: 721 Bytes

Versions: 4

Compression:

Stored size: 721 Bytes

Contents

require "helper/all"

describe EM::Synchrony do
  describe "#sync" do
    it "returns immediately if the syncee already succeeded" do
      args = stub("args")

      Fiber.new {
        df = EM::DefaultDeferrable.new
        df.succeed args
        EM::Synchrony.sync(df).should == args

        df = EM::DefaultDeferrable.new
        df.succeed nil
        EM::Synchrony.sync(df).should == nil
      }.resume
    end
  end

  describe "#next_tick" do
    it "should wrap next_tick into a Fiber context" do
      Fiber.new {
        df = EM::DefaultDeferrable.new

        EM::Synchrony.next_tick do
          df.succeed args
          EM::Synchrony.sync(df).should == args
        end
      }.resume
    end
  end

end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
em-synchrony-1.0.4 spec/synchrony_spec.rb
em-synchrony-1.0.3 spec/synchrony_spec.rb
em-synchrony-1.0.2 spec/synchrony_spec.rb
em-synchrony-1.0.1 spec/synchrony_spec.rb