File: tc_iqquery.rb

package info (click to toggle)
ruby-xmpp4r 0.5.6-2
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, bullseye, forky, sid, trixie
  • size: 1,384 kB
  • sloc: ruby: 17,382; xml: 74; sh: 12; makefile: 4
file content (31 lines) | stat: -rwxr-xr-x 763 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#!/usr/bin/ruby

$:.unshift '../lib'

require 'test/unit'
require 'xmpp4r/rexmladdons'
require 'xmpp4r/query'
include Jabber

class IqQueryTest < Test::Unit::TestCase
  def test_create
    x = IqQuery.new()
    assert_equal("query", x.name)
    assert_equal("<query/>", x.to_s)
  end

  def test_import
    q = IqQuery.new
    assert_equal(IqQuery, q.class)

    e = REXML::Element.new('query')
    e.add_namespace('jabber:iq:roster')
    # kind_of? only checks that the class belongs to the IqQuery class
    # hierarchy. See IqQueryRosterTest#test_import for a more strict
    # check.
    assert_kind_of(IqQuery, IqQuery.import(e))

    # Importing specific derivates is to be tested in the test case of the derivate
    # (e.g. tc_iqqueryroster.rb)
  end
end