blather 1.2.0 → 2.0.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 (61) hide show
  1. checksums.yaml +5 -5
  2. data/.travis.yml +7 -7
  3. data/CHANGELOG.md +8 -0
  4. data/blather.gemspec +6 -6
  5. data/lib/blather.rb +1 -1
  6. data/lib/blather/client/client.rb +30 -6
  7. data/lib/blather/version.rb +1 -1
  8. data/spec/blather/client/client_spec.rb +73 -68
  9. data/spec/blather/client/dsl/pubsub_spec.rb +121 -121
  10. data/spec/blather/client/dsl_spec.rb +9 -9
  11. data/spec/blather/errors/sasl_error_spec.rb +3 -3
  12. data/spec/blather/errors/stanza_error_spec.rb +26 -26
  13. data/spec/blather/errors/stream_error_spec.rb +22 -22
  14. data/spec/blather/errors_spec.rb +7 -7
  15. data/spec/blather/file_transfer_spec.rb +9 -9
  16. data/spec/blather/jid_spec.rb +29 -29
  17. data/spec/blather/roster_item_spec.rb +18 -18
  18. data/spec/blather/roster_spec.rb +18 -18
  19. data/spec/blather/stanza/discos/disco_info_spec.rb +56 -56
  20. data/spec/blather/stanza/discos/disco_items_spec.rb +33 -33
  21. data/spec/blather/stanza/iq/command_spec.rb +51 -51
  22. data/spec/blather/stanza/iq/ibb_spec.rb +15 -15
  23. data/spec/blather/stanza/iq/ping_spec.rb +8 -8
  24. data/spec/blather/stanza/iq/query_spec.rb +15 -15
  25. data/spec/blather/stanza/iq/roster_spec.rb +29 -29
  26. data/spec/blather/stanza/iq/s5b_spec.rb +7 -7
  27. data/spec/blather/stanza/iq/si_spec.rb +17 -17
  28. data/spec/blather/stanza/iq/vcard_spec.rb +19 -19
  29. data/spec/blather/stanza/iq_spec.rb +11 -11
  30. data/spec/blather/stanza/message/muc_user_spec.rb +32 -32
  31. data/spec/blather/stanza/message_spec.rb +53 -54
  32. data/spec/blather/stanza/presence/c_spec.rb +11 -11
  33. data/spec/blather/stanza/presence/muc_spec.rb +7 -7
  34. data/spec/blather/stanza/presence/muc_user_spec.rb +22 -22
  35. data/spec/blather/stanza/presence/status_spec.rb +33 -33
  36. data/spec/blather/stanza/presence/subscription_spec.rb +22 -22
  37. data/spec/blather/stanza/presence_spec.rb +30 -30
  38. data/spec/blather/stanza/pubsub/affiliations_spec.rb +11 -11
  39. data/spec/blather/stanza/pubsub/create_spec.rb +10 -10
  40. data/spec/blather/stanza/pubsub/event_spec.rb +24 -24
  41. data/spec/blather/stanza/pubsub/items_spec.rb +20 -20
  42. data/spec/blather/stanza/pubsub/publish_spec.rb +21 -21
  43. data/spec/blather/stanza/pubsub/retract_spec.rb +19 -19
  44. data/spec/blather/stanza/pubsub/subscribe_spec.rb +17 -17
  45. data/spec/blather/stanza/pubsub/subscription_spec.rb +28 -28
  46. data/spec/blather/stanza/pubsub/subscriptions_spec.rb +13 -13
  47. data/spec/blather/stanza/pubsub/unsubscribe_spec.rb +22 -22
  48. data/spec/blather/stanza/pubsub_owner/delete_spec.rb +9 -9
  49. data/spec/blather/stanza/pubsub_owner/purge_spec.rb +9 -9
  50. data/spec/blather/stanza/pubsub_owner_spec.rb +6 -6
  51. data/spec/blather/stanza/pubsub_spec.rb +15 -15
  52. data/spec/blather/stanza/x_spec.rb +53 -53
  53. data/spec/blather/stanza_spec.rb +39 -39
  54. data/spec/blather/stream/client_spec.rb +160 -160
  55. data/spec/blather/stream/component_spec.rb +8 -10
  56. data/spec/blather/stream/parser_spec.rb +25 -25
  57. data/spec/blather/stream/ssl_spec.rb +3 -3
  58. data/spec/blather/xmpp_node_spec.rb +9 -9
  59. data/spec/blather_spec.rb +1 -1
  60. data/spec/spec_helper.rb +1 -1
  61. metadata +26 -27
@@ -12,15 +12,15 @@ describe Blather::DSL::PubSub do
12
12
 
13
13
  it 'raises an error when trying to send a stanza without a host' do
14
14
  @pubsub.host = nil
