Sha256: e3560947cc0c1be7a596a1dadcd0d0a166de4d280bf12ccf1991d37d4a4d1d42

Contents?: true

Size: 1.2 KB

Versions: 30

Compression:

Stored size: 1.2 KB

Contents

#!/usr/bin/ruby

$:.unshift File::dirname(__FILE__) + '/../../lib'

require 'test/unit'
require 'xmpp4r/rexmladdons'
require 'xmpp4r/delay/x/delay'
include Jabber

class XDelayTest < Test::Unit::TestCase
  def test_create1
    d = Delay::XDelay.new(false)
    assert_equal(nil, d.stamp)
    assert_equal(nil, d.from)
    assert_equal('jabber:x:delay', d.namespace)
  end

  def test_create2
    d = Delay::XDelay.new
    # Hopefully the seconds don't change here...
    assert_equal(Time.now.to_s, d.stamp.to_s)
    assert_equal(nil, d.from)
    assert_equal('jabber:x:delay', d.namespace)
  end

  def test_from
    d = Delay::XDelay.new
    assert_equal(nil, d.from)
    d.from = JID.new('astro@spaceboyz.net')
    assert_equal(JID.new('astro@spaceboyz.net'), d.from)
    assert_equal(d, d.set_from(nil))
    assert_equal(nil, d.from)
  end

  def test_stamp
    d = Delay::XDelay.new(false)
    assert_equal(nil, d.stamp)
    now = Time.now
    d.stamp = now
    assert_equal(now.to_s, d.stamp.to_s)
    assert_equal(d, d.set_stamp(nil))
    assert_equal(nil, d.stamp)
  end

  def test_import
    x1 = X.new
    x1.add_namespace('jabber:x:delay')
    x2 = X::import(x1)
    assert_equal(Delay::XDelay, x2.class)
  end
end

Version data entries

30 entries across 30 versions & 12 rubygems

Version Path
brontes3d-xmpp4r-0.4 test/delay/tc_xdelay.rb
bryanl-xmpp4r-0.3.2 test/delay/tc_xdelay.rb
edavey-xmpp4r-0.4.1 test/delay/tc_xdelay.rb
edavey-xmpp4r-0.4.2 test/delay/tc_xdelay.rb
edavey-xmpp4r-0.4 test/delay/tc_xdelay.rb
heipei-xmpp4r-0.3.2 test/delay/tc_xdelay.rb
ln-xmpp4r-0.5 test/delay/tc_xdelay.rb
mojodna-xmpp4r-0.4.0.2 test/delay/tc_xdelay.rb
mojodna-xmpp4r-0.4.0.3 test/delay/tc_xdelay.rb
seanohalpin-xmpp4r-0.4.1 test/delay/tc_xdelay.rb
xmpp4r-0.5.6 test/delay/tc_xdelay.rb
xmpp4r-0.5.5 test/delay/tc_xdelay.rb
mad-p-xmpp4r-0.6.3 test/delay/tc_xdelay.rb
mad-p-xmpp4r-0.6.2 test/delay/tc_xdelay.rb
mad-p-xmpp4r-0.6.1 test/delay/tc_xdelay.rb
mad-p-xmpp4r-0.6.0 test/delay/tc_xdelay.rb
cerberus-0.8.0 lib/vendor/xmpp4r/test/delay/tc_xdelay.rb
cerberus-0.7.9 lib/vendor/xmpp4r/test/delay/tc_xdelay.rb
edavis10-cerberus-0.7.8 lib/vendor/xmpp4r/test/delay/tc_xdelay.rb
cerberus-0.7.8 lib/vendor/xmpp4r/test/delay/tc_xdelay.rb