spec/blather/stanza/iq/si_spec.rb in blather-0.6.2 vs spec/blather/stanza/iq/si_spec.rb in blather-0.7.0

- old
+ new

@@ -25,77 +25,74 @@ XML end describe Blather::Stanza::Iq::Si do it 'registers itself' do - Blather::XMPPNode.class_from_registration(:si, 'http://jabber.org/protocol/si').must_equal Blather::Stanza::Iq::Si + Blather::XMPPNode.class_from_registration(:si, 'http://jabber.org/protocol/si').should == Blather::Stanza::Iq::Si end it 'can be imported' do - doc = parse_stanza si_xml - node = Blather::XMPPNode.import(doc.root) - node.must_be_instance_of Blather::Stanza::Iq::Si - node.si.must_be_instance_of Blather::Stanza::Iq::Si::Si + node = Blather::XMPPNode.parse si_xml + node.should be_instance_of Blather::Stanza::Iq::Si + node.si.should be_instance_of Blather::Stanza::Iq::Si::Si end it 'ensures a si node is present on create' do iq = Blather::Stanza::Iq::Si.new - iq.xpath('ns:si', :ns => 'http://jabber.org/protocol/si').wont_be_empty + iq.xpath('ns:si', :ns => 'http://jabber.org/protocol/si').should_not be_empty end it 'ensures a si node exists when calling #si' do iq = Blather::Stanza::Iq::Si.new iq.si.remove - iq.xpath('ns:si', :ns => 'http://jabber.org/protocol/si').must_be_empty + iq.xpath('ns:si', :ns => 'http://jabber.org/protocol/si').should be_empty - iq.si.wont_be_nil - iq.xpath('ns:si', :ns => 'http://jabber.org/protocol/si').wont_be_empty + iq.si.should_not be_nil + iq.xpath('ns:si', :ns => 'http://jabber.org/protocol/si').should_not be_empty end it 'ensures a si node is replaced when calling #si=' do - doc = parse_stanza si_xml - iq = Blather::XMPPNode.import(doc.root) + iq = Blather::XMPPNode.parse si_xml new_si = Blather::Stanza::Iq::Si::Si.new new_si.id = 'a1' iq.si = new_si - iq.xpath('ns:si', :ns => 'http://jabber.org/protocol/si').size.must_equal 1 - iq.si.id.must_equal 'a1' + iq.xpath('ns:si', :ns => 'http://jabber.org/protocol/si').size.should == 1 + iq.si.id.should == 'a1' end end describe Blather::Stanza::Iq::Si::Si do it 'can set and get attributes' do si = Blather::Stanza::Iq::Si::Si.new si.id = 'a1' si.mime_type = 'text/plain' si.profile = 'http://jabber.org/protocol/si/profile/file-transfer' - si.id.must_equal 'a1' - si.mime_type.must_equal 'text/plain' - si.profile.must_equal 'http://jabber.org/protocol/si/profile/file-transfer' + si.id.should == 'a1' + si.mime_type.should == 'text/plain' + si.profile.should == 'http://jabber.org/protocol/si/profile/file-transfer' end end describe Blather::Stanza::Iq::Si::Si::File do it 'can be initialized with name and size' do file = Blather::Stanza::Iq::Si::Si::File.new('test.txt', 123) - file.name.must_equal 'test.txt' - file.size.must_equal 123 + file.name.should == 'test.txt' + file.size.should == 123 end it 'can be initialized with node' do - doc = parse_stanza si_xml - node = Blather::XMPPNode.import(doc.root) + node = Blather::XMPPNode.parse si_xml file = Blather::Stanza::Iq::Si::Si::File.new node.find_first('.//ns:file', :ns => 'http://jabber.org/protocol/si/profile/file-transfer') - file.name.must_equal 'test.txt' - file.size.must_equal 1022 + file.name.should == 'test.txt' + file.size.should == 1022 end it 'can set and get description' do file = Blather::Stanza::Iq::Si::Si::File.new('test.txt', 123) file.desc = 'This is a test. If this were a real file...' - file.desc.must_equal 'This is a test. If this were a real file...' + file.desc.should == 'This is a test. If this were a real file...' end end