15
- proc { @pubsub.affiliations }.should raise_error RuntimeError
15
+ expect { @pubsub.affiliations }.to raise_error RuntimeError
16
16
  end
17
17
 
18
18
  it 'requests affiliations' do
19
19
  @client.expects(:write_with_handler).with do |n|
20
- n.should be_instance_of Blather::Stanza::PubSub::Affiliations
21
- n.find('//ns:pubsub/ns:affiliations', :ns => Blather::Stanza::PubSub.registered_ns).should_not be_empty
22
- n.to.should == Blather::JID.new(@host)
23
- n.type.should == :get
20
+ expect(n).to be_instance_of Blather::Stanza::PubSub::Affiliations
21
+ expect(n.find('//ns:pubsub/ns:affiliations', :ns => Blather::Stanza::PubSub.registered_ns)).not_to be_empty
22
+ expect(n.to).to eq(Blather::JID.new(@host))
23
+ expect(n.type).to eq(:get)
24
24
  end
25
25
  @pubsub.affiliations
26
26
  end
@@ -28,20 +28,20 @@ describe Blather::DSL::PubSub do
28
28
  it 'requests affiliations from a specified host' do
29
29
  host = 'another.host'
30
30
  @client.expects(:write_with_handler).with do |n|
31
- n.should be_instance_of Blather::Stanza::PubSub::Affiliations
32
- n.find('//ns:pubsub/ns:affiliations', :ns => Blather::Stanza::PubSub.registered_ns).should_not be_empty
33
- n.to.should == Blather::JID.new(host)
34
- n.type.should == :get
31
+ expect(n).to be_instance_of Blather::Stanza::PubSub::Affiliations
32
+ expect(n.find('//ns:pubsub/ns:affiliations', :ns => Blather::Stanza::PubSub.registered_ns)).not_to be_empty
33
+ expect(n.to).to eq(Blather::JID.new(host))
34
+ expect(n.type).to eq(:get)
35
35
  end
36
36
  @pubsub.affiliations host
37
37
  end
38
38
 
39
39
  it 'requests subscriptions' do
40
40
  @client.expects(:write_with_handler).with do |n|
41
- n.should be_instance_of Blather::Stanza::PubSub::Subscriptions
42
- n.find('//ns:pubsub/ns:subscriptions', :ns => Blather::Stanza::PubSub.registered_ns).should_not be_empty
43
- n.to.should == Blather::JID.new(@host)
44
- n.type.should == :get
41
+ expect(n).to be_instance_of Blather::Stanza::PubSub::Subscriptions
42
+ expect(n.find('//ns:pubsub/ns:subscriptions', :ns => Blather::Stanza::PubSub.registered_ns)).not_to be_empty
43
+ expect(n.to).to eq(Blather::JID.new(@host))
44
+ expect(n.type).to eq(:get)
45
45
  end
46
46
  @pubsub.subscriptions
47
47
  end
@@ -49,20 +49,20 @@ describe Blather::DSL::PubSub do
49
49
  it 'requests subscriptions from a specified host' do
50
50
  host = 'another.host'
51
51
  @client.expects(:write_with_handler).with do |n|
52
- n.should be_instance_of Blather::Stanza::PubSub::Subscriptions
53
- n.find('//ns:pubsub/ns:subscriptions', :ns => Blather::Stanza::PubSub.registered_ns).should_not be_empty
54
- n.to.should == Blather::JID.new(host)
55
- n.type.should == :get
52
+ expect(n).to be_instance_of Blather::Stanza::PubSub::Subscriptions
53
+ expect(n.find('//ns:pubsub/ns:subscriptions', :ns => Blather::Stanza::PubSub.registered_ns)).not_to be_empty
54
+ expect(n.to).to eq(Blather::JID.new(host))
55
+ expect(n.type).to eq(:get)
56
56
  end
57
57
  @pubsub.subscriptions host
58
58
  end
59
59
 
60
60
  it 'requests nodes defaulting to "/"' do
61
61
  @client.expects(:write_with_handler).with do |n|
62
- n.should be_instance_of Blather::Stanza::DiscoItems
63
- n.find("/iq/ns:query[@node='/']", :ns => Blather::Stanza::DiscoItems.registered_ns).should_not be_empty
64
- n.to.should == Blather::JID.new(@host)
65
- n.type.should == :get
62
+ expect(n).to be_instance_of Blather::Stanza::DiscoItems
63
+ expect(n.find("/iq/ns:query[@node='/']", :ns => Blather::Stanza::DiscoItems.registered_ns)).not_to be_empty
64
+ expect(n.to).to eq(Blather::JID.new(@host))
65
+ expect(n.type).to eq(:get)
66
66
  end
67
67
  @pubsub.nodes nil
68
68
  end
@@ -70,200 +70,200 @@ describe Blather::DSL::PubSub do
70
70
  it 'requests nodes from a specified host' do
