blather 0.6.2 → 0.7.0

Sign up to get free protection for your applications and to get access to all the features.
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
@@ -25,75 +25,74 @@ class Presence
25
25
  node
26
26
  end
27
27
 
28
- # @private
29
- def inherit(node)
30
- inherit_attrs node.attributes
31
- self
32
- end
28
+ module InstanceMethods
33
29
 
34
- # Set the to value on the stanza
35
- #
36
- # @param [Blather::JID, #to_s] to a JID to subscribe to
37
- def to=(to)
38
- super JID.new(to).stripped
39
- end
30
+ # Set the to value on the stanza
31
+ #
32
+ # @param [Blather::JID, #to_s] to a JID to subscribe to
33
+ def to=(to)
34
+ super JID.new(to).stripped
35
+ end
40
36
 
41
- # Transform the stanza into an approve stanza
42
- # makes approving requests simple
43
- #
44
- # @example approve an incoming request
45
- # subscription(:request?) { |s| write_to_stream s.approve! }
46
- # @return [self]
47
- def approve!
48
- self.type = :subscribed
49
- reply_if_needed!
50
- end
37
+ # Transform the stanza into an approve stanza
38
+ # makes approving requests simple
39
+ #
40
+ # @example approve an incoming request
41
+ # subscription(:request?) { |s| write_to_stream s.approve! }
42
+ # @return [self]
43
+ def approve!
44
+ self.type = :subscribed
45
+ reply_if_needed!
46
+ end
51
47
 
52
- # Transform the stanza into a refuse stanza
53
- # makes refusing requests simple
54
- #
55
- # @example refuse an incoming request
56
- # subscription(:request?) { |s| write_to_stream s.refuse! }
57
- # @return [self]
58
- def refuse!
59
- self.type = :unsubscribed
60
- reply_if_needed!
61
- end
48
+ # Transform the stanza into a refuse stanza
49
+ # makes refusing requests simple
50
+ #
51
+ # @example refuse an incoming request
52
+ # subscription(:request?) { |s| write_to_stream s.refuse! }
53
+ # @return [self]
54
+ def refuse!
55
+ self.type = :unsubscribed
56
+ reply_if_needed!
57
+ end
62
58
 
63
- # Transform the stanza into an unsubscribe stanza
64
- # makes unsubscribing simple
65
- #
66
- # @return [self]
67
- def unsubscribe!
68
- self.type = :unsubscribe
69
- reply_if_needed!
70
- end
59
+ # Transform the stanza into an unsubscribe stanza
60
+ # makes unsubscribing simple
61
+ #
62
+ # @return [self]
63
+ def unsubscribe!
64
+ self.type = :unsubscribe
65
+ reply_if_needed!
66
+ end
71
67
 
72
- # Transform the stanza into a cancel stanza
73
- # makes canceling simple
74
- #
75
- # @return [self]
76
- def cancel!
77
- self.type = :unsubscribed
78
- reply_if_needed!
79
- end
68
+ # Transform the stanza into a cancel stanza
69
+ # makes canceling simple
70
+ #
71
+ # @return [self]
72
+ def cancel!
73
+ self.type = :unsubscribed
74
+ reply_if_needed!
75
+ end
80
76
 
81
- # Transform the stanza into a request stanza
82
- # makes requests simple
83
- #
84
- # @return [self]
85
- def request!
86
- self.type = :subscribe
87
- reply_if_needed!
88
- end
77
+ # Transform the stanza into a request stanza
78
+ # makes requests simple
79
+ #
80
+ # @return [self]
81
+ def request!
82
+ self.type = :subscribe
83
+ reply_if_needed!
84
+ end
89
85
 
90
- # Check if the stanza is a request
91
- #
92
- # @return [true, false]
93
- def request?
94
- self.type == :subscribe
86
+ # Check if the stanza is a request
87
+ #
88
+ # @return [true, false]
89
+ def request?
90
+ self.type == :subscribe
91
+ end
95
92
  end
