vines 0.4.5 → 0.4.6

Sign up to get free protection for your applications and to get access to all the features.
Files changed (89) hide show
  1. data/Gemfile +3 -0
  2. data/README.md +48 -0
  3. data/Rakefile +6 -58
  4. data/bin/vines +12 -2
  5. data/conf/certs/ca-bundle.crt +568 -39
  6. data/conf/config.rb +9 -42
  7. data/lib/vines.rb +1 -8
  8. data/lib/vines/command/cert.rb +4 -4
  9. data/lib/vines/command/init.rb +3 -3
  10. data/lib/vines/config.rb +9 -0
  11. data/lib/vines/kit.rb +2 -7
  12. data/lib/vines/storage/local.rb +50 -17
  13. data/lib/vines/store.rb +6 -4
  14. data/lib/vines/stream.rb +1 -1
  15. data/lib/vines/stream/http/session.rb +0 -0
  16. data/lib/vines/stream/http/sessions.rb +0 -0
  17. data/lib/vines/stream/parser.rb +3 -2
  18. data/lib/vines/token_bucket.rb +19 -10
  19. data/lib/vines/version.rb +1 -1
  20. data/test/cluster/publisher_test.rb +45 -33
  21. data/test/cluster/sessions_test.rb +32 -39
  22. data/test/cluster/subscriber_test.rb +93 -78
  23. data/test/config/host_test.rb +2 -4
  24. data/test/config/pubsub_test.rb +132 -126
  25. data/test/config_test.rb +2 -4
  26. data/test/contact_test.rb +80 -66
  27. data/test/error_test.rb +54 -55
  28. data/test/jid_test.rb +1 -2
  29. data/test/kit_test.rb +22 -17
  30. data/test/router_test.rb +187 -146
  31. data/test/stanza/iq/disco_info_test.rb +59 -59
  32. data/test/stanza/iq/disco_items_test.rb +36 -34
  33. data/test/stanza/iq/private_storage_test.rb +138 -143
  34. data/test/stanza/iq/roster_test.rb +198 -175
  35. data/test/stanza/iq/session_test.rb +17 -18
  36. data/test/stanza/iq/vcard_test.rb +117 -116
  37. data/test/stanza/iq/version_test.rb +47 -46
  38. data/test/stanza/iq_test.rb +53 -49
  39. data/test/stanza/message_test.rb +92 -89
  40. data/test/stanza/presence/probe_test.rb +2 -5
  41. data/test/stanza/presence/subscribe_test.rb +67 -54
  42. data/test/stanza/pubsub/create_test.rb +86 -108
  43. data/test/stanza/pubsub/delete_test.rb +141 -114
  44. data/test/stanza/pubsub/publish_test.rb +256 -320
  45. data/test/stanza/pubsub/subscribe_test.rb +169 -150
  46. data/test/stanza/pubsub/unsubscribe_test.rb +111 -142
  47. data/test/stanza_test.rb +61 -54
  48. data/test/storage/ldap_test.rb +1 -2
  49. data/test/storage/local_test.rb +3 -5
  50. data/test/storage/null_test.rb +3 -4
  51. data/test/storage/storage_tests.rb +1 -3
  52. data/test/storage_test.rb +1 -2
  53. data/test/store_test.rb +1 -2
  54. data/test/stream/client/auth_test.rb +61 -63
  55. data/test/stream/client/ready_test.rb +7 -8
  56. data/test/stream/client/session_test.rb +19 -18
  57. data/test/stream/component/handshake_test.rb +40 -37
  58. data/test/stream/component/ready_test.rb +76 -61
  59. data/test/stream/component/start_test.rb +7 -8
  60. data/test/stream/http/auth_test.rb +3 -4
  61. data/test/stream/http/ready_test.rb +52 -60
  62. data/test/stream/http/request_test.rb +1 -3
  63. data/test/stream/http/sessions_test.rb +2 -3
  64. data/test/stream/http/start_test.rb +3 -4
  65. data/test/stream/parser_test.rb +3 -4
  66. data/test/stream/sasl_test.rb +105 -86
  67. data/test/stream/server/auth_test.rb +40 -36
  68. data/test/stream/server/outbound/auth_test.rb +3 -4
  69. data/test/stream/server/ready_test.rb +51 -51
  70. data/test/test_helper.rb +42 -0
  71. data/test/token_bucket_test.rb +38 -18
  72. data/test/user_test.rb +79 -49
  73. data/vines.gemspec +33 -0
  74. data/web/chat/javascripts/app.js +1 -1
  75. data/web/lib/coffeescripts/layout.coffee +1 -1
  76. data/web/lib/javascripts/base.js +10 -10
  77. data/web/lib/javascripts/jquery.js +4 -4
  78. metadata +31 -128
  79. data/README +0 -35
  80. data/lib/vines/storage/couchdb.rb +0 -129
  81. data/lib/vines/storage/mongodb.rb +0 -132
  82. data/lib/vines/storage/redis.rb +0 -127
  83. data/lib/vines/storage/sql.rb +0 -220
  84. data/test/rake_test_loader.rb +0 -17
  85. data/test/storage/couchdb_test.rb +0 -107
  86. data/test/storage/mock_mongo.rb +0 -40
  87. data/test/storage/mongodb_test.rb +0 -81
  88. data/test/storage/redis_test.rb +0 -51
  89. data/test/storage/sql_test.rb +0 -62
