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
@@ -23,31 +23,31 @@ end
23
23
 
24
24
  describe Blather::Stanza::Iq::DiscoItems do
25
25
  it 'registers itself' do
26
- Blather::XMPPNode.class_from_registration(:query, 'http://jabber.org/protocol/disco#items').must_equal Blather::Stanza::Iq::DiscoItems
26
+ Blather::XMPPNode.class_from_registration(:query, 'http://jabber.org/protocol/disco#items').should == Blather::Stanza::Iq::DiscoItems
27
27
  end
28
28
 
29
29
  it 'must be importable' do
30
- Blather::XMPPNode.import(parse_stanza(disco_items_xml).root).must_be_instance_of Blather::Stanza::Iq::DiscoItems
30
+ Blather::XMPPNode.parse(disco_items_xml).should be_instance_of Blather::Stanza::Iq::DiscoItems
31
31
  end
32
32
 
33
33
  it 'is constructed properly' do
34
34
  n = Blather::Stanza::Iq::DiscoItems.new :get, '/path/to/node'
35
35
  n.to = 'to@jid.com'
36
- n.find("/iq[@to='to@jid.com' and @type='get' and @id='#{n.id}']/ns:query[@node='/path/to/node']", :ns => Blather::Stanza::Iq::DiscoItems.registered_ns).wont_be_empty
36
+ n.find("/iq[@to='to@jid.com' and @type='get' and @id='#{n.id}']/ns:query[@node='/path/to/node']", :ns => Blather::Stanza::Iq::DiscoItems.registered_ns).should_not be_empty
37
37
  end
38
38
 
39
39
  it 'has a node attribute' do
40
40
  n = Blather::Stanza::Iq::DiscoItems.new nil, 'music', []
41
- n.node.must_equal 'music'
41
+ n.node.should == 'music'
42
42
  n.node = :foo
43
- n.node.must_equal 'foo'
43
+ n.node.should == 'foo'
44
44
  end
45
45
 
46
46
  it 'inherits a list of identities' do
47
47
  n = parse_stanza disco_items_xml
48
48
  r = Blather::Stanza::Iq::DiscoItems.new.inherit n.root
49
- r.items.size.must_equal 3
50
- r.items.map { |i| i.class }.uniq.must_equal [Blather::Stanza::Iq::DiscoItems::Item]
49
+ r.items.size.should == 3
50
+ r.items.map { |i| i.class }.uniq.should == [Blather::Stanza::Iq::DiscoItems::Item]
51
51
  end
52
52
 
53
53
  it 'takes a list of hashes for items' do
@@ -60,8 +60,8 @@ describe Blather::Stanza::Iq::DiscoItems do
60
60
  Blather::Stanza::Iq::DiscoItems::Item.new(*%w[baz@foo/bar node1 name1])]
61
61
 
62
62
  di = Blather::Stanza::Iq::DiscoItems.new nil, nil, items
63
- di.items.size.must_equal 2
64
- di.items.each { |i| control.include?(i).must_equal true }
63
+ di.items.size.should == 2
64
+ di.items.each { |i| control.include?(i).should == true }
65
65
  end
66
66
 
67
67
  it 'takes a list of Item objects as items' do
@@ -69,24 +69,24 @@ describe Blather::Stanza::Iq::DiscoItems do
69
69
  Blather::Stanza::Iq::DiscoItems::Item.new(*%w[baz@foo/bar node1 name1])]
70
70
 
71
71
  di = Blather::Stanza::Iq::DiscoItems.new nil, nil, control
72
- di.items.size.must_equal 2
73
- di.items.each { |i| control.include?(i).must_equal true }
72
+ di.items.size.should == 2
73
+ di.items.each { |i| control.include?(i).should == true }
74
74
  end
75
75
 
76
76
  it 'takes a single hash as identity' do
77
77
  control = [Blather::Stanza::Iq::DiscoItems::Item.new(*%w[foo@bar/baz node name])]
78
78
 