96
93
 
94
+ include InstanceMethods
95
+
97
96
  end #Subscription
98
97
 
99
98
  end #Presence
@@ -161,8 +161,6 @@ module Blather
161
161
  # Called by EM with data from the wire
162
162
  # @private
163
163
  def receive_data(data)
164
- Blather.log "\n#{'-'*30}\n"
165
- Blather.log "STREAM IN: #{data}"
166
164
  @parser << data
167
165
 
168
166
  rescue ParseError => e
@@ -237,7 +235,7 @@ module Blather
237
235
  # Ensure the JID gets attached to the client
238
236
  # @private
239
237
  def jid=(new_jid)
240
- Blather.log "NEW JID: #{new_jid}"
238
+ Blather.log "USING JID: #{new_jid}"
241
239
  @jid = JID.new new_jid
242
240
  end
243
241
 
@@ -49,7 +49,6 @@ class Stream
49
49
  return
50
50
  end
51
51
 
52
- Blather.log "RESOURCE NODE #{@node}"
53
52
  # ensure this is a response to our original request
54
53
  if @id == @node['id']
55
54
  @stream.jid = JID.new @node.find_first('bind_ns:bind/bind_ns:jid', :bind_ns => BIND_NS).content
@@ -1,4 +1,3 @@
1
1
  module Blather
2
- # Blather version number
3
- VERSION = '0.6.2'
2
+ VERSION = '0.7.0'
4
3
  end
@@ -40,16 +40,24 @@ module Blather
40
40
  # elements of the XML::Node
41
41
  # @param [XML::Node] node the node to import
42
42
  # @return the appropriate object based on the node name and namespace
43
- def self.import(node)
43
+ def self.import(node, *decorators)
44
44
  ns = (node.namespace.href if node.namespace)
45
45
  klass = class_from_registration(node.element_name, ns)
46
46
  if klass && klass != self
47
- klass.import(node)
47
+ klass.import(node, *decorators)
48
48
  else
49
- new(node.element_name).inherit(node)
49
+ new(node.element_name).decorate(*decorators).inherit(node)
50
50
  end
51
51
  end
52
52
 
53
+ # Parse a string as XML and import to the appropriate class
54
+ #
55
+ # @param [String] string the string to parse
56
+ # @return the appropriate object based on the node name and namespace
57
+ def self.parse(string)
58
+ import Nokogiri::XML(string).root
59
+ end
60
+
53
61
  # Create a new Node object
54
62
  #
55
63
  # @param [String, nil] name the element name
@@ -60,6 +68,19 @@ module Blather
60
68
  super name, doc, BASE_NAMES.include?(name.to_s) ? nil : self.registered_ns
61
69
  end
62
70
 
71
+ def self.decorator_modules
72
+ [self::InstanceMethods]
73
+ end
74
+
75
+ def decorate(*decorators)
76
+ decorators.each do |decorator|
77
+ decorator.decorator_modules.each do |mod|
78
+ extend mod
79
+ end
80
+ end
81
+ self
82
+ end
83
+
63
84
  # Turn the object into a proper stanza
64
85
  #
65
86
  # @return a stanza object
@@ -11,41 +11,41 @@ describe Blather::Client do
11
11
 
12
12
  it 'provides a Blather::JID reader' do
13
13
  @client.post_init @stream, @jid
14
- @client.must_respond_to :jid
15
- @client.jid.must_equal @jid
14
+ @client.should respond_to :jid
15
+ @client.jid.should == @jid
16
16
  end
17
17
 
18
18
  it 'provides a reader for the roster' do
19
- @client.must_respond_to :roster
20
- @client.roster.must_be_kind_of Blather::Roster
19
+ @client.should respond_to :roster
20
+ @client.roster.should be_kind_of Blather::Roster
21
21
  end
22
22
 
23
23
  it 'provides a status reader' do
24
24
  @client.post_init @stream, @jid