@@ -1,49 +1,52 @@
1
1
  # encoding: UTF-8
2
2
 
3
- require 'vines'
4
- require 'minitest/autorun'
3
+ require 'test_helper'
5
4
 
6
- class HandshakeTest < MiniTest::Unit::TestCase
7
- def setup
8
- @stream = MiniTest::Mock.new
9
- @state = Vines::Stream::Component::Handshake.new(@stream)
10
- end
11
-
12
- def test_invalid_element
13
- node = node('<message/>')
14
- assert_raises(Vines::StreamErrors::NotAuthorized) { @state.node(node) }
15
- end
5
+ describe Vines::Stream::Component::Handshake do
6
+ subject { Vines::Stream::Component::Handshake.new(stream) }
7
+ let(:stream) { MiniTest::Mock.new }
16
8
 
17
- def test_missing_text
18
- @stream.expect(:secret, 'secr3t')
19
- node = node('<handshake/>')
20
- assert_raises(Vines::StreamErrors::NotAuthorized) { @state.node(node) }
21
- assert @stream.verify
9
+ describe 'when invalid element is received' do
10
+ it 'raises a not-authorized stream error' do
11
+ node = node('<message/>')
12
+ -> { subject.node(node) }.must_raise Vines::StreamErrors::NotAuthorized
13
+ end
22
14
  end
23
15
 
24
- def test_invalid_secret
25
- @stream.expect(:secret, 'secr3t')
26
- node = node('<handshake>bogus</handshake>')
27
- assert_raises(Vines::StreamErrors::NotAuthorized) { @state.node(node) }
28
- assert @stream.verify
16
+ describe 'when handshake with no text is received' do
17
+ it 'raises a not-authorized stream error' do
18
+ stream.expect :secret, 'secr3t'
19
+ node = node('<handshake/>')
20
+ -> { subject.node(node) }.must_raise Vines::StreamErrors::NotAuthorized
21
+ stream.verify
22
+ end
29
23
  end
30
24
 
31
- def test_valid_secret
32
- router = MiniTest::Mock.new
33
- router.expect(:<<, nil, [@stream])
34
- @stream.expect(:router, router)
35
- @stream.expect(:secret, 'secr3t')
36
- @stream.expect(:write, nil, ['<handshake/>'])
37
- @stream.expect(:advance, nil, [Vines::Stream::Component::Ready.new(@stream)])
38
- node = node('<handshake>secr3t</handshake>')
39
- @state.node(node)
40
- assert @stream.verify
41
- assert router.verify
25
+ describe 'when handshake with invalid secret is received' do
26
+ it 'raises a not-authorized stream error' do
27
+ stream.expect :secret, 'secr3t'
28
+ node = node('<handshake>bogus</handshake>')
29
+ -> { subject.node(node) }.must_raise Vines::StreamErrors::NotAuthorized
30
+ stream.verify
31
+ end
42
32
  end
43
33
 
44
- private
45
-
46
- def node(xml)
47
- Nokogiri::XML(xml).root
34
+ describe 'when good handshake is received' do
35
+ let(:router) { MiniTest::Mock.new }
36
+
37
+ before do
38
+ router.expect :<<, nil, [stream]
39
+ stream.expect :router, router
40
+ stream.expect :secret, 'secr3t'
41
+ stream.expect :write, nil, ['<handshake/>']
42
+ stream.expect :advance, nil, [Vines::Stream::Component::Ready.new(stream)]
43
+ end
44
+
45
+ it 'completes the handshake and advances the stream into the ready state' do
46
+ node = node('<handshake>secr3t</handshake>')
47
+ subject.node(node)
48
+ stream.verify
49
+ router.verify
50
+ end
48
51
  end
