Class: PubSub::NodeConfigTest

Inherits:
Test::Unit::TestCase
  • Object
show all
Includes:
ClientTester
Defined in:
lib/gems/xmpp4r-0.4/test/pubsub/tc_nodeconfig.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_nodeconfig.rb', line 18

def test_create()
  config = PubSub::NodeConfig.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
# File 'lib/gems/xmpp4r-0.4/test/pubsub/tc_nodeconfig.rb', line 25

def test_create_with_options
  options = {'pubsub#access_model'=>'open'}

  config = PubSub::NodeConfig.new(nil, options)
  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#node_config', config.form.field('FORM_TYPE').values.first)
end

#test_create_with_options_and_nodeObject



35
36
37
38
39
40
41
42
43
44
45
# File 'lib/gems/xmpp4r-0.4/test/pubsub/tc_nodeconfig.rb', line 35

def test_create_with_options_and_node
  node = 'mynode'
  options = {'pubsub#access_model'=>'open'}

  config = PubSub::NodeConfig.new(node, options)
  assert_equal(node, config.node)
  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#node_config', config.form.field('FORM_TYPE').values.first)
end

#test_set_optionsObject



47
48
49
50
51
52
53
# File 'lib/gems/xmpp4r-0.4/test/pubsub/tc_nodeconfig.rb', line 47

def test_set_options
  options = {'pubsub#access_model'=>'open'}
  config = PubSub::NodeConfig.new()
  config.options = options
  assert_kind_of(Jabber::Dataforms::XData, config.form)
  assert_equal(options, config.options)
end