71
71
  host = 'another.host'
72
72
  @client.expects(:write_with_handler).with do |n|
73
- n.should be_instance_of Blather::Stanza::DiscoItems
74
- n.find("/iq/ns:query[@node='/']", :ns => Blather::Stanza::DiscoItems.registered_ns).should_not be_empty
75
- n.to.should == Blather::JID.new(host)
76
- n.type.should == :get
73
+ expect(n).to be_instance_of Blather::Stanza::DiscoItems
74
+ expect(n.find("/iq/ns:query[@node='/']", :ns => Blather::Stanza::DiscoItems.registered_ns)).not_to be_empty
75
+ expect(n.to).to eq(Blather::JID.new(host))
76
+ expect(n.type).to eq(:get)
77
77
  end
78
78
  @pubsub.nodes nil, host
79
79
  end
80
80
 
81
81
  it 'requests nodes under a specified path' do
82
82
  @client.expects(:write_with_handler).with do |n|
83
- n.should be_instance_of Blather::Stanza::DiscoItems
84
- n.find("/iq/ns:query[@node='/path/to/nodes']", :ns => Blather::Stanza::DiscoItems.registered_ns).should_not be_empty
85
- n.to.should == Blather::JID.new(@host)
86
- n.type.should == :get
83
+ expect(n).to be_instance_of Blather::Stanza::DiscoItems
84
+ expect(n.find("/iq/ns:query[@node='/path/to/nodes']", :ns => Blather::Stanza::DiscoItems.registered_ns)).not_to be_empty
85
+ expect(n.to).to eq(Blather::JID.new(@host))
86
+ expect(n.type).to eq(:get)
87
87
  end
88
88
  @pubsub.nodes '/path/to/nodes'
89
89
  end
90
90
 
91
91
  it 'requests information on a node' do
92
92
  @client.expects(:write_with_handler).with do |n|
93
- n.should be_instance_of Blather::Stanza::DiscoInfo
94
- n.find("/iq/ns:query[@node='/path/to/node']", :ns => Blather::Stanza::DiscoInfo.registered_ns).should_not be_empty
95
- n.to.should == Blather::JID.new(@host)
96
- n.type.should == :get
93
+ expect(n).to be_instance_of Blather::Stanza::DiscoInfo
94
+ expect(n.find("/iq/ns:query[@node='/path/to/node']", :ns => Blather::Stanza::DiscoInfo.registered_ns)).not_to be_empty
95
+ expect(n.to).to eq(Blather::JID.new(@host))
96
+ expect(n.type).to eq(:get)
97
97
  end
98
98
  @pubsub.node '/path/to/node'
99
99
  end
100
100
 
101
101
  it 'requests all items from a node' do
102
102
  @client.expects(:write_with_handler).with do |n|
103
- n.should be_instance_of Blather::Stanza::PubSub::Items
104
- n.find("/iq/ns:pubsub/ns:items[@node='/path/to/node']", :ns => Blather::Stanza::PubSub.registered_ns).should_not be_empty
105
- n.to.should == Blather::JID.new(@host)
106
- n.type.should == :get
103
+ expect(n).to be_instance_of Blather::Stanza::PubSub::Items
104
+ expect(n.find("/iq/ns:pubsub/ns:items[@node='/path/to/node']", :ns => Blather::Stanza::PubSub.registered_ns)).not_to be_empty
105
+ expect(n.to).to eq(Blather::JID.new(@host))
106
+ expect(n.type).to eq(:get)
107
107
  end
108
108
  @pubsub.items '/path/to/node'
109
109
  end
110
110
 
111
111
  it 'requests specific items from a node' do
112
112
  @client.expects(:write_with_handler).with do |n|
113
- n.should be_instance_of Blather::Stanza::PubSub::Items
114
- n.find("/iq/ns:pubsub/ns:items[@node='/path/to/node'][ns:item[@id='item1']][ns:item[@id='item2']]", :ns => Blather::Stanza::PubSub.registered_ns).should_not be_empty
115
- n.to.should == Blather::JID.new(@host)
116
- n.type.should == :get
113
+ expect(n).to be_instance_of Blather::Stanza::PubSub::Items
114
+ expect(n.find("/iq/ns:pubsub/ns:items[@node='/path/to/node'][ns:item[@id='item1']][ns:item[@id='item2']]", :ns => Blather::Stanza::PubSub.registered_ns)).not_to be_empty
115
+ expect(n.to).to eq(Blather::JID.new(@host))
116
+ expect(n.type).to eq(:get)
117
117
  end
118
118
  @pubsub.items '/path/to/node', %w[item1 item2]
119
119
  end
120
120
 
121
121
  it 'requests some items from a node' do
122
122
  @client.expects(:write_with_handler).with do |n|