79
79
  di = Blather::Stanza::Iq::DiscoItems.new nil, nil, {:jid => 'foo@bar/baz', :node => 'node', :name => 'name'}
80
- di.items.size.must_equal 1
81
- di.items.each { |i| control.include?(i).must_equal true }
80
+ di.items.size.should == 1
81
+ di.items.each { |i| control.include?(i).should == true }
82
82
  end
83
83
 
84
84
  it 'takes a single identity object as identity' do
85
85
  control = [Blather::Stanza::Iq::DiscoItems::Item.new(*%w[foo@bar/baz node name])]
86
86
 
87
87
  di = Blather::Stanza::Iq::DiscoItems.new nil, nil, control.first
88
- di.items.size.must_equal 1
89
- di.items.each { |i| control.include?(i).must_equal true }
88
+ di.items.size.should == 1
89
+ di.items.each { |i| control.include?(i).should == true }
90
90
  end
91
91
 
92
92
  it 'takes a mix of hashes and identity objects as items' do
@@ -99,19 +99,19 @@ describe Blather::Stanza::Iq::DiscoItems do
99
99
  Blather::Stanza::Iq::DiscoItems::Item.new(*%w[baz@foo/bar node1 name1])]
100
100
 
101
101
  di = Blather::Stanza::Iq::DiscoItems.new nil, nil, items
102
- di.items.size.must_equal 2
103
- di.items.each { |i| control.include?(i).must_equal true }
102
+ di.items.size.should == 2
103
+ di.items.each { |i| control.include?(i).should == true }
104
104
  end
105
105
 
106
106
  it 'allows adding of items' do
107
107
  di = Blather::Stanza::Iq::DiscoItems.new
108
- di.items.size.must_equal 0
108
+ di.items.size.should == 0
109
109
  di.items = [{:jid => 'foo@bar/baz', :node => 'node', :name => 'name'}]
110
- di.items.size.must_equal 1
110
+ di.items.size.should == 1
111
111
  di.items += [Blather::Stanza::Iq::DiscoItems::Item.new(*%w[foo@bar/baz node name])]
112
- di.items.size.must_equal 2
112
+ di.items.size.should == 2
113
113
  di.items = nil
114
- di.items.size.must_equal 0
114
+ di.items.size.should == 0
115
115
  end
116
116
  end
117
117
 
@@ -119,36 +119,36 @@ describe Blather::Stanza::Iq::DiscoItems::Item do
119
119
  it 'will auto-inherit nodes' do
120
120
  n = parse_stanza "<item jid='foo@bar/baz' node='music' name='Music from the time of Shakespeare' />"
121
121
  i = Blather::Stanza::Iq::DiscoItems::Item.new n.root
122
- i.jid.must_equal Blather::JID.new('foo@bar/baz')
123
- i.node.must_equal 'music'
124
- i.name.must_equal 'Music from the time of Shakespeare'
122
+ i.jid.should == Blather::JID.new('foo@bar/baz')
123
+ i.node.should == 'music'
124
+ i.name.should == 'Music from the time of Shakespeare'
125
125
  end
126
126
 
127
127
  it 'has a jid attribute' do
128
128
  n = Blather::Stanza::Iq::DiscoItems::Item.new 'foo@bar/baz'
129
- n.jid.must_be_kind_of Blather::JID
130
- n.jid.must_equal Blather::JID.new('foo@bar/baz')
129
+ n.jid.should be_kind_of Blather::JID
130
+ n.jid.should == Blather::JID.new('foo@bar/baz')
131
131
  n.jid = 'baz@foo/bar'
132
- n.jid.must_equal Blather::JID.new('baz@foo/bar')
132
+ n.jid.should == Blather::JID.new('baz@foo/bar')
133
133
  end
134
134
 
135
135
  it 'has a node attribute' do
136
136
  n = Blather::Stanza::Iq::DiscoItems::Item.new 'foo@bar/baz', 'music'
137
- n.node.must_equal 'music'
137
+ n.node.should == 'music'
138
138
  n.node = 'book'
139
- n.node.must_equal 'book'
139
+ n.node.should == 'book'
140
140
  end
