Sha256: a60d420e4185889263a6e138390361b6c4400999a35151eea61772888e884755

Contents?: true

Size: 1.72 KB

Versions: 22

Compression:

Stored size: 1.72 KB

Contents

require 'spec_helper'
require 'fixtures/pubsub'

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

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

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

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

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

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

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

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