Sha256: b53a188953404116c670fb5cb152f812324c9fd5bb64cee1fff6e603b3921da2

Contents?: true

Size: 729 Bytes

Versions: 6

Compression:

Stored size: 729 Bytes

Contents

# 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{<iq from="wonderland.lit" id="42" to="alice@wonderland.lit/tea" type="result"/>})
    stream.expect(:write, nil, [expected])

    node = node(%q{<iq id="42" type="set"><session xmlns="urn:ietf:params:xml:ns:xmpp-session"/></iq>})
    stanza = Vines::Stanza::Iq::Session.new(node, stream)
    stanza.process
    assert stream.verify
  end

  private

  def node(xml)
    Nokogiri::XML(xml).root
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
vines-0.4.5 test/stanza/iq/session_test.rb
vines-0.4.4 test/stanza/iq/session_test.rb
vines-0.4.3 test/stanza/iq/session_test.rb
vines-0.4.2 test/stanza/iq/session_test.rb
vines-0.4.1 test/stanza/iq/session_test.rb
vines-0.4.0 test/stanza/iq/session_test.rb