141
141
 
142
142
  it 'has a name attribute' do
143
143
  n = Blather::Stanza::Iq::DiscoItems::Item.new 'foo@bar/baz', nil, 'Music from the time of Shakespeare'
144
- n.name.must_equal 'Music from the time of Shakespeare'
144
+ n.name.should == 'Music from the time of Shakespeare'
145
145
  n.name = 'Books by and about Shakespeare'
146
- n.name.must_equal 'Books by and about Shakespeare'
146
+ n.name.should == 'Books by and about Shakespeare'
147
147
  end
148
148
 
149
149
  it 'can determine equality' do
150
150
  a = Blather::Stanza::Iq::DiscoItems::Item.new('foo@bar/baz')
151
- a.must_equal Blather::Stanza::Iq::DiscoItems::Item.new('foo@bar/baz')
152
- a.wont_equal Blather::Stanza::Iq::DiscoItems::Item.new('not-foo@bar/baz')
151
+ a.should == Blather::Stanza::Iq::DiscoItems::Item.new('foo@bar/baz')
152
+ a.should_not equal Blather::Stanza::Iq::DiscoItems::Item.new('not-foo@bar/baz')
153
153
  end
154
154
  end
@@ -19,188 +19,188 @@ end
19
19
 
20
20
  describe Blather::Stanza::Iq::Command do
21
21
  it 'registers itself' do
22
- Blather::XMPPNode.class_from_registration(:command, 'http://jabber.org/protocol/commands').must_equal Blather::Stanza::Iq::Command
22
+ Blather::XMPPNode.class_from_registration(:command, 'http://jabber.org/protocol/commands').should == Blather::Stanza::Iq::Command
23
23
  end
24
24
 
25
25
  it 'must be importable' do
26
- Blather::XMPPNode.import(parse_stanza(command_xml).root).must_be_instance_of Blather::Stanza::Iq::Command
26
+ Blather::XMPPNode.parse(command_xml).should be_instance_of Blather::Stanza::Iq::Command
27
27
  end
28
28
 
29
29
  it 'ensures a command node is present on create' do
30
30
  c = Blather::Stanza::Iq::Command.new
31
- c.xpath('xmlns:command', :xmlns => Blather::Stanza::Iq::Command.registered_ns).wont_be_empty
31
+ c.xpath('xmlns:command', :xmlns => Blather::Stanza::Iq::Command.registered_ns).should_not be_empty
32
32
  end
33
33
 
34
34
  it 'ensures a command node exists when calling #command' do
35
35
  c = Blather::Stanza::Iq::Command.new
36
36
  c.remove_children :command
37
- c.xpath('ns:command', :ns => Blather::Stanza::Iq::Command.registered_ns).must_be_empty
37
+ c.xpath('ns:command', :ns => Blather::Stanza::Iq::Command.registered_ns).should be_empty
38
38
 
39
- c.command.wont_be_nil
40
- c.xpath('ns:command', :ns => Blather::Stanza::Iq::Command.registered_ns).wont_be_empty
39
+ c.command.should_not be_nil
40
+ c.xpath('ns:command', :ns => Blather::Stanza::Iq::Command.registered_ns).should_not be_empty
41
41
  end
42
42
 
43
43
  Blather::Stanza::Iq::Command::VALID_ACTIONS.each do |valid_action|
44
44
  it "provides a helper (#{valid_action}?) for action #{valid_action}" do
45
- Blather::Stanza::Iq::Command.new.must_respond_to :"#{valid_action}?"
45
+ Blather::Stanza::Iq::Command.new.should respond_to :"#{valid_action}?"
46
46
  end
47
47
  end
48
48
 
49
49
  Blather::Stanza::Iq::Command::VALID_STATUS.each do |valid_status|
50
50
  it "provides a helper (#{valid_status}?) for status #{valid_status}" do
51
- Blather::Stanza::Iq::Command.new.must_respond_to :"#{valid_status}?"
51
+ Blather::Stanza::Iq::Command.new.should respond_to :"#{valid_status}?"
52
52
  end
