require 'spec_helper' def muc_user_xml <<-XML XML end describe 'Blather::Stanza::Presence::MUCUser' do it 'registers itself' do Blather::XMPPNode.class_from_registration(:x, 'http://jabber.org/protocol/muc#user' ).must_equal Blather::Stanza::Presence::MUCUser end it 'must be importable' do muc_user = Blather::XMPPNode.import(parse_stanza(muc_user_xml).root) muc_user.must_be_instance_of Blather::Stanza::Presence::MUCUser muc_user.affiliation.must_equal :none muc_user.jid.must_equal 'hag66@shakespeare.lit/pda' muc_user.role.must_equal :participant muc_user.status_codes.must_equal [100, 110] end it "must be able to set the affiliation" do muc_user = Blather::Stanza::Presence::MUCUser.new muc_user.affiliation.must_equal nil muc_user.affiliation = :none muc_user.affiliation.must_equal :none end it "must be able to set the role" do muc_user = Blather::Stanza::Presence::MUCUser.new muc_user.role.must_equal nil muc_user.role = :participant muc_user.role.must_equal :participant end it "must be able to set the jid" do muc_user = Blather::Stanza::Presence::MUCUser.new muc_user.jid.must_equal nil muc_user.jid = 'foo@bar.com' muc_user.jid.must_equal 'foo@bar.com' end it "must be able to set the status codes" do muc_user = Blather::Stanza::Presence::MUCUser.new muc_user.status_codes.must_equal [] muc_user.status_codes = [100, 110] muc_user.status_codes.must_equal [100, 110] muc_user.status_codes = [500] muc_user.status_codes.must_equal [500] end end