spec/blather/stanza/pubsub/unsubscribe_spec.rb in blather-0.4.14 vs spec/blather/stanza/pubsub/unsubscribe_spec.rb in blather-0.4.15

- old
+ new

@@ -1,7 +1,7 @@ -require File.join(File.dirname(__FILE__), *%w[.. .. .. spec_helper]) -require File.join(File.dirname(__FILE__), *%w[.. .. .. fixtures pubsub]) +require File.expand_path "../../../../spec_helper", __FILE__ +require File.expand_path "../../../../fixtures/pubsub", __FILE__ describe Blather::Stanza::PubSub::Unsubscribe do it 'registers itself' do Blather::XMPPNode.class_from_registration(:unsubscribe, 'http://jabber.org/protocol/pubsub').must_equal Blather::Stanza::PubSub::Unsubscribe end @@ -55,7 +55,20 @@ unsubscribe.jid.must_equal Blather::JID.new('jid') unsubscribe.jid = Blather::JID.new('n@d/r') unsubscribe.find('//ns:pubsub/ns:unsubscribe[@jid="n@d/r"]', :ns => Blather::Stanza::PubSub.registered_ns).wont_be_empty unsubscribe.jid.must_equal Blather::JID.new('n@d/r') + end + + it 'has a subid attribute' do + unsubscribe = Blather::Stanza::PubSub::Unsubscribe.new :set, 'host', 'node-name', 'jid' + unsubscribe.find('//ns:pubsub/ns:unsubscribe[@subid="subid"]', :ns => Blather::Stanza::PubSub.registered_ns).must_be_empty + + unsubscribe = Blather::Stanza::PubSub::Unsubscribe.new :set, 'host', 'node-name', 'jid', 'subid' + unsubscribe.find('//ns:pubsub/ns:unsubscribe[@subid="subid"]', :ns => Blather::Stanza::PubSub.registered_ns).wont_be_empty + unsubscribe.subid.must_equal 'subid' + + unsubscribe.subid = 'newsubid' + unsubscribe.find('//ns:pubsub/ns:unsubscribe[@subid="newsubid"]', :ns => Blather::Stanza::PubSub.registered_ns).wont_be_empty + unsubscribe.subid.must_equal 'newsubid' end end