53
53
  end
54
54
 
55
55
  Blather::Stanza::Iq::Command::VALID_NOTE_TYPES.each do |valid_note_type|
56
56
  it "provides a helper (#{valid_note_type}?) for note_type #{valid_note_type}" do
57
- Blather::Stanza::Iq::Command.new.must_respond_to :"#{valid_note_type}?"
57
+ Blather::Stanza::Iq::Command.new.should respond_to :"#{valid_note_type}?"
58
58
  end
59
59
  end
60
60
 
61
61
  [:cancel, :execute, :complete, :next, :prev].each do |action|
62
62
  it "action can be set as \"#{action}\"" do
63
63
  c = Blather::Stanza::Iq::Command.new nil, nil, action
64
- c.action.must_equal action
64
+ c.action.should == action
65
65
  end
66
66
  end
67
67
 
68
68
  [:get, :set, :result, :error].each do |type|
69
69
  it "can be set as \"#{type}\"" do
70
70
  c = Blather::Stanza::Iq::Command.new type
71
- c.type.must_equal type
71
+ c.type.should == type
72
72
  end
73
73
  end
74
74
 
75
75
  it 'sets type to "result" on reply' do
76
76
  c = Blather::Stanza::Iq::Command.new
77
- c.type.must_equal :set
78
- reply = c.reply.type.must_equal :result
77
+ c.type.should == :set
78
+ reply = c.reply.type.should == :result
79
79
  end
80
80
 
81
81
  it 'sets type to "result" on reply!' do
82
82
  c = Blather::Stanza::Iq::Command.new
83
- c.type.must_equal :set
83
+ c.type.should == :set
84
84
  c.reply!
85
- c.type.must_equal :result
85
+ c.type.should == :result
86
86
  end
87
87
 
88
88
  it 'removes action on reply' do
89
- c = Blather::XMPPNode.import parse_stanza(command_xml).root
90
- c.action.must_equal :execute
91
- c.reply.action.must_equal nil
89
+ c = Blather::XMPPNode.parse command_xml
90
+ c.action.should == :execute
91
+ c.reply.action.should == nil
92
92
  end
93
93
 
94
94
  it 'removes action on reply!' do
95
- c = Blather::XMPPNode.import parse_stanza(command_xml).root
96
- c.action.must_equal :execute
95
+ c = Blather::XMPPNode.parse command_xml
96
+ c.action.should == :execute
97
97
  c.reply!
98
- c.action.must_equal nil
98
+ c.action.should == nil
99
99
  end
100
100
 
101
101
  it 'can be registered under a namespace' do
102
102
  class CommandNs < Blather::Stanza::Iq::Command; register :command_ns, nil, 'command:ns'; end
103
- Blather::XMPPNode.class_from_registration(:command, 'command:ns').must_equal CommandNs
103
+ Blather::XMPPNode.class_from_registration(:command, 'command:ns').should == CommandNs
104
104
  c_ns = CommandNs.new
105
- c_ns.xpath('command').must_be_empty
106
- c_ns.xpath('ns:command', :ns => 'command:ns').size.must_equal 1
105
+ c_ns.xpath('command').should be_empty
106
+ c_ns.xpath('ns:command', :ns => 'command:ns').size.should == 1
107
107
 
108
108
  c_ns.command
109
109
  c_ns.command
110
- c_ns.xpath('ns:command', :ns => 'command:ns').size.must_equal 1
110
+ c_ns.xpath('ns:command', :ns => 'command:ns').size.should == 1
111
111
  end
112
112
 
113
113
  it 'is constructed properly' do
114
114
  n = Blather::Stanza::Iq::Command.new :set, "node", :execute
115
115
  n.to = 'to@jid.com'
116
- n.find("/iq[@to='to@jid.com' and @type='set' and @id='#{n.id}']/ns:command[@node='node' and @action='execute']", :ns => Blather::Stanza::Iq::Command.registered_ns).wont_be_empty
116
+ n.find("/iq[@to='to@jid.com' and @type='set' and @id='#{n.id}']/ns:command[@node='node' and @action='execute']", :ns => Blather::Stanza::Iq::Command.registered_ns).should_not be_empty
117
117
  end