25
- @client.must_respond_to :status
25
+ @client.should respond_to :status
26
26
  @client.status = :away
27
- @client.status.must_equal :away
27
+ @client.status.should == :away
28
28
  end
29
29
 
30
30
  it 'should have a caps handler' do
31
- @client.must_respond_to :caps
32
- @client.caps.must_be_kind_of Blather::Stanza::Capabilities
31
+ @client.should respond_to :caps
32
+ @client.caps.should be_kind_of Blather::Stanza::Capabilities
33
33
  end
34
34
 
35
35
  it 'can be setup' do
36
- @client.must_respond_to :setup
37
- @client.setup('me@me.com', 'pass').must_equal @client
36
+ @client.should respond_to :setup
37
+ @client.setup('me@me.com', 'pass').should == @client
38
38
  end
39
39
 
40
40
  it 'knows if it has been setup' do
41
- @client.must_respond_to :setup?
42
- @client.setup?.must_equal false
41
+ @client.should respond_to :setup?
42
+ @client.setup?.should == false
43
43
  @client.setup 'me@me.com', 'pass'
44
- @client.setup?.must_equal true
44
+ @client.setup?.should == true
45
45
  end
46
46
 
47
47
  it 'cannot be run before being setup' do
48
- lambda { @client.run }.must_raise RuntimeError
48
+ lambda { @client.run }.should raise_error RuntimeError
49
49
  end
50
50
 
51
51
  it 'starts up a Component connection when setup without a node' do
@@ -63,8 +63,8 @@ describe Blather::Client do
63
63
  end
64
64
 
65
65
  it 'knows if it is disconnected' do
66
- @client.must_respond_to :connected?
67
- @client.connected?.must_equal false
66
+ @client.should respond_to :connected?
67
+ @client.connected?.should == false
68
68
  end
69
69
 
70
70
  it 'knows if it is connected' do
@@ -72,13 +72,13 @@ describe Blather::Client do
72
72
  stream.expects(:stopped?).returns false
73
73
  @client.setup('me.com', 'secret')
74
74
  @client.post_init stream, Blather::JID.new('me.com')
75
- @client.connected?.must_equal true
75
+ @client.connected?.should == true
76
76
  end
77
77
 
78
78
  describe 'if it has been setup but not connected yet' do
79
79
  it 'should consider itself disconnected' do
80
80
  @client.setup('me.com', 'secret')
81
- @client.connected?.must_equal false
81
+ @client.connected?.should == false
82
82
  end
83
83
  end
84
84
 
@@ -151,7 +151,7 @@ describe Blather::Client do
151
151
  response.expects(:call)
152
152
  @client.expects(:write).with do |s|
153
153
  @client.receive_data stanza
154
- s.must_equal stanza
154
+ s.should == stanza
155
155
  end
156
156
  @client.write_with_handler(stanza) { |_| response.call }
157
157
  end
@@ -242,24 +242,24 @@ describe 'Blather::Client#status=' do
242
242
 
243
243
  it 'updates the state when not sending to a Blather::JID' do
244
244
  @stream.stubs(:write)
245
- @client.status.wont_equal :away
245
+ @client.status.should_not equal :away
246
246
  @client.status = :away, 'message'
247
- @client.status.must_equal :away
247
+ @client.status.should == :away
248
248
  end
249
249
 
250
250
  it 'does not update the state when sending to a Blather::JID' do
251
251
  @stream.stubs(:write)
252
- @client.status.wont_equal :away
252
+ @client.status.should_not equal :away
253
253
  @client.status = :away, 'message', 'me@me.com'
254
- @client.status.wont_equal :away
254
+ @client.status.should_not equal :away
255
255
  end
256
256
 
257
257
  it 'writes the new status to the stream' do
258
258
  Blather::Stanza::Presence::Status.stubs(:next_id).returns 0
259
259
  status = [:away, 'message']
260
260
  @stream.expects(:send).with do |s|
