Sha256: 9451f2a9384b691ccd904f6f70bdd10828ae889afad31c03eebc85d1a645fcdf

Contents?: true

Size: 623 Bytes

Versions: 2

Compression:

Stored size: 623 Bytes

Contents

require "spec/helper/all"

describe EventMachine::Synchrony do

  it "defer: simple" do
    EM.synchrony do
      x = 1
    
      result = EM::Synchrony.defer do
        x = 2
        sleep 0.1
        3
      end
      
      result.should == 3      
      x.should == 2
      
      EM.stop    
    end
  end
  
  it "defer: with lambda" do
    EM.synchrony do
    
      x = 1
      
      op = lambda do
        sleep 0.1
        x += 1
        3
      end
      
      EM::S.defer(op).should == 3
      x.should == 2
              
      EM.stop
    end                                                  
  end
  
end

Version data entries

2 entries across 2 versions & 1 rubygems

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