118
118
 
119
119
  it 'has an action attribute' do
120
120
  n = Blather::Stanza::Iq::Command.new
121
- n.action.must_equal :execute
121
+ n.action.should == :execute
122
122
  n.action = :cancel
123
- n.action.must_equal :cancel
123
+ n.action.should == :cancel
124
124
  end
125
125
 
126
126
  it 'must default action to :execute on import' do
127
- n = Blather::XMPPNode.import(parse_stanza(command_xml).root)
128
- n.action.must_equal :execute
127
+ n = Blather::XMPPNode.parse(command_xml)
128
+ n.action.should == :execute
129
129
  end
130
130
 
131
131
  it 'has a status attribute' do
132
132
  n = Blather::Stanza::Iq::Command.new
133
- n.status.must_equal :executing
133
+ n.status.should == :executing
134
134
  n.status = :completed
135
- n.status.must_equal :completed
135
+ n.status.should == :completed
136
136
  end
137
137
 
138
138
  it 'has a sessionid attribute' do
139
139
  n = Blather::Stanza::Iq::Command.new
140
- n.sessionid.must_equal nil
140
+ n.sessionid.should == nil
141
141
  n.sessionid = "somerandomstring"
142
- n.sessionid.must_equal Digest::SHA1.hexdigest("somerandomstring")
142
+ n.sessionid.should == Digest::SHA1.hexdigest("somerandomstring")
143
143
  end
144
144
 
145
145
  it 'has a sessionid? attribute' do
146
146
  n = Blather::Stanza::Iq::Command.new
147
- n.sessionid?.must_equal false
147
+ n.sessionid?.should == false
148
148
  n.new_sessionid!
149
- n.sessionid?.must_equal true
149
+ n.sessionid?.should == true
150
150
  end
151
151
 
152
152
  it 'has an allowed_actions attribute' do
153
- n = Blather::XMPPNode.import parse_stanza(command_xml).root
154
- n.allowed_actions.must_equal [:execute]
153
+ n = Blather::XMPPNode.parse command_xml
154
+ n.allowed_actions.should == [:execute]
155
155
  n.allowed_actions = [:next, :prev]
156
- (n.allowed_actions - [:next, :prev, :execute]).must_be_empty
156
+ (n.allowed_actions - [:next, :prev, :execute]).should be_empty
157
157
  n.remove_allowed_actions!
158
- n.allowed_actions.must_equal [:execute]
158
+ n.allowed_actions.should == [:execute]
159
159
  n.allowed_actions += [:next]
160
- (n.allowed_actions - [:next, :execute]).must_be_empty
160
+ (n.allowed_actions - [:next, :execute]).should be_empty
161
161
 
162
162
  r = Blather::Stanza::Iq::Command.new
163
- r.allowed_actions.must_equal [:execute]
163
+ r.allowed_actions.should == [:execute]
164
164
  r.allowed_actions += [:prev]
165
- (r.allowed_actions - [:prev, :execute]).must_be_empty
165
+ (r.allowed_actions - [:prev, :execute]).should be_empty
166
166
  end
167
167
 
168
168
  it 'has a primary_allowed_action attribute' do
169
- n = Blather::XMPPNode.import parse_stanza(command_xml).root
170
- n.primary_allowed_action.must_equal :execute
169
+ n = Blather::XMPPNode.parse command_xml
170
+ n.primary_allowed_action.should == :execute
171
171
  n.primary_allowed_action = :next
172
- n.primary_allowed_action.must_equal :next
172
+ n.primary_allowed_action.should == :next
173
173
  end
174
174
 
175
175
  it 'has a note_type attribute' do
176
176
  n = Blather::Stanza::Iq::Command.new
177
- n.note_type.must_equal nil
177
+ n.note_type.should == nil
178
178
  n.note_type = :info
179
- n.note_type.must_equal :info
179
+ n.note_type.should == :info
180
180
  end