123
- n.should be_instance_of Blather::Stanza::PubSub::Items
124
- n.find("/iq/ns:pubsub/ns:items[@node='/path/to/node' and @max_items='2']", :ns => Blather::Stanza::PubSub.registered_ns).should_not be_empty
125
- n.to.should == Blather::JID.new(@host)
126
- n.type.should == :get
123
+ expect(n).to be_instance_of Blather::Stanza::PubSub::Items
124
+ expect(n.find("/iq/ns:pubsub/ns:items[@node='/path/to/node' and @max_items='2']", :ns => Blather::Stanza::PubSub.registered_ns)).not_to be_empty
125
+ expect(n.to).to eq(Blather::JID.new(@host))
126
+ expect(n.type).to eq(:get)
127
127
  end
128
128
  @pubsub.items '/path/to/node', nil, 2
129
129
  end
130
130
 
131
131
  it 'can publish items to a node with a hash' do
132
132
  @client.expects(:write_with_handler).with do |n|
133
- n.should be_instance_of Blather::Stanza::PubSub::Publish
134
- n.find("/iq[@type='set']/ns:pubsub/ns:publish[@node='/path/to/node' and ns:item[@id='id1' and .='payload1'] and ns:item[@id='id2' and .='payload2']]", :ns => Blather::Stanza::PubSub.registered_ns).should_not be_empty
135
- n.to.should == Blather::JID.new(@host)
136
- n.type.should == :set
133
+ expect(n).to be_instance_of Blather::Stanza::PubSub::Publish
134
+ expect(n.find("/iq[@type='set']/ns:pubsub/ns:publish[@node='/path/to/node' and ns:item[@id='id1' and .='payload1'] and ns:item[@id='id2' and .='payload2']]", :ns => Blather::Stanza::PubSub.registered_ns)).not_to be_empty
135
+ expect(n.to).to eq(Blather::JID.new(@host))
136
+ expect(n.type).to eq(:set)
137
137
  end
138
138
  @pubsub.publish '/path/to/node', {'id1' => 'payload1', 'id2' => 'payload2'}
139
139
  end
140
140
 
141
141
  it 'can publish items to a node with an array' do
142
142
  @client.expects(:write_with_handler).with do |n|
143
- n.should be_instance_of Blather::Stanza::PubSub::Publish
144
- n.find("/iq[@type='set']/ns:pubsub/ns:publish[@node='/path/to/node' and ns:item[.='payload1'] and ns:item[.='payload2']]", :ns => Blather::Stanza::PubSub.registered_ns).should_not be_empty
145
- n.to.should == Blather::JID.new(@host)
146
- n.type.should == :set
143
+ expect(n).to be_instance_of Blather::Stanza::PubSub::Publish
144
+ expect(n.find("/iq[@type='set']/ns:pubsub/ns:publish[@node='/path/to/node' and ns:item[.='payload1'] and ns:item[.='payload2']]", :ns => Blather::Stanza::PubSub.registered_ns)).not_to be_empty
145
+ expect(n.to).to eq(Blather::JID.new(@host))
146
+ expect(n.type).to eq(:set)
147
147
  end
148
148
  @pubsub.publish '/path/to/node', %w[payload1 payload2]
149
149
  end
150
150
 
151
151
  it 'can publish items to a node with a string' do
152
152
  @client.expects(:write_with_handler).with do |n|
153
- n.should be_instance_of Blather::Stanza::PubSub::Publish
154
- n.find("/iq[@type='set']/ns:pubsub/ns:publish[@node='/path/to/node' and ns:item[.='payload']]", :ns => Blather::Stanza::PubSub.registered_ns).should_not be_empty
155
- n.to.should == Blather::JID.new(@host)
156
- n.type.should == :set
153
+ expect(n).to be_instance_of Blather::Stanza::PubSub::Publish
154
+ expect(n.find("/iq[@type='set']/ns:pubsub/ns:publish[@node='/path/to/node' and ns:item[.='payload']]", :ns => Blather::Stanza::PubSub.registered_ns)).not_to be_empty
155
+ expect(n.to).to eq(Blather::JID.new(@host))
156
+ expect(n.type).to eq(:set)
157
157
  end
158
158
  @pubsub.publish '/path/to/node', 'payload'
159
159
  end
160
160
 
161
161
  it 'can retract an item with an array' do
162
162
  @client.expects(:write_with_handler).with do |n|