49
52
  end
@@ -1,88 +1,103 @@
1
1
  # encoding: UTF-8
2
2
 
3
- require 'tmpdir'
4
- require 'vines'
5
- require 'ext/nokogiri'
6
- require 'minitest/autorun'
7
-
8
- class ComponentReadyTest < MiniTest::Unit::TestCase
9
- def setup
10
- @stream = MiniTest::Mock.new
11
- @state = Vines::Stream::Component::Ready.new(@stream, nil)
12
- @config = Vines::Config.new do
3
+ require 'test_helper'
4
+
5
+ describe Vines::Stream::Component::Ready do
6
+ subject { Vines::Stream::Component::Ready.new(stream, nil) }
7
+ let(:alice) { Vines::User.new(jid: 'alice@tea.wonderland.lit') }
8
+ let(:hatter) { Vines::User.new(jid: 'hatter@wonderland.lit') }
9
+ let(:stream) { MiniTest::Mock.new }
10
+ let(:config) do
11
+ Vines::Config.new do
13
12
  host 'wonderland.lit' do
14
13
  storage(:fs) { dir Dir.tmpdir }
15
14
  end
16
15
  end
17
16
  end
18
17
 
19
- def test_missing_to_and_from_addresses
20
- node = node('<message/>')
21
- assert_raises(Vines::StreamErrors::ImproperAddressing) { @state.node(node) }
22
- assert @stream.verify
18
+ before do
19
+ class << stream
20
+ attr_accessor :config
21
+ end
22
+ stream.config = config
23
23
  end
24
24
 
25
- def test_missing_from_address
26
- node = node(%q{<message to="hatter@wonderland.lit"/>})
27
- assert_raises(Vines::StreamErrors::ImproperAddressing) { @state.node(node) }
28
- assert @stream.verify
25
+ describe 'when missing to and from addresses' do
26
+ it 'raises an improper-addressing stream error' do
27
+ node = node('<message/>')
28
+ -> { subject.node(node) }.must_raise Vines::StreamErrors::ImproperAddressing
29
+ stream.verify
30
+ end
29
31
  end
30
32
 
31
- def test_missing_to_address
32
- node = node(%q{<message from="alice@tea.wonderland.lit"/>})
33
- assert_raises(Vines::StreamErrors::ImproperAddressing) { @state.node(node) }
34
- assert @stream.verify
33
+ describe 'when missing from address' do
34
+ it 'raises an improper-addressing stream error' do
35
+ node = node(%q{<message to="hatter@wonderland.lit"/>})
36
+ -> { subject.node(node) }.must_raise Vines::StreamErrors::ImproperAddressing
37
+ stream.verify
38
+ end
35
39
  end
36
40
 
37
- def test_invalid_from_address
38
- @stream.expect(:remote_domain, 'tea.wonderland.lit')
39
- node = node(%q{<message from="alice@bogus.wonderland.lit" to="hatter@wonderland.lit"/>})
40
- assert_raises(Vines::StreamErrors::InvalidFrom) { @state.node(node) }
41
- assert @stream.verify
41
+ describe 'when missing to address' do
42
+ it 'raises an improper-addressing stream error' do
43
+ node = node(%q{<message from="alice@tea.wonderland.lit"/>})
44
+ -> { subject.node(node) }.must_raise Vines::StreamErrors::ImproperAddressing
45
+ stream.verify
46
+ end
42
47
  end
43
48
 
44
- def test_unsupported_stanza_type
45
- node = node('<bogus/>')
46
- assert_raises(Vines::StreamErrors::UnsupportedStanzaType) { @state.node(node) }
47
- assert @stream.verify
49
+ describe 'when from address domain does not match component domain' do
50
+ it 'raises and invalid-from stream error' do
51
+ stream.expect :remote_domain, 'tea.wonderland.lit'
52
+ node = node(%q{<message from="alice@bogus.wonderland.lit" to="hatter@wonderland.lit"/>})
53
+ -> { subject.node(node) }.must_raise Vines::StreamErrors::InvalidFrom
54
+ stream.verify
55
+ end
48
56
  end