181
181
 
182
182
  it 'has a note_text attribute' do
183
183
  n = Blather::Stanza::Iq::Command.new
184
- n.note_text.must_equal nil
184
+ n.note_text.should == nil
185
185
  n.note_text = "Some text"
186
- n.note_text.must_equal "Some text"
186
+ n.note_text.should == "Some text"
187
187
  end
188
188
 
189
189
  it 'makes a form child available' do
190
- n = Blather::XMPPNode.import(parse_stanza(command_xml).root)
191
- n.form.fields.size.must_equal 1
192
- n.form.fields.map { |f| f.class }.uniq.must_equal [Blather::Stanza::X::Field]
193
- n.form.must_be_instance_of Blather::Stanza::X
190
+ n = Blather::XMPPNode.parse(command_xml)
191
+ n.form.fields.size.should == 1
192
+ n.form.fields.map { |f| f.class }.uniq.should == [Blather::Stanza::X::Field]
193
+ n.form.should be_instance_of Blather::Stanza::X
194
194
 
195
195
  r = Blather::Stanza::Iq::Command.new
196
196
  r.form.type = :form
197
- r.form.type.must_equal :form
197
+ r.form.type.should == :form
198
198
  end
199
199
 
200
200
  it 'ensures the form child is a child of command' do
201
201
  r = Blather::Stanza::Iq::Command.new
202
202
  r.form
203
- r.command.xpath('ns:x', :ns => Blather::Stanza::X.registered_ns).wont_be_empty
204
- r.xpath('ns:x', :ns => Blather::Stanza::X.registered_ns).must_be_empty
203
+ r.command.xpath('ns:x', :ns => Blather::Stanza::X.registered_ns).should_not be_empty
204
+ r.xpath('ns:x', :ns => Blather::Stanza::X.registered_ns).should be_empty
205
205
  end
206
206
  end
@@ -44,93 +44,81 @@ end
44
44
 
45
45
  describe Blather::Stanza::Iq::Ibb::Open do
46
46
  it 'registers itself' do
47
- Blather::XMPPNode.class_from_registration(:open, 'http://jabber.org/protocol/ibb').must_equal Blather::Stanza::Iq::Ibb::Open
47
+ Blather::XMPPNode.class_from_registration(:open, 'http://jabber.org/protocol/ibb').should == Blather::Stanza::Iq::Ibb::Open
48
48
  end
49
49
 
50
50
  it 'can be imported' do
51
- doc = parse_stanza ibb_open_xml
52
- node = Blather::XMPPNode.import(doc.root)
53
- node.must_be_instance_of Blather::Stanza::Iq::Ibb::Open
51
+ node = Blather::XMPPNode.parse ibb_open_xml
52
+ node.should be_instance_of Blather::Stanza::Iq::Ibb::Open
54
53
  end
55
54
 
56
55
  it 'has open node' do
57
- doc = parse_stanza ibb_open_xml
58
- node = Blather::XMPPNode.import(doc.root)
59
- node.open.must_be_kind_of Nokogiri::XML::Element
56
+ node = Blather::XMPPNode.parse ibb_open_xml
57
+ node.open.should be_kind_of Nokogiri::XML::Element
60
58
  end
61
59
 
62
60
  it 'can get sid' do
63
- doc = parse_stanza ibb_open_xml
64
- node = Blather::XMPPNode.import(doc.root)
65
- node.sid.must_equal 'i781hf64'
61
+ node = Blather::XMPPNode.parse ibb_open_xml
62
+ node.sid.should == 'i781hf64'
66
63
  end
67
64
 
68
65
  it 'deleted open node on reply' do
69
- doc = parse_stanza ibb_open_xml
70
- node = Blather::XMPPNode.import(doc.root)
66
+ node = Blather::XMPPNode.parse ibb_open_xml
71
67
  reply = node.reply
72
- reply.open.must_be_nil
68
+ reply.open.should be_nil
73
69
  end
74
70
  end
75
71
 
76
72
  describe Blather::Stanza::Iq::Ibb::Data do