163
- n.should be_instance_of Blather::Stanza::PubSub::Retract
164
- n.find("/iq[@type='set']/ns:pubsub/ns:retract[@node='/path/to/node' and ns:item[@id='id1'] and ns:item[@id='id2']]", :ns => Blather::Stanza::PubSub.registered_ns).should_not be_empty
165
- n.to.should == Blather::JID.new(@host)
166
- n.type.should == :set
163
+ expect(n).to be_instance_of Blather::Stanza::PubSub::Retract
164
+ expect(n.find("/iq[@type='set']/ns:pubsub/ns:retract[@node='/path/to/node' and ns:item[@id='id1'] and ns:item[@id='id2']]", :ns => Blather::Stanza::PubSub.registered_ns)).not_to be_empty
165
+ expect(n.to).to eq(Blather::JID.new(@host))
166
+ expect(n.type).to eq(:set)
167
167
  end
168
168
  @pubsub.retract '/path/to/node', %w[id1 id2]
169
169
  end
170
170
 
171
171
  it 'can retract an item with a string' do
172
172
  @client.expects(:write_with_handler).with do |n|
173
- n.should be_instance_of Blather::Stanza::PubSub::Retract
174
- n.find("/iq[@type='set']/ns:pubsub/ns:retract[@node='/path/to/node' and ns:item[@id='id1']]", :ns => Blather::Stanza::PubSub.registered_ns).should_not be_empty
175
- n.to.should == Blather::JID.new(@host)
176
- n.type.should == :set
173
+ expect(n).to be_instance_of Blather::Stanza::PubSub::Retract
174
+ expect(n.find("/iq[@type='set']/ns:pubsub/ns:retract[@node='/path/to/node' and ns:item[@id='id1']]", :ns => Blather::Stanza::PubSub.registered_ns)).not_to be_empty
175
+ expect(n.to).to eq(Blather::JID.new(@host))
176
+ expect(n.type).to eq(:set)
177
177
  end
178
178
  @pubsub.retract '/path/to/node', 'id1'
179
179
  end
180
180
 
181
181
  it 'can subscribe to a node with the default jid' do
182
182
  @client.expects(:write_with_handler).with do |n|
183
- n.should be_instance_of Blather::Stanza::PubSub::Subscribe
184
- n.find("/iq[@type='set']/ns:pubsub/ns:subscribe[@node='/path/to/node' and @jid='#{@client.jid.stripped}']", :ns => Blather::Stanza::PubSub.registered_ns).should_not be_empty
185
- n.to.should == Blather::JID.new(@host)
186
- n.type.should == :set
183
+ expect(n).to be_instance_of Blather::Stanza::PubSub::Subscribe
184
+ expect(n.find("/iq[@type='set']/ns:pubsub/ns:subscribe[@node='/path/to/node' and @jid='#{@client.jid.stripped}']", :ns => Blather::Stanza::PubSub.registered_ns)).not_to be_empty
185
+ expect(n.to).to eq(Blather::JID.new(@host))
186
+ expect(n.type).to eq(:set)
187
187
  end
188
188
  @pubsub.subscribe '/path/to/node'
189
189
  end
190
190
 
191
191
  it 'can subscribe to a node with a specified jid as a string' do
192
192
  @client.expects(:write_with_handler).with do |n|
193
- n.should be_instance_of Blather::Stanza::PubSub::Subscribe
194
- n.find("/iq[@type='set']/ns:pubsub/ns:subscribe[@node='/path/to/node' and @jid='jid@d/r']", :ns => Blather::Stanza::PubSub.registered_ns).should_not be_empty
195
- n.to.should == Blather::JID.new(@host)
196
- n.type.should == :set
193
+ expect(n).to be_instance_of Blather::Stanza::PubSub::Subscribe
194
+ expect(n.find("/iq[@type='set']/ns:pubsub/ns:subscribe[@node='/path/to/node' and @jid='jid@d/r']", :ns => Blather::Stanza::PubSub.registered_ns)).not_to be_empty
195
+ expect(n.to).to eq(Blather::JID.new(@host))
196
+ expect(n.type).to eq(:set)
197
197
  end
198
198
  @pubsub.subscribe '/path/to/node', 'jid@d/r'
199
199
  end
200
200
 
201
201
  it 'can subscribe to a node with a specified jid as a Blather::JID' do
202
202
  @client.expects(:write_with_handler).with do |n|
203
- n.should be_instance_of Blather::Stanza::PubSub::Subscribe
204
- n.find("/iq[@type='set']/ns:pubsub/ns:subscribe[@node='/path/to/node' and @jid='jid@d/r']", :ns => Blather::Stanza::PubSub.registered_ns).should_not be_empty
205
- n.to.should == Blather::JID.new(@host)
206
- n.type.should == :set
203
+ expect(n).to be_instance_of Blather::Stanza::PubSub::Subscribe
204
+ expect(n.find("/iq[@type='set']/ns:pubsub/ns:subscribe[@node='/path/to/node' and @jid='jid@d/r']", :ns => Blather::Stanza::PubSub.registered_ns)).not_to be_empty
205
+ expect(n.to).to eq(Blather::JID.new(@host))
206
+ expect(n.type).to eq(:set)
207
207
  end