261
- s.must_be_kind_of Blather::Stanza::Presence::Status
262
- s.to_s.must_equal Blather::Stanza::Presence::Status.new(*status).to_s
261
+ s.should be_kind_of Blather::Stanza::Presence::Status
262
+ s.to_s.should == Blather::Stanza::Presence::Status.new(*status).to_s
263
263
  end
264
264
  @client.status = status
265
265
  end
@@ -275,7 +275,7 @@ describe 'Blather::Client default handlers' do
275
275
 
276
276
  it 're-raises errors' do
277
277
  err = Blather::BlatherError.new
278
- lambda { @client.receive_data err }.must_raise Blather::BlatherError
278
+ lambda { @client.receive_data err }.should raise_error Blather::BlatherError
279
279
  end
280
280
 
281
281
  # it 'responds to iq:get with a "service-unavailable" error' do
@@ -288,21 +288,21 @@ describe 'Blather::Client default handlers' do
288
288
  # it 'responds to iq:get with a "service-unavailable" error' do
289
289
  # get = Blather::Stanza::Iq.new :get
290
290
  # err = Blather::StanzaError.new(get, 'service-unavailable', :cancel).to_node
291
- # @client.expects(:write).with { |n| n.to_s.must_equal err.to_s }
291
+ # @client.expects(:write).with { |n| n.to_s.should == err.to_s }
292
292
  # @client.receive_data get
293
293
  # end
294
294
 
295
295
  # it 'responds to iq:set with a "service-unavailable" error' do
296
296
  # get = Blather::Stanza::Iq.new :set
297
297
  # err = Blather::StanzaError.new(get, 'service-unavailable', :cancel).to_node
298
- # @client.expects(:write).with { |n| n.to_s.must_equal err.to_s }
298
+ # @client.expects(:write).with { |n| n.to_s.should == err.to_s }
299
299
  # @client.receive_data get
300
300
  # end
301
301
 
302
302
  it 'responds to s2c pings with a pong' do
303
303
  ping = Blather::Stanza::Iq::Ping.new :get
304
304
  pong = ping.reply
305
- @client.expects(:write).with { |n| n.to_s.must_equal pong.to_s }
305
+ @client.expects(:write).with { |n| n.to_s.should == pong.to_s }
306
306
  @client.receive_data ping
307
307
  end
308
308
 
@@ -378,7 +378,7 @@ describe 'Blather::Client with a Client stream' do
378
378
  end
379
379
 
380
380
  it 'sends a request for the roster when post_init is called' do
381
- @stream.expects(:send).with { |stanza| stanza.must_be_kind_of Blather::Stanza::Iq::Roster }
381
+ @stream.expects(:send).with { |stanza| stanza.should be_kind_of Blather::Stanza::Iq::Roster }
382
382
  @client.post_init @stream, Blather::JID.new('n@d/r')
383
383
  end
384
384
 
@@ -402,7 +402,7 @@ describe 'Blather::Client filters' do
402
402
  end
403
403
 
404
404
  it 'raises an error when an invalid filter type is registered' do
405
- lambda { @client.register_filter(:invalid) {} }.must_raise RuntimeError
405
+ lambda { @client.register_filter(:invalid) {} }.should raise_error RuntimeError
406
406
  end
407
407
 
408
408
  it 'can be guarded' do
@@ -426,11 +426,11 @@ describe 'Blather::Client filters' do
426
426
  it 'runs them in order' do
427
427
  stanza = Blather::Stanza::Iq.new
428
428
  count = 0
429
- @client.register_filter(:before) { |_| count.must_equal 0; count = 1 }
430
- @client.register_filter(:before) { |_| count.must_equal 1; count = 2 }
431
- @client.register_handler(:iq) { |_| count.must_equal 2; count = 3 }
432
- @client.register_filter(:after) { |_| count.must_equal 3; count = 4 }
433
- @client.register_filter(:after) { |_| count.must_equal 4 }
429
+ @client.register_filter(:before) { |_| count.should == 0; count = 1 }
430
+ @client.register_filter(:before) { |_| count.should == 1; count = 2 }
431
+ @client.register_handler(:iq) { |_| count.should == 2; count = 3 }
432
+ @client.register_filter(:after) { |_| count.should == 3; count = 4 }
433
+ @client.register_filter(:after) { |_| count.should == 4 }
434
434
  @client.receive_data stanza
