Sha256: 99aebd63f4847dca1fa2813901acf6387c8570f50f905a84575aa645f802d5c3

Contents?: true

Size: 1.21 KB

Versions: 22

Compression:

Stored size: 1.21 KB

Contents

require 'spec_helper'

def muc_xml
  <<-XML
    <presence from='hag66@shakespeare.lit/pda'
              id='n13mt3l'
              to='coven@chat.shakespeare.lit/thirdwitch'>
      <x xmlns='http://jabber.org/protocol/muc'/>
    </presence>
  XML
end

describe 'Blather::Stanza::Presence::MUC' do
  it 'registers itself' do
    Blather::XMPPNode.class_from_registration(:x, 'http://jabber.org/protocol/muc' ).should == Blather::Stanza::Presence::MUC
  end

  it 'must be importable' do
    c = Blather::XMPPNode.parse(muc_xml)
    c.should be_kind_of Blather::Stanza::Presence::MUC::InstanceMethods
    c.xpath('ns:x', :ns => Blather::Stanza::Presence::MUC.registered_ns).count.should == 1
  end

  it 'ensures a form node is present on create' do
    c = Blather::Stanza::Presence::MUC.new
    c.xpath('ns:x', :ns => Blather::Stanza::Presence::MUC.registered_ns).should_not be_empty
  end

  it 'ensures a form node exists when calling #muc' do
    c = Blather::Stanza::Presence::MUC.new
    c.remove_children :x
    c.xpath('ns:x', :ns => Blather::Stanza::Presence::MUC.registered_ns).should be_empty

    c.muc.should_not be_nil
    c.xpath('ns:x', :ns => Blather::Stanza::Presence::MUC.registered_ns).should_not be_empty
  end
end

Version data entries

22 entries across 22 versions & 2 rubygems

Version Path
blather-1.2.0 spec/blather/stanza/presence/muc_spec.rb
blather-1.1.4 spec/blather/stanza/presence/muc_spec.rb
blather-1.1.3 spec/blather/stanza/presence/muc_spec.rb
blather-1.1.2 spec/blather/stanza/presence/muc_spec.rb
blather-1.1.1 spec/blather/stanza/presence/muc_spec.rb
blather-1.1.0 spec/blather/stanza/presence/muc_spec.rb
blather-1.0.0 spec/blather/stanza/presence/muc_spec.rb
blather-0.8.8 spec/blather/stanza/presence/muc_spec.rb
blather-0.8.7 spec/blather/stanza/presence/muc_spec.rb
blather-0.8.6 spec/blather/stanza/presence/muc_spec.rb
blather-0.8.5 spec/blather/stanza/presence/muc_spec.rb
blather-0.8.4 spec/blather/stanza/presence/muc_spec.rb
blather-0.8.3 spec/blather/stanza/presence/muc_spec.rb
blather-0.8.2 spec/blather/stanza/presence/muc_spec.rb
tp-blather-0.8.5 spec/blather/stanza/presence/muc_spec.rb
tp-blather-0.8.4 spec/blather/stanza/presence/muc_spec.rb
tp-blather-0.8.3 spec/blather/stanza/presence/muc_spec.rb
tp-blather-0.8.2 spec/blather/stanza/presence/muc_spec.rb
blather-0.8.1 spec/blather/stanza/presence/muc_spec.rb
blather-0.8.0 spec/blather/stanza/presence/muc_spec.rb