spec/blather/stanza/discos/disco_info_spec.rb in blather-0.4.14 vs spec/blather/stanza/discos/disco_info_spec.rb in blather-0.4.15

- old
+ new

@@ -1,6 +1,6 @@ -require File.join(File.dirname(__FILE__), *%w[.. .. .. spec_helper]) +require File.expand_path "../../../../spec_helper", __FILE__ def disco_info_xml <<-XML <iq type='result' from='romeo@montague.net/orchard' @@ -8,11 +8,12 @@ id='info4'> <query xmlns='http://jabber.org/protocol/disco#info'> <identity category='client' type='pc' - name='Gabber'/> + name='Gabber' + xml:lang='en'/> <feature var='jabber:iq:time'/> <feature var='jabber:iq:version'/> </query> </iq> XML @@ -180,15 +181,16 @@ end end describe Blather::Stanza::Iq::DiscoInfo::Identity do it 'will auto-inherit nodes' do - n = parse_stanza "<identity name='Personal Events' type='pep' category='pubsub' node='publish' />" + n = parse_stanza "<identity name='Personal Events' type='pep' category='pubsub' node='publish' xml:lang='en' />" i = Blather::Stanza::Iq::DiscoInfo::Identity.new n.root i.name.must_equal 'Personal Events' i.type.must_equal :pep i.category.must_equal :pubsub + i.xml_lang.must_equal 'en' end it 'has a category attribute' do n = Blather::Stanza::Iq::DiscoInfo::Identity.new(*%w[name type cat]) n.category.must_equal :cat @@ -206,9 +208,16 @@ it 'has a name attribute' do n = Blather::Stanza::Iq::DiscoInfo::Identity.new(*%w[name type cat]) n.name.must_equal 'name' n.name = :foo n.name.must_equal 'foo' + end + + it 'has an xml:lang attribute' do + n = Blather::Stanza::Iq::DiscoInfo::Identity.new(*%w[name type cat en]) + n.xml_lang.must_equal 'en' + n.xml_lang = 'de' + n.xml_lang.must_equal 'de' end it 'raises an error if equality is sent a non DiscoInfo::Identity object' do a = Blather::Stanza::Iq::DiscoInfo::Identity.new(*%w[name type cat]) lambda { a == 'foo' }.must_raise RuntimeError