435
435
  end
436
436
 
@@ -581,27 +581,27 @@ describe 'Blather::Client guards' do
581
581
 
582
582
  it 'can be an xpath and will send the result to the handler' do
583
583
  @response.expects(:call).with do |stanza, xpath|
584
- xpath.must_be_instance_of Nokogiri::XML::NodeSet
585
- xpath.wont_be_empty
586
- stanza.must_equal @stanza
584
+ xpath.should be_instance_of Nokogiri::XML::NodeSet
585
+ xpath.should_not be_empty
586
+ stanza.should == @stanza
587
587
  end
588
588
  @client.register_handler(:iq, "/iq[@id='#{@stanza.id}']") { |stanza, xpath| @response.call stanza, xpath }
589
589
  @client.receive_data @stanza
590
590
  end
591
591
 
592
592
  it 'can be an xpath with namespaces and will send the result to the handler' do
593
- @stanza = Blather::Stanza.import(parse_stanza('<message><foo xmlns="http://bar.com"></message>').root)
593
+ @stanza = Blather::Stanza.parse('<message><foo xmlns="http://bar.com"></message>')
594
594
  @response.expects(:call).with do |stanza, xpath|
595
- xpath.must_be_instance_of Nokogiri::XML::NodeSet
596
- xpath.wont_be_empty
597
- stanza.must_equal @stanza
595
+ xpath.should be_instance_of Nokogiri::XML::NodeSet
596
+ xpath.should_not be_empty
597
+ stanza.should == @stanza
598
598
  end
599
599
  @client.register_handler(:message, "/message/bar:foo", :bar => 'http://bar.com') { |stanza, xpath| @response.call stanza, xpath }
600
600
  @client.receive_data @stanza
601
601
  end
602
602
 
603
603
  it 'raises an error when a bad guard is tried' do
604
- lambda { @client.register_handler(:iq, 0) {} }.must_raise RuntimeError
604
+ lambda { @client.register_handler(:iq, 0) {} }.should raise_error RuntimeError
605
605
  end
606
606
  end
607
607
 
@@ -615,51 +615,51 @@ describe 'Blather::Client::Caps' do
615
615
  end
616
616
 
617
617
  it 'must be of type result' do
618
- @caps.must_respond_to :type
619
- @caps.type.must_equal :result
618
+ @caps.should respond_to :type
619
+ @caps.type.should == :result
620
620
  end
621
621
 
622
622
  it 'can have a client node set' do
623
- @caps.must_respond_to :node=
623
+ @caps.should respond_to :node=
624
624
  @caps.node = "somenode"
625
625
  end
626
626
 
627
627
  it 'provides a client node reader' do
628
- @caps.must_respond_to :node
628
+ @caps.should respond_to :node
629
629
  @caps.node = "somenode"
630
- @caps.node.must_equal "somenode##{@caps.ver}"
630
+ @caps.node.should == "somenode##{@caps.ver}"
631
631
  end
632
632
 
633
633
  it 'can have identities set' do
634
- @caps.must_respond_to :identities=
634
+ @caps.should respond_to :identities=
635
635
  @caps.identities = [{:name => "name", :type => "type", :category => "cat"}]
636
636
  end
637
637
 
638
638
  it 'provides an identities reader' do
639
- @caps.must_respond_to :identities
639
+ @caps.should respond_to :identities
640
640
  @caps.identities = [{:name => "name", :type => "type", :category => "cat"}]