208
208
  @pubsub.subscribe '/path/to/node', Blather::JID.new('jid@d/r')
209
209
  end
210
210
 
211
211
  it 'can unsubscribe to a node with the default jid' do
212
212
  @client.expects(:write_with_handler).with do |n|
213
- n.should be_instance_of Blather::Stanza::PubSub::Unsubscribe
214
- n.find("/iq[@type='set']/ns:pubsub/ns:unsubscribe[@node='/path/to/node' and @jid='#{@client.jid.stripped}']", :ns => Blather::Stanza::PubSub.registered_ns).should_not be_empty
215
- n.to.should == Blather::JID.new(@host)
216
- n.type.should == :set
213
+ expect(n).to be_instance_of Blather::Stanza::PubSub::Unsubscribe
214
+ expect(n.find("/iq[@type='set']/ns:pubsub/ns:unsubscribe[@node='/path/to/node' and @jid='#{@client.jid.stripped}']", :ns => Blather::Stanza::PubSub.registered_ns)).not_to be_empty
215
+ expect(n.to).to eq(Blather::JID.new(@host))
216
+ expect(n.type).to eq(:set)
217
217
  end
218
218
  @pubsub.unsubscribe '/path/to/node'
219
219
  end
220
220
 
221
221
  it 'can unsubscribe to a node with a specified jid as a string' do
222
222
  @client.expects(:write_with_handler).with do |n|
223
- n.should be_instance_of Blather::Stanza::PubSub::Unsubscribe
224
- n.find("/iq[@type='set']/ns:pubsub/ns:unsubscribe[@node='/path/to/node' and @jid='jid@d/r']", :ns => Blather::Stanza::PubSub.registered_ns).should_not be_empty
225
- n.to.should == Blather::JID.new(@host)
226
- n.type.should == :set
223
+ expect(n).to be_instance_of Blather::Stanza::PubSub::Unsubscribe
224
+ expect(n.find("/iq[@type='set']/ns:pubsub/ns:unsubscribe[@node='/path/to/node' and @jid='jid@d/r']", :ns => Blather::Stanza::PubSub.registered_ns)).not_to be_empty
225
+ expect(n.to).to eq(Blather::JID.new(@host))
226
+ expect(n.type).to eq(:set)
227
227
  end
228
228
  @pubsub.unsubscribe '/path/to/node', 'jid@d/r'
229
229
  end
230
230
 
231
231
  it 'can unsubscribe to a node with a specified jid as a Blather::JID' do
232
232
  @client.expects(:write_with_handler).with do |n|
233
- n.should be_instance_of Blather::Stanza::PubSub::Unsubscribe
234
- n.find("/iq[@type='set']/ns:pubsub/ns:unsubscribe[@node='/path/to/node' and @jid='jid@d/r']", :ns => Blather::Stanza::PubSub.registered_ns).should_not be_empty
235
- n.to.should == Blather::JID.new(@host)
236
- n.type.should == :set
233
+ expect(n).to be_instance_of Blather::Stanza::PubSub::Unsubscribe
234
+ expect(n.find("/iq[@type='set']/ns:pubsub/ns:unsubscribe[@node='/path/to/node' and @jid='jid@d/r']", :ns => Blather::Stanza::PubSub.registered_ns)).not_to be_empty
235
+ expect(n.to).to eq(Blather::JID.new(@host))
236
+ expect(n.type).to eq(:set)
237
237
  end
238
238
  @pubsub.unsubscribe '/path/to/node', Blather::JID.new('jid@d/r')
239
239
  end
240
240
 
241
241
  it 'can unsubscribe with a particular subscription id' do
242
242
  @client.expects(:write_with_handler).with do |n|
243
- n.should be_instance_of Blather::Stanza::PubSub::Unsubscribe
244
- n.find("/iq[@type='set']/ns:pubsub/ns:unsubscribe[@node='/path/to/node' and @jid='jid@d/r' and @subid='subid']", :ns => Blather::Stanza::PubSub.registered_ns).should_not be_empty
245
- n.subid.should == 'subid'
246
- n.type.should == :set
243
+ expect(n).to be_instance_of Blather::Stanza::PubSub::Unsubscribe
244
+ expect(n.find("/iq[@type='set']/ns:pubsub/ns:unsubscribe[@node='/path/to/node' and @jid='jid@d/r' and @subid='subid']", :ns => Blather::Stanza::PubSub.registered_ns)).not_to be_empty
245
+ expect(n.subid).to eq('subid')
246
+ expect(n.type).to eq(:set)
247
247
  end
248
248
  @pubsub.unsubscribe '/path/to/node', 'jid@d/r', 'subid'
249
249
  end
250
250
 
251
251
  it 'can purge a node' do
252
252
  @client.expects(:write_with_handler).with do |n|