49
57
 
50
- def test_remote_message_routes
51
- node = node(%q{<message from="alice@tea.wonderland.lit" to="romeo@verona.lit"/>})
52
- @stream.expect(:remote_domain, 'tea.wonderland.lit')
53
- @stream.expect(:config, @config)
54
- @stream.expect(:user=, nil, [Vines::User.new(:jid => 'alice@tea.wonderland.lit')])
55
-
56
- @router = MiniTest::Mock.new
57
- @router.expect(:route, nil, [node])
58
- @stream.expect(:router, @router)
59
-
60
- @state.node(node)
61
- assert @stream.verify
62
- assert @router.verify
58
+ describe 'when unrecognized element is received' do
59
+ it 'raises an unsupported-stanza-type stream error' do
60
+ node = node('<bogus/>')
61
+ -> { subject.node(node) }.must_raise Vines::StreamErrors::UnsupportedStanzaType
62
+ stream.verify
63
+ end
63
64
  end
64
65
 
65
- def test_local_message_processes
66
- node = node(%q{<message from="alice@tea.wonderland.lit" to="hatter@wonderland.lit"/>})
67
- @stream.expect(:remote_domain, 'tea.wonderland.lit')
68
- @stream.expect(:config, @config)
69
- @stream.expect(:user=, nil, [Vines::User.new(:jid => 'alice@tea.wonderland.lit')])
70
- @stream.expect(:user, Vines::User.new(:jid => 'alice@tea.wonderland.lit'))
66
+ describe 'when addressed to a remote jid' do
67
+ let(:router) { MiniTest::Mock.new }
68
+ let(:xml) { node(%q{<message from="alice@tea.wonderland.lit" to="romeo@verona.lit"/>}) }
71
69
 
72
- @recipient = MiniTest::Mock.new
73
- @recipient.expect(:user, Vines::User.new(:jid => 'hatter@wonderland.lit'))
74
- @recipient.expect(:write, nil, [node])
75
-
76
- @stream.expect(:connected_resources, [@recipient], [Vines::JID.new('hatter@wonderland.lit')])
70
+ before do
71
+ router.expect :route, nil, [xml]
72
+ stream.expect :remote_domain, 'tea.wonderland.lit'
73
+ stream.expect :user=, nil, [alice]
74
+ stream.expect :router, router
75
+ end
77
76
 
78
- @state.node(node)
79
- assert @stream.verify
80
- assert @recipient.verify
77
+ it 'routes rather than handle locally' do
78
+ subject.node(xml)
79
+ stream.verify
80
+ router.verify
81
+ end
81
82
  end
82
83
 
83
- private
84
+ describe 'when addressed to a local jid' do
85
+ let(:recipient) { MiniTest::Mock.new }
86
+ let(:xml) { node(%q{<message from="alice@tea.wonderland.lit" to="hatter@wonderland.lit"/>}) }
87
+
88
+ before do
89
+ recipient.expect :user, hatter
90
+ recipient.expect :write, nil, [xml]
91
+ stream.expect :remote_domain, 'tea.wonderland.lit'
92
+ stream.expect :user=, nil, [alice]
93
+ stream.expect :user, alice
94
+ stream.expect :connected_resources, [recipient], [hatter.jid]
95
+ end
84
96
 
85
- def node(xml)
86
- Nokogiri::XML(xml).root
97
+ it 'sends the message to the connected stream' do
98
+ subject.node(xml)
99
+ stream.verify
100
+ recipient.verify
101
+ end
87
102
  end
88
103
  end
@@ -1,30 +1,29 @@
1
1
  # encoding: UTF-8
2
2
 
3
- require 'vines'
4
- require 'minitest/autorun'
3
+ require 'test_helper'
5
4
 
6
- class ComponentStartTest < MiniTest::Unit::TestCase
7
- def setup
5
+ describe Vines::Stream::Component::Start do
6
+ before do
8
7
  @stream = MiniTest::Mock.new
9
8
  @state = Vines::Stream::Component::Start.new(@stream)
10
9
  end
11
10
 
12
- def test_invalid_element
11
+ it 'raises not-authorized stream error for invalid element' do
13
12
  node = node('<message/>')
14
13
  assert_raises(Vines::StreamErrors::NotAuthorized) { @state.node(node) }
15
14
  end
16
15
 
