# encoding: UTF-8
require 'vines'
require 'ext/nokogiri'
require 'minitest/autorun'
class SessionTest < MiniTest::Unit::TestCase
def test_session
stream = MiniTest::Mock.new
stream.expect(:domain, 'wonderland.lit')
stream.expect(:user, Vines::User.new(jid: 'alice@wonderland.lit/tea'))
expected = node(%q{})
stream.expect(:write, nil, [expected])
node = node(%q{})
stanza = Vines::Stanza::Iq::Session.new(node, stream)
stanza.process
assert stream.verify
end
private
def node(xml)
Nokogiri::XML(xml).root
end
end