Sha256: c7770f09a75441f1d0c5412ddb0453bc1092a2fd166d50021fcc0f769423f7ff

Contents?: true

Size: 664 Bytes

Versions: 9

Compression:

Stored size: 664 Bytes

Contents

# encoding: UTF-8

require File.expand_path('../../test_helper', __FILE__)
require 'eventmachine'

describe "Async" do

  before do
    @site = setup_site
    @filename = Time.now.to_i
    @filepath = @site.root / @filename
    refute File.exist?(@filepath)
  end

  after do
    teardown_site
  end

  it "be able to test for running EM reactor" do
    refute Spontaneous.async?
    EM.run do
      assert Spontaneous.async?
      EM.stop
    end
    refute Spontaneous.async?
  end

  it "run synchronously outside of EM reactor" do
    Spontaneous.system("touch #{@filepath}") { |result|
      assert File.exist?(@filepath)
      assert result

    }
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
spontaneous-0.2.0.beta10 test/unit/test_async.rb
spontaneous-0.2.0.beta9 test/unit/test_async.rb
spontaneous-0.2.0.beta8 test/unit/test_async.rb
spontaneous-0.2.0.beta7 test/unit/test_async.rb
spontaneous-0.2.0.beta6 test/unit/test_async.rb
spontaneous-0.2.0.beta5 test/unit/test_async.rb
spontaneous-0.2.0.beta4 test/unit/test_async.rb
spontaneous-0.2.0.beta3 test/unit/test_async.rb
spontaneous-0.2.0.beta2 test/unit/test_async.rb