253
- n.should be_instance_of Blather::Stanza::PubSubOwner::Purge
254
- n.find("/iq[@type='set']/ns:pubsub/ns:purge[@node='/path/to/node']", :ns => Blather::Stanza::PubSubOwner.registered_ns).should_not be_empty
255
- n.to.should == Blather::JID.new(@host)
256
- n.type.should == :set
253
+ expect(n).to be_instance_of Blather::Stanza::PubSubOwner::Purge
254
+ expect(n.find("/iq[@type='set']/ns:pubsub/ns:purge[@node='/path/to/node']", :ns => Blather::Stanza::PubSubOwner.registered_ns)).not_to be_empty
255
+ expect(n.to).to eq(Blather::JID.new(@host))
256
+ expect(n.type).to eq(:set)
257
257
  end
258
258
  @pubsub.purge '/path/to/node'
259
259
  end
260
260
 
261
261
  it 'can create a node' do
262
262
  @client.expects(:write_with_handler).with do |n|
263
- n.should be_instance_of Blather::Stanza::PubSub::Create
264
- n.find("/iq[@type='set']/ns:pubsub/ns:create[@node='/path/to/node']", :ns => Blather::Stanza::PubSub.registered_ns).should_not be_empty
265
- n.to.should == Blather::JID.new(@host)
266
- n.type.should == :set
263
+ expect(n).to be_instance_of Blather::Stanza::PubSub::Create
264
+ expect(n.find("/iq[@type='set']/ns:pubsub/ns:create[@node='/path/to/node']", :ns => Blather::Stanza::PubSub.registered_ns)).not_to be_empty
265
+ expect(n.to).to eq(Blather::JID.new(@host))
266
+ expect(n.type).to eq(:set)
267
267
  end
268
268
  @pubsub.create '/path/to/node'
269
269
  end
@@ -279,21 +279,21 @@ describe Blather::DSL::PubSub do
279
279
  { :var => "pubsub#publish_model", :value => "open" }]
280
280
  })
281
281
  @client.expects(:write_with_handler).with do |n|
282
- n.should be_instance_of Blather::Stanza::PubSub::Create
283
- n.find("/iq[@type='set']/ns:pubsub/ns:create[@node='/path/to/node']", :ns => Blather::Stanza::PubSub.registered_ns).should_not be_empty
284
- n.to.should == Blather::JID.new(@host)
285
- n.type.should == :set
286
- n.configure_node.should == pubsub_configure
282
+ expect(n).to be_instance_of Blather::Stanza::PubSub::Create
283
+ expect(n.find("/iq[@type='set']/ns:pubsub/ns:create[@node='/path/to/node']", :ns => Blather::Stanza::PubSub.registered_ns)).not_to be_empty
284
+ expect(n.to).to eq(Blather::JID.new(@host))
285
+ expect(n.type).to eq(:set)
286
+ expect(n.configure_node).to eq(pubsub_configure)
287
287
  end
288
288
  @pubsub.create '/path/to/node', nil, pubsub_configure
289
289
  end
290
290
 
291
291
  it 'can delete a node' do
292
292
  @client.expects(:write_with_handler).with do |n|
293
- n.should be_instance_of Blather::Stanza::PubSubOwner::Delete
294
- n.find("/iq[@type='set']/ns:pubsub/ns:delete[@node='/path/to/node']", :ns => Blather::Stanza::PubSubOwner.registered_ns).should_not be_empty
295
- n.to.should == Blather::JID.new(@host)
296
- n.type.should == :set
293
+ expect(n).to be_instance_of Blather::Stanza::PubSubOwner::Delete
294
+ expect(n.find("/iq[@type='set']/ns:pubsub/ns:delete[@node='/path/to/node']", :ns => Blather::Stanza::PubSubOwner.registered_ns)).not_to be_empty
295
+ expect(n.to).to eq(Blather::JID.new(@host))
296
+ expect(n.type).to eq(:set)
297
297
  end
298
298
  @pubsub.delete '/path/to/node'
299
299
  end
@@ -309,7 +309,7 @@ describe 'Blather::DSL::PubSub callbacks' do
309
309
  it 'returns a list of affiliations when requesting affiliations' do
310
310
  affiliations = Blather::XMPPNode.parse(affiliations_xml)
311
311
  response = mock()
312
- response.expects(:call).with { |n| n.should == affiliations.list }
312
+ response.expects(:call).with { |n| expect(n).to eq(affiliations.list) }
313
313
  @client.stubs(:write).with do |n|
314
314
  affiliations.id = n.id
315
315
  @client.receive_data affiliations
@@ -321,7 +321,7 @@ describe 'Blather::DSL::PubSub callbacks' do
321
321
  it 'returns a list of subscriptions when requesting subscriptions' do
