blather 0.6.2 → 0.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (78) hide show
  1. data/.rspec +3 -0
  2. data/.travis.yml +1 -8
  3. data/CHANGELOG.md +230 -0
  4. data/Guardfile +4 -4
  5. data/README.md +2 -8
  6. data/Rakefile +14 -27
  7. data/blather.gemspec +8 -18
  8. data/lib/blather.rb +1 -0
  9. data/lib/blather/client/client.rb +8 -0
  10. data/lib/blather/roster.rb +7 -0
  11. data/lib/blather/stanza/iq/roster.rb +1 -1
  12. data/lib/blather/stanza/message/muc_user.rb +2 -0
  13. data/lib/blather/stanza/muc/muc_user_base.rb +4 -3
  14. data/lib/blather/stanza/presence.rb +12 -14
  15. data/lib/blather/stanza/presence/c.rb +58 -62
  16. data/lib/blather/stanza/presence/muc.rb +14 -10
  17. data/lib/blather/stanza/presence/muc_user.rb +47 -36
  18. data/lib/blather/stanza/presence/status.rb +106 -101
  19. data/lib/blather/stanza/presence/subscription.rb +59 -60
  20. data/lib/blather/stream.rb +1 -3
  21. data/lib/blather/stream/features/resource.rb +0 -1
  22. data/lib/blather/version.rb +1 -2
  23. data/lib/blather/xmpp_node.rb +24 -3
  24. data/spec/blather/client/client_spec.rb +64 -64
  25. data/spec/blather/client/dsl/pubsub_spec.rb +127 -127
  26. data/spec/blather/client/dsl_spec.rb +11 -11
  27. data/spec/blather/errors/sasl_error_spec.rb +3 -3
  28. data/spec/blather/errors/stanza_error_spec.rb +26 -26
  29. data/spec/blather/errors/stream_error_spec.rb +22 -22
  30. data/spec/blather/errors_spec.rb +7 -7
  31. data/spec/blather/file_transfer_spec.rb +16 -18
  32. data/spec/blather/jid_spec.rb +29 -29
  33. data/spec/blather/roster_item_spec.rb +18 -18
  34. data/spec/blather/roster_spec.rb +18 -18
  35. data/spec/blather/stanza/discos/disco_info_spec.rb +56 -57
  36. data/spec/blather/stanza/discos/disco_items_spec.rb +33 -33
  37. data/spec/blather/stanza/iq/command_spec.rb +57 -57
  38. data/spec/blather/stanza/iq/ibb_spec.rb +27 -39
  39. data/spec/blather/stanza/iq/ping_spec.rb +13 -9
  40. data/spec/blather/stanza/iq/query_spec.rb +16 -16
  41. data/spec/blather/stanza/iq/roster_spec.rb +29 -30
  42. data/spec/blather/stanza/iq/s5b_spec.rb +10 -13
  43. data/spec/blather/stanza/iq/si_spec.rb +20 -23
  44. data/spec/blather/stanza/iq/vcard_spec.rb +22 -25
  45. data/spec/blather/stanza/iq_spec.rb +12 -12
  46. data/spec/blather/stanza/message/muc_user_spec.rb +36 -36
  47. data/spec/blather/stanza/message_spec.rb +56 -56
  48. data/spec/blather/stanza/presence/c_spec.rb +17 -7
  49. data/spec/blather/stanza/presence/muc_spec.rb +8 -8
  50. data/spec/blather/stanza/presence/muc_user_spec.rb +23 -23
  51. data/spec/blather/stanza/presence/status_spec.rb +42 -30
  52. data/spec/blather/stanza/presence/subscription_spec.rb +22 -23
  53. data/spec/blather/stanza/presence_spec.rb +72 -34
  54. data/spec/blather/stanza/pubsub/affiliations_spec.rb +12 -12
  55. data/spec/blather/stanza/pubsub/create_spec.rb +10 -10
  56. data/spec/blather/stanza/pubsub/event_spec.rb +31 -31
  57. data/spec/blather/stanza/pubsub/items_spec.rb +21 -21
  58. data/spec/blather/stanza/pubsub/publish_spec.rb +21 -21
  59. data/spec/blather/stanza/pubsub/retract_spec.rb +20 -20
  60. data/spec/blather/stanza/pubsub/subscribe_spec.rb +17 -17
  61. data/spec/blather/stanza/pubsub/subscription_spec.rb +28 -28
  62. data/spec/blather/stanza/pubsub/subscriptions_spec.rb +11 -11
  63. data/spec/blather/stanza/pubsub/unsubscribe_spec.rb +22 -22
  64. data/spec/blather/stanza/pubsub_owner/delete_spec.rb +9 -9
  65. data/spec/blather/stanza/pubsub_owner/purge_spec.rb +9 -9
  66. data/spec/blather/stanza/pubsub_owner_spec.rb +6 -6
  67. data/spec/blather/stanza/pubsub_spec.rb +16 -16
  68. data/spec/blather/stanza/x_spec.rb +53 -53
  69. data/spec/blather/stanza_spec.rb +39 -39
  70. data/spec/blather/stream/client_spec.rb +133 -133
  71. data/spec/blather/stream/component_spec.rb +7 -7
  72. data/spec/blather/stream/parser_spec.rb +24 -24
  73. data/spec/blather/stream/ssl_spec.rb +7 -7
  74. data/spec/blather/xmpp_node_spec.rb +17 -7
  75. data/spec/blather_spec.rb +4 -4
  76. data/spec/spec_helper.rb +6 -54
  77. metadata +53 -68
  78. data/CHANGELOG +0 -220
