spec/blather/stanza/pubsub/event_spec.rb in blather-0.4.14 vs spec/blather/stanza/pubsub/event_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::Event do
it 'registers itself' do
Blather::XMPPNode.class_from_registration(:event, 'http://jabber.org/protocol/pubsub#event').must_equal Blather::Stanza::PubSub::Event
end
@@ -78,7 +78,21 @@
</event>
</message>
NODE
evt.purge?.wont_be_nil
evt.node.must_equal 'princely_musings'
+ end
+
+ it 'can be a subscription notification' do
+ evt = Blather::XMPPNode.import(parse_stanza(<<-NODE).root)
+ <message from='pubsub.shakespeare.lit' to='francisco@denmark.lit' id='foo'>
+ <event xmlns='http://jabber.org/protocol/pubsub#event'>
+ <subscription jid='francisco@denmark.lit' subscription='subscribed' node='/example.com/test'/>
+ </event>
+ </message>
+ NODE
+ evt.subscription?.wont_be_nil
+ evt.subscription[:jid].must_equal 'francisco@denmark.lit'
+ evt.subscription[:subscription].must_equal 'subscribed'
+ evt.subscription[:node].must_equal '/example.com/test'
end
end