17
- def test_missing_stream_namespace
16
+ it 'raises not-authorized stream error for missing stream namespace' do
18
17
  node = node('<stream:stream/>')
19
18
  assert_raises(Vines::StreamErrors::NotAuthorized) { @state.node(node) }
20
19
  end
21
20
 
22
- def test_invalid_stream_namespace
21
+ it 'raises not-authorized stream error for invalid stream namespace' do
23
22
  node = node('<stream:stream xmlns="bogus"/>')
24
23
  assert_raises(Vines::StreamErrors::NotAuthorized) { @state.node(node) }
25
24
  end
26
25
 
27
- def test_valid_stream_header
26
+ it 'advances the state machine for valid stream header' do
28
27
  node = node(%q{<stream:stream xmlns:stream="http://etherx.jabber.org/streams" xmlns="jabber:component:accept" to="tea.wonderland.lit"/>})
29
28
  @stream.expect(:start, nil, [node])
30
29
  @stream.expect(:advance, nil, [Vines::Stream::Component::Handshake.new(@stream)])
@@ -1,10 +1,9 @@
1
1
  # encoding: UTF-8
2
2
 
3
- require 'vines'
4
- require 'minitest/autorun'
3
+ require 'test_helper'
5
4
 
6
- class HttpAuthTest < MiniTest::Unit::TestCase
7
- def setup
5
+ describe Vines::Stream::Http::Auth do
6
+ before do
8
7
  @stream = MiniTest::Mock.new
9
8
  @state = Vines::Stream::Http::Auth.new(@stream, nil)
10
9
  end
@@ -1,94 +1,86 @@
1
1
  # encoding: UTF-8
2
2
 
3
- require 'tmpdir'
4
- require 'vines'
5
- require 'minitest/autorun'
3
+ require 'test_helper'
6
4
 
7
5
  describe Vines::Stream::Http::Ready do
8
- before do
9
- @stream = MiniTest::Mock.new
10
- @state = Vines::Stream::Http::Ready.new(@stream, nil)
6
+ subject { Vines::Stream::Http::Ready.new(stream, nil) }
7
+ let(:stream) { MiniTest::Mock.new }
8
+ let(:alice) { Vines::User.new(jid: 'alice@wonderland.lit') }
9
+ let(:hatter) { Vines::User.new(jid: 'hatter@wonderland.lit') }
10
+ let(:config) do
11
+ Vines::Config.new do
12
+ host 'wonderland.lit' do
13
+ storage(:fs) { dir Dir.tmpdir }
14
+ end
15
+ end
11
16
  end
12
17
 
13
18
  it "raises when body element is missing" do
14
19
  node = node('<presence type="unavailable"/>')
15
- @stream.expect(:valid_session?, true, [nil])
16
- -> { @state.node(node) }.must_raise Vines::StreamErrors::NotAuthorized
20
+ stream.expect :valid_session?, true, [nil]
21
+ -> { subject.node(node) }.must_raise Vines::StreamErrors::NotAuthorized
17
22
  end
18
23
 
19
24
  it "raises when namespace is missing" do
20
25
  node = node('<body rid="42" sid="12"/>')
21
- @stream.expect(:valid_session?, true, ['12'])
22
- assert_raises(Vines::StreamErrors::NotAuthorized) { @state.node(node) }
23
- -> { @state.node(node) }.must_raise Vines::StreamErrors::NotAuthorized
26
+ stream.expect :valid_session?, true, ['12']
27
+ -> { subject.node(node) }.must_raise Vines::StreamErrors::NotAuthorized
24
28
  end
25
29
 
26
30
  it "raises when rid attribute is missing" do
27
31
  node = node('<body xmlns="http://jabber.org/protocol/httpbind" sid="12"/>')
28
- @stream.expect(:valid_session?, true, ['12'])
29
- -> { @state.node(node) }.must_raise Vines::StreamErrors::NotAuthorized
32
+ stream.expect :valid_session?, true, ['12']
33
+ -> { subject.node(node) }.must_raise Vines::StreamErrors::NotAuthorized
30
34
  end
31
35
 
32
36
  it "raises when session id is invalid" do
33
- @stream.expect(:valid_session?, false, ['12'])
37
+ stream.expect :valid_session?, false, ['12']
34
38
  node = node('<body xmlns="http://jabber.org/protocol/httpbind" rid="42" sid="12"/>')