@@ -109,7 +109,7 @@ describe Blather::DSL do
109
109
  it 'provides a << style writer that provides chaining' do
110
110
  stanza = Blather::Stanza::Iq.new
111
111
  @client.expects(:write).with stanza
112
- (@dsl << stanza).must_equal @dsl
112
+ (@dsl << stanza).should == @dsl
113
113
  end
114
114
 
115
115
  it 'provides a writer' do
@@ -153,7 +153,7 @@ describe Blather::DSL do
153
153
  end
154
154
 
155
155
  it 'provides a caps set helper' do
156
- @dsl.must_respond_to :set_caps
156
+ @dsl.should respond_to :set_caps
157
157
  node = 'http://code.google.com/p/exodus'
158
158
  identities = [Blather::Stanza::Iq::DiscoInfo::Identity.new({:name => 'Exodus 0.9.1', :type => 'pc', :category => 'client'})]
159
159
  features = %w{
@@ -163,13 +163,13 @@ describe Blather::DSL do
163
163
  http://jabber.org/protocol/muc
164
164
  }
165
165
  @dsl.set_caps node, identities, features
166
- @client.caps.node.must_equal "#{node}##{@client.caps.ver}"
167
- @client.caps.identities.must_equal identities
168
- @client.caps.features.map{ |f| f.var }.must_equal features
166
+ @client.caps.node.should == "#{node}##{@client.caps.ver}"
167
+ @client.caps.identities.should == identities
168
+ @client.caps.features.map{ |f| f.var }.should == features
169
169
  end
170
170
 
171
171
  it 'provides a caps send helper' do
172
- @dsl.must_respond_to :send_caps
172
+ @dsl.should respond_to :send_caps
173
173
  @client.caps.node = 'http://code.google.com/p/exodus'
174
174
  @client.caps.identities = [Blather::Stanza::Iq::DiscoInfo::Identity.new({:name => 'Exodus 0.9.1', :type => 'pc', :category => 'client'})]
175
175
  @client.caps.features = %w{
@@ -178,7 +178,7 @@ describe Blather::DSL do
178
178
  http://jabber.org/protocol/disco#items
179
179
  http://jabber.org/protocol/muc
180
180
  }
181
- expected_stanza = Blather::Stanza.import(parse_stanza(<<-XML).root)
181
+ expected_stanza = Blather::Stanza.parse(<<-XML)
182
182
  <presence>
183
183
  <c xmlns="http://jabber.org/protocol/caps" hash="sha-1"
184
184
  node="http://code.google.com/p/exodus"
@@ -209,9 +209,9 @@ describe Blather::DSL do
209
209
  node='http://code.google.com/p/exodus#QgayPKawpkPSDYmwT/WM94uAlu0='/>