77
73
  it 'registers itself' do
78
- Blather::XMPPNode.class_from_registration(:data, 'http://jabber.org/protocol/ibb').must_equal Blather::Stanza::Iq::Ibb::Data
74
+ Blather::XMPPNode.class_from_registration(:data, 'http://jabber.org/protocol/ibb').should == Blather::Stanza::Iq::Ibb::Data
79
75
  end
80
76
 
81
77
  it 'can be imported' do
82
- doc = parse_stanza ibb_data_xml
83
- node = Blather::XMPPNode.import(doc.root)
84
- node.must_be_instance_of Blather::Stanza::Iq::Ibb::Data
78
+ node = Blather::XMPPNode.parse ibb_data_xml
79
+ node.should be_instance_of Blather::Stanza::Iq::Ibb::Data
85
80
  end
86
81
 
87
82
  it 'has data node' do
88
- doc = parse_stanza ibb_data_xml
89
- node = Blather::XMPPNode.import(doc.root)
90
- node.data.must_be_kind_of Nokogiri::XML::Element
83
+ node = Blather::XMPPNode.parse ibb_data_xml
84
+ node.data.should be_kind_of Nokogiri::XML::Element
91
85
  end
92
86
 
93
87
  it 'can get sid' do
94
- doc = parse_stanza ibb_data_xml
95
- node = Blather::XMPPNode.import(doc.root)
96
- node.sid.must_equal 'i781hf64'
88
+ node = Blather::XMPPNode.parse ibb_data_xml
89
+ node.sid.should == 'i781hf64'
97
90
  end
98
91
 
99
92
  it 'deleted data node on reply' do
100
- doc = parse_stanza ibb_data_xml
101
- node = Blather::XMPPNode.import(doc.root)
93
+ node = Blather::XMPPNode.parse ibb_data_xml
102
94
  reply = node.reply
103
- reply.data.must_be_nil
95
+ reply.data.should be_nil
104
96
  end
105
97
  end
106
98
 
107
99
  describe Blather::Stanza::Iq::Ibb::Close do
108
100
  it 'registers itself' do
109
- Blather::XMPPNode.class_from_registration(:close, 'http://jabber.org/protocol/ibb').must_equal Blather::Stanza::Iq::Ibb::Close
101
+ Blather::XMPPNode.class_from_registration(:close, 'http://jabber.org/protocol/ibb').should == Blather::Stanza::Iq::Ibb::Close
110
102
  end
111
103
 
112
104
  it 'can be imported' do
113
- doc = parse_stanza ibb_close_xml
114
- node = Blather::XMPPNode.import(doc.root)
115
- node.must_be_instance_of Blather::Stanza::Iq::Ibb::Close
105
+ node = Blather::XMPPNode.parse ibb_close_xml
106
+ node.should be_instance_of Blather::Stanza::Iq::Ibb::Close
116
107
  end
117
108
 
118
109
  it 'has close node' do
119
- doc = parse_stanza ibb_close_xml
120
- node = Blather::XMPPNode.import(doc.root)
121
- node.close.must_be_kind_of Nokogiri::XML::Element
110
+ node = Blather::XMPPNode.parse ibb_close_xml
111
+ node.close.should be_kind_of Nokogiri::XML::Element
122
112
  end
123
113
 
124
114
  it 'can get sid' do
125
- doc = parse_stanza ibb_close_xml
126
- node = Blather::XMPPNode.import(doc.root)
127
- node.sid.must_equal 'i781hf64'
115
+ node = Blather::XMPPNode.parse ibb_close_xml
116
+ node.sid.should == 'i781hf64'
128
117
  end
129
118
 
130
119
  it 'deleted close node on reply' do
131
- doc = parse_stanza ibb_close_xml
132
- node = Blather::XMPPNode.import(doc.root)
120
+ node = Blather::XMPPNode.parse ibb_close_xml
133
121
  reply = node.reply
134
- reply.close.must_be_nil
122
+ reply.close.should be_nil
135
123
  end
136
124
  end