322
322
  subscriptions = Blather::XMPPNode.parse(subscriptions_xml)
323
323
  response = mock()
324
- response.expects(:call).with { |n| n.should == subscriptions.list }
324
+ response.expects(:call).with { |n| expect(n).to eq(subscriptions.list) }
325
325
  @client.stubs(:write).with do |n|
326
326
  subscriptions.id = n.id
327
327
  @client.receive_data subscriptions
@@ -347,7 +347,7 @@ describe 'Blather::DSL::PubSub callbacks' do
347
347
  </iq>
348
348
  NODES
349
349
  response = mock()
350
- response.expects(:call).with { |n| n.should == nodes.items }
350
+ response.expects(:call).with { |n| expect(n).to eq(nodes.items) }
351
351
  @client.stubs(:write).with do |n|
352
352
  nodes.id = n.id
353
353
  @client.receive_data nodes
@@ -369,7 +369,7 @@ describe 'Blather::DSL::PubSub callbacks' do
369
369
  </iq>
370
370
  NODES
371
371
  response = mock()
372
- response.expects(:call).with { |n| n.should == node }
372
+ response.expects(:call).with { |n| expect(n).to eq(node) }
373
373
  @client.stubs(:write).with do |n|
374
374
  node.id = n.id
375
375
  @client.receive_data node
@@ -381,7 +381,7 @@ describe 'Blather::DSL::PubSub callbacks' do
381
381
  it 'returns a set of items when requesting items' do
382
382
  items = Blather::XMPPNode.parse(items_all_nodes_xml)
383
383
  response = mock()
384
- response.expects(:call).with { |n| n.map{|i|i.to_s}.should == items.items.map{|i|i.to_s} }
384
+ response.expects(:call).with { |n| expect(n.map{|i|i.to_s}).to eq(items.items.map{|i|i.to_s}) }
385
385
  @client.stubs(:write).with do |n|
386
386
  items.id = n.id
387
387
  @client.receive_data items
@@ -393,7 +393,7 @@ describe 'Blather::DSL::PubSub callbacks' do
393
393
  it 'returns aa subscription node when subscribing' do
394
394
  subscription = Blather::XMPPNode.parse(subscription_xml)
395
395
  response = mock()
396
- response.expects(:call).with { |n| n.should == subscription }
396
+ response.expects(:call).with { |n| expect(n).to eq(subscription) }
397
397
  @client.stubs(:write).with do |n|
398
398
  subscription.id = n.id
399
399
  @client.receive_data subscription
@@ -405,7 +405,7 @@ describe 'Blather::DSL::PubSub callbacks' do
405
405
  it 'returns aa unsubscribe node when unsubscribing' do
406
406
  unsubscribe = Blather::XMPPNode.parse(unsubscribe_xml)
407
407
  response = mock()
408
- response.expects(:call).with { |n| n.should == unsubscribe }
408
+ response.expects(:call).with { |n| expect(n).to eq(unsubscribe) }
409
409
  @client.stubs(:write).with do |n|
410
410
  unsubscribe.id = n.id
411
411
  @client.receive_data unsubscribe
@@ -428,7 +428,7 @@ describe 'Blather::DSL::PubSub callbacks' do
428
428
  </iq>
429
429
  NODE
430
430
  response = mock()
431
- response.expects(:call).with { |n| n.should == result }
431
+ response.expects(:call).with { |n| expect(n).to eq(result) }
432
432
  @client.stubs(:write).with do |n|
433
433
  result.id = n.id
434
434
  @client.receive_data result
@@ -449,7 +449,7 @@ describe 'Blather::DSL::PubSub callbacks' do
449
449
  </iq>
450
450
  NODE
451
451
  response = mock()
452
- response.expects(:call).with { |n| n.should == result }
452
+ response.expects(:call).with { |n| expect(n).to eq(result) }
453
453
  @client.stubs(:write).with do |n|
454
454
  result.id = n.id
455
455
  @client.receive_data result
@@ -465,7 +465,7 @@ describe 'Blather::DSL::PubSub callbacks' do
465
465
  id='purge1'/>
466
466
  NODE
467
467
  response = mock()
468
- response.expects(:call).with { |n| n.should == result }
468
+ response.expects(:call).with { |n| expect(n).to eq(result) }
469
469
  @client.stubs(:write).with do |n|
470
470
  result.id = n.id
471
471
  @client.receive_data result
@@ -481,7 +481,7 @@ describe 'Blather::DSL::PubSub callbacks' do
481
481
  id='delete1'/>
482
482
  NODE
483
483
  response = mock()
484
- response.expects(:call).with { |n| n.should == result }
484
+ response.expects(:call).with { |n| expect(n).to eq(result) }
485
485
  @client.stubs(:write).with do |n|
486
486
  result.id = n.id
487
487
  @client.receive_data result