641
- @caps.identities.must_equal [Blather::Stanza::Iq::DiscoInfo::Identity.new({:name => "name", :type => "type", :category => "cat"})]
641
+ @caps.identities.should == [Blather::Stanza::Iq::DiscoInfo::Identity.new({:name => "name", :type => "type", :category => "cat"})]
642
642
  end
643
643
 
644
644
  it 'can have features set' do
645
- @caps.must_respond_to :features=
646
- @caps.features.size.must_equal 0
645
+ @caps.should respond_to :features=
646
+ @caps.features.size.should == 0
647
647
  @caps.features = ["feature1"]
648
- @caps.features.size.must_equal 1
648
+ @caps.features.size.should == 1
649
649
  @caps.features += [Blather::Stanza::Iq::DiscoInfo::Feature.new("feature2")]
650
- @caps.features.size.must_equal 2
650
+ @caps.features.size.should == 2
651
651
  @caps.features = nil
652
- @caps.features.size.must_equal 0
652
+ @caps.features.size.should == 0
653
653
  end
654
654
 
655
655
  it 'provides a features reader' do
656
- @caps.must_respond_to :features
656
+ @caps.should respond_to :features
657
657
  @caps.features = %w{feature1 feature2}
658
- @caps.features.must_equal [Blather::Stanza::Iq::DiscoInfo::Feature.new("feature1"), Blather::Stanza::Iq::DiscoInfo::Feature.new("feature2")]
658
+ @caps.features.should == [Blather::Stanza::Iq::DiscoInfo::Feature.new("feature1"), Blather::Stanza::Iq::DiscoInfo::Feature.new("feature2")]
659
659
  end
660
660
 
661
661
  it 'provides a client ver reader' do
662
- @caps.must_respond_to :ver
662
+ @caps.should respond_to :ver
663
663
  @caps.node = 'http://code.google.com/p/exodus'
664
664
  @caps.identities = [Blather::Stanza::Iq::DiscoInfo::Identity.new({:name => 'Exodus 0.9.1', :type => 'pc', :category => 'client'})]
665
665
  @caps.features = %w{
@@ -668,12 +668,12 @@ describe 'Blather::Client::Caps' do
668
668
  http://jabber.org/protocol/disco#items
669
669
  http://jabber.org/protocol/muc
670
670
  }
671
- @caps.ver.must_equal 'QgayPKawpkPSDYmwT/WM94uAlu0='
672
- @caps.node.must_equal "http://code.google.com/p/exodus#QgayPKawpkPSDYmwT/WM94uAlu0="
671
+ @caps.ver.should == 'QgayPKawpkPSDYmwT/WM94uAlu0='
672
+ @caps.node.should == "http://code.google.com/p/exodus#QgayPKawpkPSDYmwT/WM94uAlu0="
673
673
  end
674
674
 
675
675
  it 'can construct caps presence correctly' do
676
- @caps.must_respond_to :c
676
+ @caps.should respond_to :c
677
677
  @caps.node = 'http://code.google.com/p/exodus'
678
678
  @caps.identities = [Blather::Stanza::Iq::DiscoInfo::Identity.new({:name => 'Exodus 0.9.1', :type => 'pc', :category => 'client'})]
679
679
  @caps.features = %w{
@@ -682,6 +682,6 @@ describe 'Blather::Client::Caps' do
682
682
  http://jabber.org/protocol/disco#items
683
683
  http://jabber.org/protocol/muc
684
684
  }
685
- @caps.c.inspect.must_equal "<presence>\n <c xmlns=\"http://jabber.org/protocol/caps\" hash=\"sha-1\" node=\"http://code.google.com/p/exodus\" ver=\"QgayPKawpkPSDYmwT/WM94uAlu0=\"/>\n</presence>"
685
+ @caps.c.inspect.should == "<presence>\n <c xmlns=\"http://jabber.org/protocol/caps\" hash=\"sha-1\" node=\"http://code.google.com/p/exodus\" ver=\"QgayPKawpkPSDYmwT/WM94uAlu0=\"/>\n</presence>"
686
686
  end
687
687
  end