Sha256: 47d6134cd05567edb9898222864906ecf17d5a37969b684cebee5ef1b9eefd59

Contents?: true

Size: 733 Bytes

Versions: 2

Compression:

Stored size: 733 Bytes

Contents

require "helper/all"

describe EM::Synchrony do
  describe "Multi" do
    it "should require unique keys for each deferrable" do
      lambda do
        m = EM::Synchrony::Multi.new
        m.add :df1, EM::DefaultDeferrable.new
        m.add :df1, EM::DefaultDeferrable.new
      end.should raise_error("Duplicate Multi key")
    end

    context "when defferable succeeded before adding" do
      it "does not succeed twice" do
        multi = EM::Synchrony::Multi.new
        multi.should_receive(:succeed).once

        slow = EM::DefaultDeferrable.new
        multi.add :slow, slow

        quick = EM::DefaultDeferrable.new
        quick.succeed
        multi.add :quick, quick

        slow.succeed
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
em-synchrony-1.0.6 spec/multi_spec.rb
em-synchrony-1.0.5 spec/multi_spec.rb