Class: PubSub::SubscriptionConfigTest

Inherits:
Test::Unit::TestCase
  • Object
show all
Includes:
ClientTester
Defined in:
lib/gems/xmpp4r-0.4/test/pubsub/tc_subscriptionconfig.rb

Overview

Jabber.debug = true

Instance Method Summary collapse

Instance Method Details

#test_createObject



18
19
20
21
22
23
# File 'lib/gems/xmpp4r-0.4/test/pubsub/tc_subscriptionconfig.rb', line 18

def test_create()
  config = PubSub::SubscriptionConfig.new()
  assert_nil(config.form)
  assert_nil(config.node)
  assert_equal({}, config.options)
end

#test_create_with_optionsObject



25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
# File 'lib/gems/xmpp4r-0.4/test/pubsub/tc_subscriptionconfig.rb', line 25

def test_create_with_options
  node = 'mynode'
  jid = '[email protected]'
  options = {'pubsub#access_model'=>'open'}
  subid = '004-yyy'

  config = PubSub::SubscriptionConfig.new(node, jid, options, subid)
  assert_equal(node, config.node)
  assert_equal(subid, config.subid)
  assert_kind_of(Jabber::JID, config.jid)
  assert_equal(Jabber::JID.new(jid), config.jid)
  assert_kind_of(Jabber::Dataforms::XData, config.form)
  assert_equal(options, config.options)
  assert_equal(:submit, config.form.type)
  assert_equal('http://jabber.org/protocol/pubsub#subscribe_options', config.form.field('FORM_TYPE').values.first)
end