spec/blather/stanza/pubsub/subscribe_spec.rb in blather-1.2.0 vs spec/blather/stanza/pubsub/subscribe_spec.rb in blather-2.0.0

- old
+ new

@@ -1,61 +1,61 @@ require 'spec_helper' require 'fixtures/pubsub' describe Blather::Stanza::PubSub::Subscribe do it 'registers itself' do - Blather::XMPPNode.class_from_registration(:subscribe, 'http://jabber.org/protocol/pubsub').should == Blather::Stanza::PubSub::Subscribe + expect(Blather::XMPPNode.class_from_registration(:subscribe, 'http://jabber.org/protocol/pubsub')).to eq(Blather::Stanza::PubSub::Subscribe) end it 'can be imported' do - Blather::XMPPNode.parse(subscribe_xml).should be_instance_of Blather::Stanza::PubSub::Subscribe + expect(Blather::XMPPNode.parse(subscribe_xml)).to be_instance_of Blather::Stanza::PubSub::Subscribe end it 'ensures an subscribe node is present on create' do subscribe = Blather::Stanza::PubSub::Subscribe.new :set, 'host', 'node', 'jid' - subscribe.find('//ns:pubsub/ns:subscribe', :ns => Blather::Stanza::PubSub.registered_ns).should_not be_empty + expect(subscribe.find('//ns:pubsub/ns:subscribe', :ns => Blather::Stanza::PubSub.registered_ns)).not_to be_empty end it 'ensures an subscribe node exists when calling #subscribe' do subscribe = Blather::Stanza::PubSub::Subscribe.new :set, 'host', 'node', 'jid' subscribe.pubsub.remove_children :subscribe - subscribe.find('//ns:pubsub/ns:subscribe', :ns => Blather::Stanza::PubSub.registered_ns).should be_empty + expect(subscribe.find('//ns:pubsub/ns:subscribe', :ns => Blather::Stanza::PubSub.registered_ns)).to be_empty - subscribe.subscribe.should_not be_nil - subscribe.find('//ns:pubsub/ns:subscribe', :ns => Blather::Stanza::PubSub.registered_ns).should_not be_empty + expect(subscribe.subscribe).not_to be_nil + expect(subscribe.find('//ns:pubsub/ns:subscribe', :ns => Blather::Stanza::PubSub.registered_ns)).not_to be_empty end it 'defaults to a set node' do subscribe = Blather::Stanza::PubSub::Subscribe.new :set, 'host', 'node', 'jid' - subscribe.type.should == :set + expect(subscribe.type).to eq(:set) end it 'sets the host if requested' do subscribe = Blather::Stanza::PubSub::Subscribe.new :set, 'pubsub.jabber.local', 'node', 'jid' - subscribe.to.should == Blather::JID.new('pubsub.jabber.local') + expect(subscribe.to).to eq(Blather::JID.new('pubsub.jabber.local')) end it 'sets the node' do subscribe = Blather::Stanza::PubSub::Subscribe.new :set, 'host', 'node-name', 'jid' - subscribe.node.should == 'node-name' + expect(subscribe.node).to eq('node-name') end it 'has a node attribute' do subscribe = Blather::Stanza::PubSub::Subscribe.new :set, 'host', 'node-name', 'jid' - subscribe.find('//ns:pubsub/ns:subscribe[@node="node-name"]', :ns => Blather::Stanza::PubSub.registered_ns).should_not be_empty - subscribe.node.should == 'node-name' + expect(subscribe.find('//ns:pubsub/ns:subscribe[@node="node-name"]', :ns => Blather::Stanza::PubSub.registered_ns)).not_to be_empty + expect(subscribe.node).to eq('node-name') subscribe.node = 'new-node' - subscribe.find('//ns:pubsub/ns:subscribe[@node="new-node"]', :ns => Blather::Stanza::PubSub.registered_ns).should_not be_empty - subscribe.node.should == 'new-node' + expect(subscribe.find('//ns:pubsub/ns:subscribe[@node="new-node"]', :ns => Blather::Stanza::PubSub.registered_ns)).not_to be_empty + expect(subscribe.node).to eq('new-node') end it 'has a jid attribute' do subscribe = Blather::Stanza::PubSub::Subscribe.new :set, 'host', 'node-name', 'jid' - subscribe.find('//ns:pubsub/ns:subscribe[@jid="jid"]', :ns => Blather::Stanza::PubSub.registered_ns).should_not be_empty - subscribe.jid.should == Blather::JID.new('jid') + expect(subscribe.find('//ns:pubsub/ns:subscribe[@jid="jid"]', :ns => Blather::Stanza::PubSub.registered_ns)).not_to be_empty + expect(subscribe.jid).to eq(Blather::JID.new('jid')) subscribe.jid = Blather::JID.new('n@d/r') - subscribe.find('//ns:pubsub/ns:subscribe[@jid="n@d/r"]', :ns => Blather::Stanza::PubSub.registered_ns).should_not be_empty - subscribe.jid.should == Blather::JID.new('n@d/r') + expect(subscribe.find('//ns:pubsub/ns:subscribe[@jid="n@d/r"]', :ns => Blather::Stanza::PubSub.registered_ns)).not_to be_empty + expect(subscribe.jid).to eq(Blather::JID.new('n@d/r')) end end