210
210
  </iq>
211
211
  XML
212
- @stanza = Blather::Stanza.import(parse_stanza(stanza).root)
212
+ @stanza = Blather::Stanza.parse(stanza)
213
213
 
214
- expected_stanza = Blather::Stanza.import(parse_stanza(<<-XML).root)
214
+ expected_stanza = Blather::Stanza.parse(<<-XML)
215
215
  <iq type="result" id="disco1" to="juliet@capulet.lit/chamber">
216
216
  <query xmlns="http://jabber.org/protocol/disco#info" node="http://code.google.com/p/exodus#QgayPKawpkPSDYmwT/WM94uAlu0=">
217
217
  <identity name="Exodus 0.9.1" category="client" type="pc"/>
@@ -240,7 +240,7 @@ describe Blather::DSL do
240
240
  it 'has a pubsub helper set to the jid domain' do
241
241
  jid = Blather::JID.new('jid@domain/resource')
242
242
  @client.stubs(:jid).returns jid
243
- @dsl.pubsub.must_be_instance_of Blather::DSL::PubSub
244
- @dsl.pubsub.host.must_equal jid.domain
243
+ @dsl.pubsub.should be_instance_of Blather::DSL::PubSub
244
+ @dsl.pubsub.host.should == jid.domain
245
245
  end
246
246
  end
@@ -10,9 +10,9 @@ end
10
10
 
11
11
  describe Blather::SASLError do
12
12
  it 'can import a node' do
13
- Blather::SASLError.must_respond_to :import
13
+ Blather::SASLError.should respond_to :import
14
14
  e = Blather::SASLError.import sasl_error_node
15
- e.must_be_kind_of Blather::SASLError
15
+ e.should be_kind_of Blather::SASLError
16
16
  end
17
17
 
18
18
  describe 'each XMPP SASL error type' do
@@ -26,7 +26,7 @@ describe Blather::SASLError do
26
26
  ].each do |error_type|
27
27
  it "handles the name for #{error_type}" do
28
28
  e = Blather::SASLError.import sasl_error_node(error_type)
29
- e.name.must_equal error_type.gsub('-','_').to_sym
29
+ e.name.should == error_type.gsub('-','_').to_sym
30
30
  end
31
31
  end
32
32
  end
@@ -24,20 +24,20 @@ end
24
24
 
25
25
  describe Blather::StanzaError do
26
26
  it 'can import a node' do
27
- Blather::StanzaError.must_respond_to :import
27
+ Blather::StanzaError.should respond_to :import
28
28
  e = Blather::StanzaError.import stanza_error_node
29
- e.must_be_kind_of Blather::StanzaError
29
+ e.should be_kind_of Blather::StanzaError
30
30
  end
31
31
 
32
32
  describe 'valid types' do
33
33
  before { @original = Blather::Stanza::Message.new 'error@jabber.local', 'test message', :error }
34
34
 
35
35
  it 'ensures type is one of Stanza::Message::VALID_TYPES' do
36
- lambda { Blather::StanzaError.new @original, :gone, :invalid_type_name }.must_raise(Blather::ArgumentError)
36
+ lambda { Blather::StanzaError.new @original, :gone, :invalid_type_name }.should raise_error(Blather::ArgumentError)
37
37
 
38
38
  Blather::StanzaError::VALID_TYPES.each do |valid_type|
39
39
  msg = Blather::StanzaError.new @original, :gone, valid_type
40
- msg.type.must_equal valid_type
40
+ msg.type.should == valid_type
41
41
  end
42
42
  end
43
43
  end
@@ -51,48 +51,48 @@ describe Blather::StanzaError do
51
51
  end
52
52
 
53
53
  it 'provides a type attribute' do
54
- @err.must_respond_to :type
55
- @err.type.must_equal @type.to_sym
54
+ @err.should respond_to :type
55
+ @err.type.should == @type.to_sym
56
56
  end
57
57
 
58
58
  it 'provides a name attribute' do
