Sha256: a657c90788baf3daf949461d7d9777bdd46d2b6e3d97dc7ccd037c804e7f74a3

Contents?: true

Size: 1.92 KB

Versions: 22

Compression:

Stored size: 1.92 KB

Contents

require 'spec_helper'
require 'fixtures/pubsub'

describe Blather::Stanza::PubSub::Create do
  it 'registers itself' do
    Blather::XMPPNode.class_from_registration(:create, 'http://jabber.org/protocol/pubsub').should == Blather::Stanza::PubSub::Create
  end

  it 'can be imported' do
    Blather::XMPPNode.parse(<<-NODE).should be_instance_of Blather::Stanza::PubSub::Create
    <iq type='set'
        from='hamlet@denmark.lit/elsinore'
        to='pubsub.shakespeare.lit'
        id='create1'>
      <pubsub xmlns='http://jabber.org/protocol/pubsub'>
        <create node='princely_musings'/>
        <configure/>
      </pubsub>
    </iq>
    NODE
  end

  it 'ensures a create node is present on create' do
    create = Blather::Stanza::PubSub::Create.new
    create.find('//ns:pubsub/ns:create', :ns => Blather::Stanza::PubSub.registered_ns).should_not be_empty
  end

  it 'ensures a configure node is present on create' do
    create = Blather::Stanza::PubSub::Create.new
    create.find('//ns:pubsub/ns:configure', :ns => Blather::Stanza::PubSub.registered_ns).should_not be_empty
  end

  it 'ensures a create node exists when calling #create_node' do
    create = Blather::Stanza::PubSub::Create.new
    create.pubsub.remove_children :create
    create.find('//ns:pubsub/ns:create', :ns => Blather::Stanza::PubSub.registered_ns).should be_empty

    create.create_node.should_not be_nil
    create.find('//ns:pubsub/ns:create', :ns => Blather::Stanza::PubSub.registered_ns).should_not be_empty
  end

  it 'defaults to a set node' do
    create = Blather::Stanza::PubSub::Create.new
    create.type.should == :set
  end

  it 'sets the host if requested' do
    create = Blather::Stanza::PubSub::Create.new :set, 'pubsub.jabber.local'
    create.to.should == Blather::JID.new('pubsub.jabber.local')
  end

  it 'sets the node' do
    create = Blather::Stanza::PubSub::Create.new :set, 'host', 'node-name'
    create.node.should == 'node-name'
  end
end

Version data entries

22 entries across 22 versions & 2 rubygems

Version Path
blather-1.2.0 spec/blather/stanza/pubsub/create_spec.rb
blather-1.1.4 spec/blather/stanza/pubsub/create_spec.rb
blather-1.1.3 spec/blather/stanza/pubsub/create_spec.rb
blather-1.1.2 spec/blather/stanza/pubsub/create_spec.rb
blather-1.1.1 spec/blather/stanza/pubsub/create_spec.rb
blather-1.1.0 spec/blather/stanza/pubsub/create_spec.rb
blather-1.0.0 spec/blather/stanza/pubsub/create_spec.rb
blather-0.8.8 spec/blather/stanza/pubsub/create_spec.rb
blather-0.8.7 spec/blather/stanza/pubsub/create_spec.rb
blather-0.8.6 spec/blather/stanza/pubsub/create_spec.rb
blather-0.8.5 spec/blather/stanza/pubsub/create_spec.rb
blather-0.8.4 spec/blather/stanza/pubsub/create_spec.rb
blather-0.8.3 spec/blather/stanza/pubsub/create_spec.rb
blather-0.8.2 spec/blather/stanza/pubsub/create_spec.rb
tp-blather-0.8.5 spec/blather/stanza/pubsub/create_spec.rb
tp-blather-0.8.4 spec/blather/stanza/pubsub/create_spec.rb
tp-blather-0.8.3 spec/blather/stanza/pubsub/create_spec.rb
tp-blather-0.8.2 spec/blather/stanza/pubsub/create_spec.rb
blather-0.8.1 spec/blather/stanza/pubsub/create_spec.rb
blather-0.8.0 spec/blather/stanza/pubsub/create_spec.rb