Sha256: f98f2195fc354099598ed83985f868103b0bd31ca019900d9be23aefe4ae15cc

Contents?: true

Size: 654 Bytes

Versions: 8

Compression:

Stored size: 654 Bytes

Contents

$:.unshift "../lib"
require 'eventmachine'
require 'test/unit'

class TestDeferrable < Test::Unit::TestCase
  class Later
    include EM::Deferrable
  end

  def test_timeout_without_args
    $args = "unset"

    EM.run {
      df = Later.new
      df.timeout(0.2)
      df.errback { $args = "none" }
      EM.add_timer(0.5) { EM.stop }
    }

    assert_equal("none", $args)
  end

  def test_timeout_with_args
    $args = "unset"

    EM.run {
      df = Later.new
      df.timeout(0.2, :timeout, :foo)
      df.errback { |type, name| $args = [type, name] }
      EM.add_timer(0.5) { EM.stop }
    }

    assert_equal([:timeout, :foo], $args)
  end
end

Version data entries

8 entries across 8 versions & 3 rubygems

Version Path
eventmachine-1.0.0.beta.2-x86-mswin32-60 tests/test_deferrable.rb
eventmachine-1.0.0.beta.2-x86-mingw32 tests/test_deferrable.rb
eventmachine-1.0.0.beta.2-java tests/test_deferrable.rb
eventmachine-1.0.0.beta.2 tests/test_deferrable.rb
eventmachine-1.0.0.beta.1-java tests/test_deferrable.rb
eventmachine-1.0.0.beta.1 tests/test_deferrable.rb
crusher-eventmachine-0.12.11 tests/test_deferrable.rb
jrmey-eventmachine-0.12.12 tests/test_deferrable.rb