59
- @err.must_respond_to :name
60
- @err.name.must_equal @err_name.gsub('-','_').to_sym
59
+ @err.should respond_to :name
60
+ @err.name.should == @err_name.gsub('-','_').to_sym
61
61
  end
62
62
 
63
63
  it 'provides a text attribute' do
64
- @err.must_respond_to :text
65
- @err.text.must_equal @msg
64
+ @err.should respond_to :text
65
+ @err.text.should == @msg
66
66
  end
67
67
 
68
68
  it 'provides a reader to the original node' do
69
- @err.must_respond_to :original
70
- @err.original.must_be_instance_of Blather::Stanza::Message
69
+ @err.should respond_to :original
70
+ @err.original.should be_instance_of Blather::Stanza::Message
71
71
  end
72
72
 
73
73
  it 'provides an extras attribute' do
74
- @err.must_respond_to :extras
75
- @err.extras.must_be_instance_of Array
76
- @err.extras.first.element_name.must_equal 'extra-error'
74
+ @err.should respond_to :extras
75
+ @err.extras.should be_instance_of Array
76
+ @err.extras.first.element_name.should == 'extra-error'
77
77
  end
78
78
 
79
79
  it 'describes itself' do
80
- @err.to_s.must_match(/#{@err_name}/)
81
- @err.to_s.must_match(/#{@msg}/)
80
+ @err.to_s.should match(/#{@err_name}/)
81
+ @err.to_s.should match(/#{@msg}/)
82
82
 
83
- @err.inspect.must_match(/#{@err_name}/)
84
- @err.inspect.must_match(/#{@msg}/)
83
+ @err.inspect.should match(/#{@err_name}/)
84
+ @err.inspect.should match(/#{@msg}/)
85
85
  end
86
86
 
87
87
  it 'can be turned into xml' do
88
- @err.must_respond_to :to_xml
88
+ @err.should respond_to :to_xml
89
89
  doc = parse_stanza @err.to_xml
90
90
 
91
- doc.xpath("/message[@from='error@jabber.local' and @type='error']").wont_be_empty
92
- doc.xpath("/message/error").wont_be_empty
93
- doc.xpath("/message/error/err_ns:internal-server-error", :err_ns => Blather::StanzaError::STANZA_ERR_NS).wont_be_empty
94
- doc.xpath("/message/error/err_ns:text[.='the server has experienced a misconfiguration']", :err_ns => Blather::StanzaError::STANZA_ERR_NS).wont_be_empty
95
- doc.xpath("/message/error/extra_ns:extra-error[.='Blather Error']", :extra_ns => 'blather:stanza:error').wont_be_empty
91
+ doc.xpath("/message[@from='error@jabber.local' and @type='error']").should_not be_empty
92
+ doc.xpath("/message/error").should_not be_empty
93
+ doc.xpath("/message/error/err_ns:internal-server-error", :err_ns => Blather::StanzaError::STANZA_ERR_NS).should_not be_empty
94
+ doc.xpath("/message/error/err_ns:text[.='the server has experienced a misconfiguration']", :err_ns => Blather::StanzaError::STANZA_ERR_NS).should_not be_empty
95
+ doc.xpath("/message/error/extra_ns:extra-error[.='Blather Error']", :extra_ns => 'blather:stanza:error').should_not be_empty
96
96
  end
97
97
  end
98
98
 
@@ -122,7 +122,7 @@ describe Blather::StanzaError do
122
122
  ].each do |error_type|
123
123
  it "handles the name for #{error_type}" do
124
124
  e = Blather::StanzaError.import stanza_error_node(:cancel, error_type)
125
- e.name.must_equal error_type.gsub('-','_').to_sym
125
+ e.name.should == error_type.gsub('-','_').to_sym
126
126
  end
127
127
  end
128
128
  end
@@ -23,13 +23,13 @@ end
23
23
  describe 'Blather::StreamError' do
24
24
  it 'can import a node' do
25
25
  err = stream_error_node 'internal-server-error', 'the message'
26
- Blather::StreamError.must_respond_to :import
26
+ Blather::StreamError.should respond_to :import
27
27
  e = Blather::StreamError.import err
28
- e.must_be_kind_of Blather::StreamError
28
+ e.should be_kind_of Blather::StreamError
29
29
 
30
- e.name.must_equal :internal_server_error
31
- e.text.must_equal 'the message'
32
- e.extras.must_equal err.find('descendant::*[name()="extra-error"]', 'blather:stream:error').map {|n|n}
30
+ e.name.should == :internal_server_error
31
+ e.text.should == 'the message'
32
+ e.extras.should == err.find('descendant::*[name()="extra-error"]', 'blather:stream:error').map {|n|n}
33
33
  end
34
34
  end
35
35
 
@@ -41,36 +41,36 @@ describe 'Blather::StreamError when instantiated' do
41
41
  end
42
42
 
43
43
  it 'provides a err_name attribute' do
44
- @err.must_respond_to :name
45
- @err.name.must_equal @err_name.gsub('-','_').to_sym
44
+ @err.should respond_to :name
45
+ @err.name.should == @err_name.gsub('-','_').to_sym
46
46
  end
47
47
 
48
48
  it 'provides a text attribute' do
49
- @err.must_respond_to :text
50
- @err.text.must_equal @msg
49
+ @err.should respond_to :text
50
+ @err.text.should == @msg
51
51
  end
52
52
 
53
53
  it 'provides an extras attribute' do
54
- @err.must_respond_to :extras
55
- @err.extras.must_be_instance_of Array
56
- @err.extras.size.must_equal 1
57
- @err.extras.first.element_name.must_equal 'extra-error'
54
+ @err.should respond_to :extras
55
+ @err.extras.should be_instance_of Array
56
+ @err.extras.size.should == 1
57
+ @err.extras.first.element_name.should == 'extra-error'
58
58
  end
59
59
 
60
60
  it 'describes itself' do
61
- @err.to_s.must_match(/#{@type}/)
62
- @err.to_s.must_match(/#{@msg}/)
61
+ @err.to_s.should match(/#{@type}/)
62
+ @err.to_s.should match(/#{@msg}/)
63
63
 
64
- @err.inspect.must_match(/#{@type}/)
65
- @err.inspect.must_match(/#{@msg}/)
64
+ @err.inspect.should match(/#{@type}/)
65
+ @err.inspect.should match(/#{@msg}/)
66
66
  end
67
67
 
68
68
  it 'can be turned into xml' do
69
- @err.must_respond_to :to_xml
69
+ @err.should respond_to :to_xml
70
70
  doc = parse_stanza @err.to_xml
71
- doc.xpath("//err_ns:internal-server-error", :err_ns => Blather::StreamError::STREAM_ERR_NS).wont_be_empty
72
- doc.xpath("//err_ns:text[.='the server has experienced a misconfiguration']", :err_ns => Blather::StreamError::STREAM_ERR_NS).wont_be_empty
73
- doc.xpath("//err_ns:extra-error[.='Blather Error']", :err_ns => 'blather:stream:error').wont_be_empty
71
+ doc.xpath("//err_ns:internal-server-error", :err_ns => Blather::StreamError::STREAM_ERR_NS).should_not be_empty
72
+ doc.xpath("//err_ns:text[.='the server has experienced a misconfiguration']", :err_ns => Blather::StreamError::STREAM_ERR_NS).should_not be_empty
73
+ doc.xpath("//err_ns:extra-error[.='Blather Error']", :err_ns => 'blather:stream:error').should_not be_empty
74
74
  end
75
75
  end
76
76
 
@@ -102,7 +102,7 @@ describe 'Each XMPP stream error type' do
102
102
  ].each do |error_type|
103
103
  it "handles the name for #{error_type}" do
104
104
  e = Blather::StreamError.import stream_error_node(error_type)
105
- e.name.must_equal error_type.gsub('-','_').to_sym
105
+ e.name.should == error_type.gsub('-','_').to_sym
106
106
  end
107
107
  end
108
108
  end
@@ -2,7 +2,7 @@ require 'spec_helper'
2
2
 
3
3
  describe Blather::BlatherError do
4
4
  it 'is handled by :error' do
5
- Blather::BlatherError.new.handler_hierarchy.must_equal [:error]
5
+ Blather::BlatherError.new.handler_hierarchy.should == [:error]
6
6
  end
7
7
  end
8
8
 
@@ -10,12 +10,12 @@ describe 'Blather::ParseError' do
10
10
  before { @error = Blather::ParseError.new('</generate-parse-error>"') }
11
11
 
12
12
  it 'is registers with the handler hierarchy' do
13
- @error.handler_hierarchy.must_equal [:parse_error, :error]
13
+ @error.handler_hierarchy.should == [:parse_error, :error]
14
14
  end
15
15
 
16
16
  it 'contains the error message' do
17
- @error.must_respond_to :message
18
- @error.message.must_equal '</generate-parse-error>"'
17
+ @error.should respond_to :message
18
+ @error.message.should == '</generate-parse-error>"'
19
19
  end
20
20
  end
21
21
 
@@ -23,11 +23,11 @@ describe 'Blather::UnknownResponse' do
23
23
  before { @error = Blather::UnknownResponse.new(Blather::XMPPNode.new('foo-bar')) }
24
24
 
25
25
  it 'is registers with the handler hierarchy' do
26
- @error.handler_hierarchy.must_equal [:unknown_response_error, :error]
26
+ @error.handler_hierarchy.should == [:unknown_response_error, :error]
27
27
  end
28
28
 
29
29
  it 'holds on to a copy of the failure node' do
30
- @error.must_respond_to :node
31
- @error.node.element_name.must_equal 'foo-bar'
30
+ @error.should respond_to :node
31
+ @error.node.element_name.should == 'foo-bar'
32
32
  end
33
33
  end
@@ -44,10 +44,10 @@ describe Blather::FileTransfer do
44
44
  end
45
45
 
46
46
  it 'can select ibb' do
47
- iq = Blather::XMPPNode.import(parse_stanza(si_xml).root)
47
+ iq = Blather::XMPPNode.parse(si_xml)
48
48
 
49
49
  @client.stubs(:write).with do |answer|
50
- answer.si.feature.x.field('stream-method').value.must_equal Blather::Stanza::Iq::Ibb::NS_IBB
50
+ answer.si.feature.x.field('stream-method').value.should == Blather::Stanza::Iq::Ibb::NS_IBB
51
51
  true
52
52
  end
53
53
 
@@ -58,10 +58,10 @@ describe Blather::FileTransfer do
58
58
  end
59
59
 
60
60
  it 'can select s5b' do
61
- iq = Blather::XMPPNode.import(parse_stanza(si_xml).root)
61
+ iq = Blather::XMPPNode.parse(si_xml)
62
62
 
63
63
  @client.stubs(:write).with do |answer|
64
- answer.si.feature.x.field('stream-method').value.must_equal Blather::Stanza::Iq::S5b::NS_S5B
64
+ answer.si.feature.x.field('stream-method').value.should == Blather::Stanza::Iq::S5b::NS_S5B
65
65
  true
66
66
  end
67
67
 
@@ -70,12 +70,12 @@ describe Blather::FileTransfer do
70
70
  transfer.allow_ibb = false
71
71
  transfer.accept(MockFileReceiver)
72
72
  end
73
-
73
+
74
74
  it 'can allow s5b private ips' do
75
- iq = Blather::XMPPNode.import(parse_stanza(si_xml).root)
75
+ iq = Blather::XMPPNode.parse(si_xml)
76
76
 
77
77
  @client.stubs(:write).with do |answer|
78
- answer.si.feature.x.field('stream-method').value.must_equal Blather::Stanza::Iq::S5b::NS_S5B
78
+ answer.si.feature.x.field('stream-method').value.should == Blather::Stanza::Iq::S5b::NS_S5B
79
79
  true
80
80
  end
81
81
 
@@ -87,11 +87,11 @@ describe Blather::FileTransfer do
87
87
  end
88
88
 
89
89
  it 'can response no-valid-streams' do
90
- iq = Blather::XMPPNode.import(parse_stanza(si_xml).root)
90
+ iq = Blather::XMPPNode.parse(si_xml)
91
91
 
92
92
  @client.stubs(:write).with do |answer|
93
- answer.find_first('error')['type'].must_equal "cancel"
94
- answer.find_first('.//ns:no-valid-streams', :ns => 'http://jabber.org/protocol/si').wont_be_nil
93
+ answer.find_first('error')['type'].should == "cancel"
94
+ answer.find_first('.//ns:no-valid-streams', :ns => 'http://jabber.org/protocol/si').should_not be_nil
95
95
  true
96
96
  end
97
97
 
@@ -102,19 +102,19 @@ describe Blather::FileTransfer do
102
102
  end
103
103
 
104
104
  it 'can decline transfer' do
105
- iq = Blather::XMPPNode.import(parse_stanza(si_xml).root)
105
+ iq = Blather::XMPPNode.parse(si_xml)
106
106
 
107
107
  @client.stubs(:write).with do |answer|
108
- answer.find_first('error')['type'].must_equal "cancel"
109
- answer.find_first('.//ns:forbidden', :ns => 'urn:ietf:params:xml:ns:xmpp-stanzas').wont_be_nil
110
- answer.find_first('.//ns:text', :ns => 'urn:ietf:params:xml:ns:xmpp-stanzas').content.must_equal "Offer declined"
108
+ answer.find_first('error')['type'].should == "cancel"
109
+ answer.find_first('.//ns:forbidden', :ns => 'urn:ietf:params:xml:ns:xmpp-stanzas').should_not be_nil
110
+ answer.find_first('.//ns:text', :ns => 'urn:ietf:params:xml:ns:xmpp-stanzas').content.should == "Offer declined"
111
111
  true
112
112
  end
113
113
 
114
114
  transfer = Blather::FileTransfer.new(@client, iq)
115
115
  transfer.decline
116
116
  end
117
-
117
+
118
118
  it 'can s5b post_init include the handler' do
119
119
  class TestS5B < Blather::FileTransfer::S5b::SocketConnection
120
120
  def initialize()
@@ -130,8 +130,6 @@ describe Blather::FileTransfer do
130
130
  end
131
131
  end
132
132
  end
133
- assert_nothing_raised do
134
- TestS5B.new()
135
- end
133
+ lambda { TestS5B.new }.should_not raise_error
136
134
  end
137
135
  end
@@ -3,85 +3,85 @@ require 'spec_helper'
3
3
  describe Blather::JID do
4
4
  it 'does nothing if creaded from Blather::JID' do
5
5
  jid = Blather::JID.new 'n@d/r'
6
- Blather::JID.new(jid).object_id.must_equal jid.object_id
6
+ Blather::JID.new(jid).object_id.should == jid.object_id
7
7
  end
8
8
 
9
9
  it 'creates a new Blather::JID from (n,d,r)' do
10
10
  jid = Blather::JID.new('n', 'd', 'r')
11
- jid.node.must_equal 'n'
12
- jid.domain.must_equal 'd'
13
- jid.resource.must_equal 'r'
11
+ jid.node.should == 'n'
12
+ jid.domain.should == 'd'
13
+ jid.resource.should == 'r'
14
14
  end
15
15
 
16
16
  it 'creates a new Blather::JID from (n,d)' do
17
17
  jid = Blather::JID.new('n', 'd')
18
- jid.node.must_equal 'n'
19
- jid.domain.must_equal 'd'
18
+ jid.node.should == 'n'
19
+ jid.domain.should == 'd'
20
20
  end
21
21
 
22
22
  it 'creates a new Blather::JID from (n@d)' do
23
23
  jid = Blather::JID.new('n@d')
24
- jid.node.must_equal 'n'
25
- jid.domain.must_equal 'd'
24
+ jid.node.should == 'n'
25
+ jid.domain.should == 'd'
26
26
  end
27
27
 
28
28
  it 'creates a new Blather::JID from (n@d/r)' do
29
29
  jid = Blather::JID.new('n@d/r')
30
- jid.node.must_equal 'n'
31
- jid.domain.must_equal 'd'
32
- jid.resource.must_equal 'r'
30
+ jid.node.should == 'n'
31
+ jid.domain.should == 'd'
32
+ jid.resource.should == 'r'
33
33
  end
34
34
 
35
35
  it 'requires at least a node' do
36
- proc { Blather::JID.new }.must_raise ::ArgumentError
36
+ proc { Blather::JID.new }.should raise_error ::ArgumentError
37
37
  end
38
38
 
39
39
  it 'ensures length of node is no more than 1023 characters' do
40
- proc { Blather::JID.new('n'*1024) }.must_raise Blather::ArgumentError
40
+ proc { Blather::JID.new('n'*1024) }.should raise_error Blather::ArgumentError
41
41
  end
42
42
 
43
43
  it 'ensures length of domain is no more than 1023 characters' do
44
- proc { Blather::JID.new('n', 'd'*1024) }.must_raise Blather::ArgumentError
44
+ proc { Blather::JID.new('n', 'd'*1024) }.should raise_error Blather::ArgumentError
45
45
  end
46
46
 
47
47
  it 'ensures length of resource is no more than 1023 characters' do
48
- proc { Blather::JID.new('n', 'd', 'r'*1024) }.must_raise Blather::ArgumentError
48
+ proc { Blather::JID.new('n', 'd', 'r'*1024) }.should raise_error Blather::ArgumentError
49
49
  end
50
50
 
51
51
  it 'compares Blather::JIDs' do
52
- (Blather::JID.new('a@b/c') <=> Blather::JID.new('d@e/f')).must_equal -1
53
- (Blather::JID.new('a@b/c') <=> Blather::JID.new('a@b/c')).must_equal 0
54
- (Blather::JID.new('d@e/f') <=> Blather::JID.new('a@b/c')).must_equal 1
52
+ (Blather::JID.new('a@b/c') <=> Blather::JID.new('d@e/f')).should == -1
53
+ (Blather::JID.new('a@b/c') <=> Blather::JID.new('a@b/c')).should == 0
54
+ (Blather::JID.new('d@e/f') <=> Blather::JID.new('a@b/c')).should == 1
55
55
  end
56
56
 
57
57
  it 'checks for equality' do
58
- (Blather::JID.new('n@d/r') == Blather::JID.new('n@d/r')).must_equal true
59
- Blather::JID.new('n@d/r').eql?(Blather::JID.new('n@d/r')).must_equal true
58
+ (Blather::JID.new('n@d/r') == Blather::JID.new('n@d/r')).should == true
59
+ Blather::JID.new('n@d/r').eql?(Blather::JID.new('n@d/r')).should == true
60
60
  end
61
61
 
62
62
  it 'will strip' do
63
63
  jid = Blather::JID.new('n@d/r')
64
- jid.stripped.must_equal Blather::JID.new('n@d')
65
- jid.must_equal Blather::JID.new('n@d/r')
64
+ jid.stripped.should == Blather::JID.new('n@d')
65
+ jid.should == Blather::JID.new('n@d/r')
66
66
  end
67
67
 
68
68
  it 'will strip itself' do
69
69
  jid = Blather::JID.new('n@d/r')
70
70
  jid.strip!
71
- jid.must_equal Blather::JID.new('n@d')
71
+ jid.should == Blather::JID.new('n@d')
72
72
  end
73
73
 
74
74
  it 'has a string representation' do
75
- Blather::JID.new('n@d/r').to_s.must_equal 'n@d/r'
76
- Blather::JID.new('n', 'd', 'r').to_s.must_equal 'n@d/r'
77
- Blather::JID.new('n', 'd').to_s.must_equal 'n@d'
75
+ Blather::JID.new('n@d/r').to_s.should == 'n@d/r'
76
+ Blather::JID.new('n', 'd', 'r').to_s.should == 'n@d/r'
77
+ Blather::JID.new('n', 'd').to_s.should == 'n@d'
78
78
  end
79
79
 
80
80
  it 'provides a #stripped? helper' do
81
81
  jid = Blather::JID.new 'a@b/c'
82
- jid.must_respond_to :stripped?
83
- jid.stripped?.wont_equal true
82
+ jid.should respond_to :stripped?
83
+ jid.stripped?.should_not equal true
84
84
  jid.strip!
85
- jid.stripped?.must_equal true
85
+ jid.stripped?.should == true
86
86
  end
87
87
  end