35
- -> { @state.node(node) }.must_raise Vines::StreamErrors::NotAuthorized
36
- assert @stream.verify
39
+ -> { subject.node(node) }.must_raise Vines::StreamErrors::NotAuthorized
40
+ stream.verify
37
41
  end
38
42
 
39
43
  it "processes when body element is empty" do
40
44
  node = node('<body xmlns="http://jabber.org/protocol/httpbind" rid="42" sid="12"/>')
41
- @stream.expect(:valid_session?, true, ['12'])
42
- @stream.expect(:parse_body, [], [node])
43
- @state.node(node)
44
- assert @stream.verify
45
+ stream.expect :valid_session?, true, ['12']
46
+ stream.expect :parse_body, [], [node]
47
+ subject.node(node)
48
+ stream.verify
45
49
  end
46
50
 
47
- it "processes all stanzas in one body element" do
48
- alice = Vines::User.new(jid: 'alice@wonderland.lit')
49
- hatter = Vines::User.new(jid: 'hatter@wonderland.lit')
50
-
51
- config = Vines::Config.new do
52
- host 'wonderland.lit' do
53
- storage(:fs) { dir Dir.tmpdir }
54
- end
51
+ describe 'when receiving multiple stanzas in one body element' do
52
+ let(:recipient) { MiniTest::Mock.new }
53
+ let(:bogus) { node('<message type="bogus">raises stanza error</message>') }
54
+ let(:ok) { node('<message to="hatter@wonderland.lit">but processes this message</message>') }
55
+ let(:xml) { node(%Q{<body xmlns="http://jabber.org/protocol/httpbind" rid="42" sid="12">#{bogus}#{ok}</body>}) }
56
+ let(:raises) { Vines::Stanza.from_node(bogus, stream) }
57
+ let(:processes) { Vines::Stanza.from_node(ok, stream) }
58
+
59
+ before do
60
+ recipient.expect :user, hatter
61
+ recipient.expect :write, nil, [Vines::Stanza::Message]
62
+
63
+ stream.expect :valid_session?, true, ['12']
64
+ stream.expect :parse_body, [raises, processes], [xml]
65
+ stream.expect :error, nil, [Vines::StanzaErrors::BadRequest]
66
+ stream.expect :config, config
67
+ stream.expect :user, alice
68
+ stream.expect :connected_resources, [recipient], [hatter.jid]
55
69
  end
56
70
 
57
- bogus = node('<message type="bogus">raises stanza error</message>')
58
- ok = node('<message to="hatter@wonderland.lit">but processes this message</message>')
59
- node = node(%Q{<body xmlns="http://jabber.org/protocol/httpbind" rid="42" sid="12">#{bogus}#{ok}</body>})
60
-
61
- raises = Vines::Stanza.from_node(bogus, @stream)
62
- processes = Vines::Stanza.from_node(ok, @stream)
63
-
64
- recipient = MiniTest::Mock.new
65
- recipient.expect(:user, hatter)
66
- recipient.expect(:write, nil, [Vines::Stanza::Message])
67
-
68
- @stream.expect(:valid_session?, true, ['12'])
69
- @stream.expect(:parse_body, [raises, processes], [node])
70
- @stream.expect(:error, nil, [Vines::StanzaErrors::BadRequest])
71
- @stream.expect(:config, config)
72
- @stream.expect(:user, alice)
73
- @stream.expect(:connected_resources, [recipient], [hatter.jid])
74
-
75
- @state.node(node)
76
- assert @stream.verify
77
- assert recipient.verify
71
+ it 'processes all stanzas' do
72
+ subject.node(xml)
73
+ stream.verify
74
+ recipient.verify
75
+ end
78
76
  end
79
77
 
80
78
  it "terminates the session" do
81
79
  node = node('<body xmlns="http://jabber.org/protocol/httpbind" rid="42" sid="12" type="terminate"/>')
82
- @stream.expect(:valid_session?, true, ['12'])
83
- @stream.expect(:parse_body, [], [node])
84
- @stream.expect(:terminate, nil)
85
- @state.node(node)
86
- assert @stream.verify
87
- end
88
-
89
- private
90
-
91
- def node(xml)
92
- Nokogiri::XML(xml).root
80
+ stream.expect :valid_session?, true, ['12']
81
+ stream.expect :parse_body, [], [node]
82
+ stream.expect :terminate, nil
83
+ subject.node(node)
84
+ stream.verify
93
85
  end
94
86
  end