Sha256: ab6b3f7fa6d8ebb2c1b9705e76d61e5371a79afbe72131e8064b4da8ccdb6e43

Contents?: true

Size: 1.75 KB

Versions: 22

Compression:

Stored size: 1.75 KB

Contents

require 'spec_helper'
require 'fixtures/pubsub'

describe Blather::Stanza::PubSubOwner::Delete do
  it 'registers itself' do
    Blather::XMPPNode.class_from_registration(:delete, 'http://jabber.org/protocol/pubsub#owner').should == Blather::Stanza::PubSubOwner::Delete
  end

  it 'can be imported' do
    Blather::XMPPNode.parse(<<-NODE).should be_instance_of Blather::Stanza::PubSubOwner::Delete
    <iq type='set'
        from='hamlet@denmark.lit/elsinore'
        to='pubsub.shakespeare.lit'
        id='delete1'>
      <pubsub xmlns='http://jabber.org/protocol/pubsub#owner'>
        <delete node='princely_musings'/>
      </pubsub>
    </iq>
    NODE
  end

  it 'ensures an delete node is present on delete' do
    delete = Blather::Stanza::PubSubOwner::Delete.new
    delete.find('//ns:pubsub/ns:delete', :ns => Blather::Stanza::PubSubOwner.registered_ns).should_not be_empty
  end

  it 'ensures an delete node exists when calling #delete_node' do
    delete = Blather::Stanza::PubSubOwner::Delete.new
    delete.pubsub.remove_children :delete
    delete.find('//ns:pubsub/ns:delete', :ns => Blather::Stanza::PubSubOwner.registered_ns).should be_empty

    delete.delete_node.should_not be_nil
    delete.find('//ns:pubsub/ns:delete', :ns => Blather::Stanza::PubSubOwner.registered_ns).should_not be_empty
  end

  it 'defaults to a set node' do
    delete = Blather::Stanza::PubSubOwner::Delete.new
    delete.type.should == :set
  end

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

  it 'sets the node' do
    delete = Blather::Stanza::PubSubOwner::Delete.new :set, 'host', 'node-name'
    delete.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_owner/delete_spec.rb
blather-1.1.4 spec/blather/stanza/pubsub_owner/delete_spec.rb
blather-1.1.3 spec/blather/stanza/pubsub_owner/delete_spec.rb
blather-1.1.2 spec/blather/stanza/pubsub_owner/delete_spec.rb
blather-1.1.1 spec/blather/stanza/pubsub_owner/delete_spec.rb
blather-1.1.0 spec/blather/stanza/pubsub_owner/delete_spec.rb
blather-1.0.0 spec/blather/stanza/pubsub_owner/delete_spec.rb
blather-0.8.8 spec/blather/stanza/pubsub_owner/delete_spec.rb
blather-0.8.7 spec/blather/stanza/pubsub_owner/delete_spec.rb
blather-0.8.6 spec/blather/stanza/pubsub_owner/delete_spec.rb
blather-0.8.5 spec/blather/stanza/pubsub_owner/delete_spec.rb
blather-0.8.4 spec/blather/stanza/pubsub_owner/delete_spec.rb
blather-0.8.3 spec/blather/stanza/pubsub_owner/delete_spec.rb
blather-0.8.2 spec/blather/stanza/pubsub_owner/delete_spec.rb
tp-blather-0.8.5 spec/blather/stanza/pubsub_owner/delete_spec.rb
tp-blather-0.8.4 spec/blather/stanza/pubsub_owner/delete_spec.rb
tp-blather-0.8.3 spec/blather/stanza/pubsub_owner/delete_spec.rb
tp-blather-0.8.2 spec/blather/stanza/pubsub_owner/delete_spec.rb
blather-0.8.1 spec/blather/stanza/pubsub_owner/delete_spec.rb
blather-0.8.0 spec/blather/stanza/pubsub_owner/delete_spec.rb