Method: PubSub::ServiceHelperTest#test_create

Defined in:
lib/vendor/xmpp4r/test/pubsub/tc_helper.rb

#test_createObject

create node with default configuration example 119 and 121 from www.xmpp.org/extensions/xep-0060.html#owner-create-default



226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
# File 'lib/vendor/xmpp4r/test/pubsub/tc_helper.rb', line 226

def test_create
  h = PubSub::ServiceHelper.new(@client,'pubsub.example.org')
  assert_kind_of(PubSub::ServiceHelper, h)

  state { |iq|
    assert_kind_of(Jabber::Iq, iq)
    assert_equal(:set, iq.type)
    assert_equal(1, iq.children.size)
    assert_equal('http://jabber.org/protocol/pubsub', iq.pubsub.namespace)
    assert_equal(2, iq.pubsub.children.size)
    assert_equal('create', iq.pubsub.children.first.name)
    assert_equal('mynode', iq.pubsub.children.first.attributes['node'])
    assert_equal('configure', iq.pubsub.children[1].name)
    assert_equal({}, iq.pubsub.children[1].attributes)
    assert_equal([], iq.pubsub.children[1].children)
    send("<iq type='result' to='#{iq.from}' from='#{iq.to}' id='#{iq.id}'/>")
  }
  assert_equal('mynode', h.create_node('mynode'))
  wait_state
end