blather 1.2.0 → 2.0.0

Sign up to get free protection for your applications and to get access to all the features.
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
@@ -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').should == Blather::Stanza::Iq::DiscoItems
26
+ expect(Blather::XMPPNode.class_from_registration(:query, 'http://jabber.org/protocol/disco#items')).to eq(Blather::Stanza::Iq::DiscoItems)
27
27
  end
28
28
 
29
29
  it 'must be importable' do
30
- Blather::XMPPNode.parse(disco_items_xml).should be_instance_of Blather::Stanza::Iq::DiscoItems
30
+ expect(Blather::XMPPNode.parse(disco_items_xml)).to 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).should_not be_empty
36
+ expect(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)).not_to 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.should == 'music'
41
+ expect(n.node).to eq('music')
42
42
  n.node = :foo
43
- n.node.should == 'foo'
43
+ expect(n.node).to eq('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.should == 3
50
- r.items.map { |i| i.class }.uniq.should == [Blather::Stanza::Iq::DiscoItems::Item]
49
+ expect(r.items.size).to eq(3)
50
+ expect(r.items.map { |i| i.class }.uniq).to eq([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.should == 2
64
- di.items.each { |i| control.include?(i).should == true }
63
+ expect(di.items.size).to eq(2)
64
+ di.items.each { |i| expect(control.include?(i)).to eq(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.should == 2
73
- di.items.each { |i| control.include?(i).should == true }
72
+ expect(di.items.size).to eq(2)
73
+ di.items.each { |i| expect(control.include?(i)).to eq(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.should == 1
81
- di.items.each { |i| control.include?(i).should == true }
80
+ expect(di.items.size).to eq(1)
81
+ di.items.each { |i| expect(control.include?(i)).to eq(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.should == 1
89
- di.items.each { |i| control.include?(i).should == true }
88
+ expect(di.items.size).to eq(1)
89
+ di.items.each { |i| expect(control.include?(i)).to eq(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.should == 2
103
- di.items.each { |i| control.include?(i).should == true }
102
+ expect(di.items.size).to eq(2)
103
+ di.items.each { |i| expect(control.include?(i)).to eq(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.should == 0
108
+ expect(di.items.size).to eq(0)
109
109
  di.items = [{:jid => 'foo@bar/baz', :node => 'node', :name => 'name'}]
110
- di.items.size.should == 1
110
+ expect(di.items.size).to eq(1)
111
111
  di.items += [Blather::Stanza::Iq::DiscoItems::Item.new(*%w[foo@bar/baz node name])]
112
- di.items.size.should == 2
112
+ expect(di.items.size).to eq(2)
113
113
  di.items = nil
114
- di.items.size.should == 0
114
+ expect(di.items.size).to eq(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.should == Blather::JID.new('foo@bar/baz')
123
- i.node.should == 'music'
124
- i.name.should == 'Music from the time of Shakespeare'
122
+ expect(i.jid).to eq(Blather::JID.new('foo@bar/baz'))
123
+ expect(i.node).to eq('music')
124
+ expect(i.name).to eq('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.should be_kind_of Blather::JID
130
- n.jid.should == Blather::JID.new('foo@bar/baz')
129
+ expect(n.jid).to be_kind_of Blather::JID
130
+ expect(n.jid).to eq(Blather::JID.new('foo@bar/baz'))
131
131
  n.jid = 'baz@foo/bar'
132
- n.jid.should == Blather::JID.new('baz@foo/bar')
132
+ expect(n.jid).to eq(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.should == 'music'
137
+ expect(n.node).to eq('music')
138
138
  n.node = 'book'
139
- n.node.should == 'book'
139
+ expect(n.node).to eq('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.should == 'Music from the time of Shakespeare'
144
+ expect(n.name).to eq('Music from the time of Shakespeare')
145
145
  n.name = 'Books by and about Shakespeare'
146
- n.name.should == 'Books by and about Shakespeare'
146
+ expect(n.name).to eq('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.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')
151
+ expect(a).to eq(Blather::Stanza::Iq::DiscoItems::Item.new('foo@bar/baz'))
152
+ expect(a).not_to 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').should == Blather::Stanza::Iq::Command
22
+ expect(Blather::XMPPNode.class_from_registration(:command, 'http://jabber.org/protocol/commands')).to eq(Blather::Stanza::Iq::Command)
23
23
  end
24
24
 
25
25
  it 'must be importable' do
26
- Blather::XMPPNode.parse(command_xml).should be_instance_of Blather::Stanza::Iq::Command
26
+ expect(Blather::XMPPNode.parse(command_xml)).to 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).should_not be_empty
31
+ expect(c.xpath('xmlns:command', :xmlns => Blather::Stanza::Iq::Command.registered_ns)).not_to 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).should be_empty
37
+ expect(c.xpath('ns:command', :ns => Blather::Stanza::Iq::Command.registered_ns)).to be_empty
38
38
 
39
- c.command.should_not be_nil
40
- c.xpath('ns:command', :ns => Blather::Stanza::Iq::Command.registered_ns).should_not be_empty
39
+ expect(c.command).not_to be_nil
40
+ expect(c.xpath('ns:command', :ns => Blather::Stanza::Iq::Command.registered_ns)).not_to 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.should respond_to :"#{valid_action}?"
45
+ expect(Blather::Stanza::Iq::Command.new).to 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.should respond_to :"#{valid_status}?"
51
+ expect(Blather::Stanza::Iq::Command.new).to 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.should respond_to :"#{valid_note_type}?"
57
+ expect(Blather::Stanza::Iq::Command.new).to 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.should == action
64
+ expect(c.action).to eq(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.should == type
71
+ expect(c.type).to eq(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.should == :set
78
- reply = c.reply.type.should == :result
77
+ expect(c.type).to eq(:set)
78
+ reply = expect(c.reply.type).to eq(: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.should == :set
83
+ expect(c.type).to eq(:set)
84
84
  c.reply!
85
- c.type.should == :result
85
+ expect(c.type).to eq(:result)
86
86
  end
87
87
 
88
88
  it 'removes action on reply' do
89
89
  c = Blather::XMPPNode.parse command_xml
90
- c.action.should == :execute
91
- c.reply.action.should == nil
90
+ expect(c.action).to eq(:execute)
91
+ expect(c.reply.action).to eq(nil)
92
92
  end
93
93
 
94
94
  it 'removes action on reply!' do
95
95
  c = Blather::XMPPNode.parse command_xml
96
- c.action.should == :execute
96
+ expect(c.action).to eq(:execute)
97
97
  c.reply!
98
- c.action.should == nil
98
+ expect(c.action).to eq(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').should == CommandNs
103
+ expect(Blather::XMPPNode.class_from_registration(:command, 'command:ns')).to eq(CommandNs)
104
104
  c_ns = CommandNs.new
105
- c_ns.xpath('command').should be_empty
106
- c_ns.xpath('ns:command', :ns => 'command:ns').size.should == 1
105
+ expect(c_ns.xpath('command')).to be_empty
106
+ expect(c_ns.xpath('ns:command', :ns => 'command:ns').size).to eq(1)
107
107
 
108
108
  c_ns.command
109
109
  c_ns.command
110
- c_ns.xpath('ns:command', :ns => 'command:ns').size.should == 1
110
+ expect(c_ns.xpath('ns:command', :ns => 'command:ns').size).to eq(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).should_not be_empty
116
+ expect(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)).not_to 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.should == :execute
121
+ expect(n.action).to eq(:execute)
122
122
  n.action = :cancel
123
- n.action.should == :cancel
123
+ expect(n.action).to eq(:cancel)
124
124
  end
125
125
 
126
126
  it 'must default action to :execute on import' do
127
127
  n = Blather::XMPPNode.parse(command_xml)
128
- n.action.should == :execute
128
+ expect(n.action).to eq(: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.should == :executing
133
+ expect(n.status).to eq(:executing)
134
134
  n.status = :completed
135
- n.status.should == :completed
135
+ expect(n.status).to eq(: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.should == nil
140
+ expect(n.sessionid).to eq(nil)
141
141
  n.sessionid = "somerandomstring"
142
- n.sessionid.should == Digest::SHA1.hexdigest("somerandomstring")
142
+ expect(n.sessionid).to eq(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?.should == false
147
+ expect(n.sessionid?).to eq(false)
148
148
  n.new_sessionid!
149
- n.sessionid?.should == true
149
+ expect(n.sessionid?).to eq(true)
150
150
  end
151
151
 
152
152
  it 'has an allowed_actions attribute' do
153
153
  n = Blather::XMPPNode.parse command_xml
154
- n.allowed_actions.should == [:execute]
154
+ expect(n.allowed_actions).to eq([:execute])
155
155
  n.allowed_actions = [:next, :prev]
156
- (n.allowed_actions - [:next, :prev, :execute]).should be_empty
156
+ expect(n.allowed_actions - [:next, :prev, :execute]).to be_empty
157
157
  n.remove_allowed_actions!
158
- n.allowed_actions.should == [:execute]
158
+ expect(n.allowed_actions).to eq([:execute])
159
159
  n.allowed_actions += [:next]
160
- (n.allowed_actions - [:next, :execute]).should be_empty
160
+ expect(n.allowed_actions - [:next, :execute]).to be_empty
161
161
 
162
162
  r = Blather::Stanza::Iq::Command.new
163
- r.allowed_actions.should == [:execute]
163
+ expect(r.allowed_actions).to eq([:execute])
164
164
  r.allowed_actions += [:prev]
165
- (r.allowed_actions - [:prev, :execute]).should be_empty
165
+ expect(r.allowed_actions - [:prev, :execute]).to be_empty
166
166
  end
167
167
 
168
168
  it 'has a primary_allowed_action attribute' do
169
169
  n = Blather::XMPPNode.parse command_xml
170
- n.primary_allowed_action.should == :execute
170
+ expect(n.primary_allowed_action).to eq(:execute)
171
171
  n.primary_allowed_action = :next
172
- n.primary_allowed_action.should == :next
172
+ expect(n.primary_allowed_action).to eq(: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.should == nil
177
+ expect(n.note_type).to eq(nil)
178
178
  n.note_type = :info
179
- n.note_type.should == :info
179
+ expect(n.note_type).to eq(: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.should == nil
184
+ expect(n.note_text).to eq(nil)
185
185
  n.note_text = "Some text"
186
- n.note_text.should == "Some text"
186
+ expect(n.note_text).to eq("Some text")
187
187
  end
188
188
 
189
189
  it 'makes a form child available' do
190
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
191
+ expect(n.form.fields.size).to eq(1)
192
+ expect(n.form.fields.map { |f| f.class }.uniq).to eq([Blather::Stanza::X::Field])
193
+ expect(n.form).to 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.should == :form
197
+ expect(r.form.type).to eq(: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).should_not be_empty
204
- r.xpath('ns:x', :ns => Blather::Stanza::X.registered_ns).should be_empty
203
+ expect(r.command.xpath('ns:x', :ns => Blather::Stanza::X.registered_ns)).not_to be_empty
204
+ expect(r.xpath('ns:x', :ns => Blather::Stanza::X.registered_ns)).to be_empty
205
205
  end
206
206
  end
@@ -44,81 +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').should == Blather::Stanza::Iq::Ibb::Open
47
+ expect(Blather::XMPPNode.class_from_registration(:open, 'http://jabber.org/protocol/ibb')).to eq(Blather::Stanza::Iq::Ibb::Open)
48
48
  end
49
49
 
50
50
  it 'can be imported' do
51
51
  node = Blather::XMPPNode.parse ibb_open_xml
52
- node.should be_instance_of Blather::Stanza::Iq::Ibb::Open
52
+ expect(node).to be_instance_of Blather::Stanza::Iq::Ibb::Open
53
53
  end
54
54
 
55
55
  it 'has open node' do
56
56
  node = Blather::XMPPNode.parse ibb_open_xml
57
- node.open.should be_kind_of Nokogiri::XML::Element
57
+ expect(node.open).to be_kind_of Nokogiri::XML::Element
58
58
  end
59
59
 
60
60
  it 'can get sid' do
61
61
  node = Blather::XMPPNode.parse ibb_open_xml
62
- node.sid.should == 'i781hf64'
62
+ expect(node.sid).to eq('i781hf64')
63
63
  end
64
64
 
65
65
  it 'deleted open node on reply' do
66
66
  node = Blather::XMPPNode.parse ibb_open_xml
67
67
  reply = node.reply
68
- reply.open.should be_nil
68
+ expect(reply.open).to be_nil
69
69
  end
70
70
  end
71
71
 
72
72
  describe Blather::Stanza::Iq::Ibb::Data do
73
73
  it 'registers itself' do
74
- Blather::XMPPNode.class_from_registration(:data, 'http://jabber.org/protocol/ibb').should == Blather::Stanza::Iq::Ibb::Data
74
+ expect(Blather::XMPPNode.class_from_registration(:data, 'http://jabber.org/protocol/ibb')).to eq(Blather::Stanza::Iq::Ibb::Data)
75
75
  end
76
76
 
77
77
  it 'can be imported' do
78
78
  node = Blather::XMPPNode.parse ibb_data_xml
79
- node.should be_instance_of Blather::Stanza::Iq::Ibb::Data
79
+ expect(node).to be_instance_of Blather::Stanza::Iq::Ibb::Data
80
80
  end
81
81
 
82
82
  it 'has data node' do
83
83
  node = Blather::XMPPNode.parse ibb_data_xml
84
- node.data.should be_kind_of Nokogiri::XML::Element
84
+ expect(node.data).to be_kind_of Nokogiri::XML::Element
85
85
  end
86
86
 
87
87
  it 'can get sid' do
88
88
  node = Blather::XMPPNode.parse ibb_data_xml
89
- node.sid.should == 'i781hf64'
89
+ expect(node.sid).to eq('i781hf64')
90
90
  end
91
91
 
92
92
  it 'deleted data node on reply' do
93
93
  node = Blather::XMPPNode.parse ibb_data_xml
94
94
  reply = node.reply
95
- reply.data.should be_nil
95
+ expect(reply.data).to be_nil
96
96
  end
97
97
  end
98
98
 
99
99
  describe Blather::Stanza::Iq::Ibb::Close do
100
100
  it 'registers itself' do
101
- Blather::XMPPNode.class_from_registration(:close, 'http://jabber.org/protocol/ibb').should == Blather::Stanza::Iq::Ibb::Close
101
+ expect(Blather::XMPPNode.class_from_registration(:close, 'http://jabber.org/protocol/ibb')).to eq(Blather::Stanza::Iq::Ibb::Close)
102
102
  end
103
103
 
104
104
  it 'can be imported' do
105
105
  node = Blather::XMPPNode.parse ibb_close_xml
106
- node.should be_instance_of Blather::Stanza::Iq::Ibb::Close
106
+ expect(node).to be_instance_of Blather::Stanza::Iq::Ibb::Close
107
107
  end
108
108
 
109
109
  it 'has close node' do
110
110
  node = Blather::XMPPNode.parse ibb_close_xml
111
- node.close.should be_kind_of Nokogiri::XML::Element
111
+ expect(node.close).to be_kind_of Nokogiri::XML::Element
112
112
  end
113
113
 
114
114
  it 'can get sid' do
115
115
  node = Blather::XMPPNode.parse ibb_close_xml
116
- node.sid.should == 'i781hf64'
116
+ expect(node.sid).to eq('i781hf64')
117
117
  end
118
118
 
119
119
  it 'deleted close node on reply' do
120
120
  node = Blather::XMPPNode.parse ibb_close_xml
121
121
  reply = node.reply
122
- reply.close.should be_nil
122
+ expect(reply.close).to be_nil
123
123
  end
124
124
  end