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
@@ -13,44 +13,44 @@ end
13
13
 
14
14
  describe 'Blather::Stanza::Presence::C' do
15
15
  it 'registers itself' do
16
- Blather::XMPPNode.class_from_registration(:c, 'http://jabber.org/protocol/caps' ).should == Blather::Stanza::Presence::C
16
+ expect(Blather::XMPPNode.class_from_registration(:c, 'http://jabber.org/protocol/caps' )).to eq(Blather::Stanza::Presence::C)
17
17
  end
18
18
 
19
19
  it 'must be importable' do
20
20
  c = Blather::XMPPNode.parse c_xml
21
- c.should be_kind_of Blather::Stanza::Presence::C::InstanceMethods
22
- c.hash.should == :'sha-1'
23
- c.node.should == 'http://www.chatopus.com'
24
- c.ver.should == 'zHyEOgxTrkpSdGcQKH8EFPLsriY='
21
+ expect(c).to be_kind_of Blather::Stanza::Presence::C::InstanceMethods
22
+ expect(c.hash).to eq(:'sha-1')
23
+ expect(c.node).to eq('http://www.chatopus.com')
24
+ expect(c.ver).to eq('zHyEOgxTrkpSdGcQKH8EFPLsriY=')
25
25
  end
26
26
 
27
27
  it 'ensures hash is one of Blather::Stanza::Presence::C::VALID_HASH_TYPES' do
28
- lambda { Blather::Stanza::Presence::C.new nil, nil, :invalid_type_name }.should raise_error(Blather::ArgumentError)
28
+ expect { Blather::Stanza::Presence::C.new nil, nil, :invalid_type_name }.to raise_error(Blather::ArgumentError)
29
29
 
30
30
  Blather::Stanza::Presence::C::VALID_HASH_TYPES.each do |valid_hash|
31
31
  c = Blather::Stanza::Presence::C.new nil, nil, valid_hash
32
- c.hash.should == valid_hash.to_sym
32
+ expect(c.hash).to eq(valid_hash.to_sym)
33
33
  end
34
34
  end
35
35
 
36
36
  it 'can set a hash on creation' do
37
37
  c = Blather::Stanza::Presence::C.new nil, nil, :md5
38
- c.hash.should == :md5
38
+ expect(c.hash).to eq(:md5)
39
39
  end
40
40
 
41
41
  it 'can set a node on creation' do
42
42
  c = Blather::Stanza::Presence::C.new 'http://www.chatopus.com'
43
- c.node.should == 'http://www.chatopus.com'
43
+ expect(c.node).to eq('http://www.chatopus.com')
44
44
  end
45
45
 
46
46
  it 'can set a ver on creation' do
47
47
  c = Blather::Stanza::Presence::C.new nil, 'zHyEOgxTrkpSdGcQKH8EFPLsriY='
48
- c.ver.should == 'zHyEOgxTrkpSdGcQKH8EFPLsriY='
48
+ expect(c.ver).to eq('zHyEOgxTrkpSdGcQKH8EFPLsriY=')
49
49
  end
50
50
 
51
51
  it 'is equal on import and creation' do
52
52
  p = Blather::XMPPNode.parse c_xml
53
53
  c = Blather::Stanza::Presence::C.new 'http://www.chatopus.com', 'zHyEOgxTrkpSdGcQKH8EFPLsriY=', 'sha-1'
54
- p.should == c
54
+ expect(p).to eq(c)
55
55
  end
56
56
  end
@@ -12,26 +12,26 @@ end
12
12
 
13
13
  describe 'Blather::Stanza::Presence::MUC' do
14
14
  it 'registers itself' do
15
- Blather::XMPPNode.class_from_registration(:x, 'http://jabber.org/protocol/muc' ).should == Blather::Stanza::Presence::MUC
15
+ expect(Blather::XMPPNode.class_from_registration(:x, 'http://jabber.org/protocol/muc' )).to eq(Blather::Stanza::Presence::MUC)
16
16
  end
17
17
 
18
18
  it 'must be importable' do
19
19
  c = Blather::XMPPNode.parse(muc_xml)
20
- c.should be_kind_of Blather::Stanza::Presence::MUC::InstanceMethods
21
- c.xpath('ns:x', :ns => Blather::Stanza::Presence::MUC.registered_ns).count.should == 1
20
+ expect(c).to be_kind_of Blather::Stanza::Presence::MUC::InstanceMethods
21
+ expect(c.xpath('ns:x', :ns => Blather::Stanza::Presence::MUC.registered_ns).count).to eq(1)
22
22
  end
23
23
 
24
24
  it 'ensures a form node is present on create' do
25
25
  c = Blather::Stanza::Presence::MUC.new
26
- c.xpath('ns:x', :ns => Blather::Stanza::Presence::MUC.registered_ns).should_not be_empty
26
+ expect(c.xpath('ns:x', :ns => Blather::Stanza::Presence::MUC.registered_ns)).not_to be_empty
27
27
  end
28
28
 
29
29
  it 'ensures a form node exists when calling #muc' do
30
30
  c = Blather::Stanza::Presence::MUC.new
31
31
  c.remove_children :x
32
- c.xpath('ns:x', :ns => Blather::Stanza::Presence::MUC.registered_ns).should be_empty
32
+ expect(c.xpath('ns:x', :ns => Blather::Stanza::Presence::MUC.registered_ns)).to be_empty
33
33
 
34
- c.muc.should_not be_nil
35
- c.xpath('ns:x', :ns => Blather::Stanza::Presence::MUC.registered_ns).should_not be_empty
34
+ expect(c.muc).not_to be_nil
35
+ expect(c.xpath('ns:x', :ns => Blather::Stanza::Presence::MUC.registered_ns)).not_to be_empty
36
36
  end
37
37
  end
@@ -20,64 +20,64 @@ end
20
20
  describe 'Blather::Stanza::Presence::MUCUser' do
21
21
  it 'must be importable' do
22
22
  muc_user = Blather::XMPPNode.parse(muc_user_xml)
23
- muc_user.should be_kind_of Blather::Stanza::Presence::MUCUser::InstanceMethods
24
- muc_user.affiliation.should == :none
25
- muc_user.jid.should == 'hag66@shakespeare.lit/pda'
26
- muc_user.role.should == :participant
27
- muc_user.status_codes.should == [100, 110]
28
- muc_user.password.should == 'foobar'
23
+ expect(muc_user).to be_kind_of Blather::Stanza::Presence::MUCUser::InstanceMethods
24
+ expect(muc_user.affiliation).to eq(:none)
25
+ expect(muc_user.jid).to eq('hag66@shakespeare.lit/pda')
26
+ expect(muc_user.role).to eq(:participant)
27
+ expect(muc_user.status_codes).to eq([100, 110])
28
+ expect(muc_user.password).to eq('foobar')
29
29
  end
30
30
 
31
31
  it 'ensures a form node is present on create' do
32
32
  c = Blather::Stanza::Presence::MUCUser.new
33
- c.xpath('ns:x', :ns => Blather::Stanza::Presence::MUCUser.registered_ns).should_not be_empty
33
+ expect(c.xpath('ns:x', :ns => Blather::Stanza::Presence::MUCUser.registered_ns)).not_to be_empty
34
34
  end
35
35
 
36
36
  it 'ensures a form node exists when calling #muc' do
37
37
  c = Blather::Stanza::Presence::MUCUser.new
38
38
  c.remove_children :x
39
- c.xpath('ns:x', :ns => Blather::Stanza::Presence::MUCUser.registered_ns).should be_empty
39
+ expect(c.xpath('ns:x', :ns => Blather::Stanza::Presence::MUCUser.registered_ns)).to be_empty
40
40
 
41
- c.muc_user.should_not be_nil
42
- c.xpath('ns:x', :ns => Blather::Stanza::Presence::MUCUser.registered_ns).should_not be_empty
41
+ expect(c.muc_user).not_to be_nil
42
+ expect(c.xpath('ns:x', :ns => Blather::Stanza::Presence::MUCUser.registered_ns)).not_to be_empty
43
43
  end
44
44
 
45
45
  it "must be able to set the affiliation" do
46
46
  muc_user = Blather::Stanza::Presence::MUCUser.new
47
- muc_user.affiliation.should == nil
47
+ expect(muc_user.affiliation).to eq(nil)
48
48
  muc_user.affiliation = :none
49
- muc_user.affiliation.should == :none
49
+ expect(muc_user.affiliation).to eq(:none)
50
50
  end
51
51
 
52
52
  it "must be able to set the role" do
53
53
  muc_user = Blather::Stanza::Presence::MUCUser.new
54
- muc_user.role.should == nil
54
+ expect(muc_user.role).to eq(nil)
55
55
  muc_user.role = :participant
56
- muc_user.role.should == :participant
56
+ expect(muc_user.role).to eq(:participant)
57
57
  end
58
58
 
59
59
  it "must be able to set the jid" do
60
60
  muc_user = Blather::Stanza::Presence::MUCUser.new
61
- muc_user.jid.should == nil
61
+ expect(muc_user.jid).to eq(nil)
62
62
  muc_user.jid = 'foo@bar.com'
63
- muc_user.jid.should == 'foo@bar.com'
63
+ expect(muc_user.jid).to eq('foo@bar.com')
64
64
  end
65
65
 
66
66
  it "must be able to set the status codes" do
67
67
  muc_user = Blather::Stanza::Presence::MUCUser.new
68
- muc_user.status_codes.should == []
68
+ expect(muc_user.status_codes).to eq([])
69
69
  muc_user.status_codes = [100, 110]
70
- muc_user.status_codes.should == [100, 110]
70
+ expect(muc_user.status_codes).to eq([100, 110])
71
71
  muc_user.status_codes = [500]
72
- muc_user.status_codes.should == [500]
72
+ expect(muc_user.status_codes).to eq([500])
73
73
  end
74
74
 
75
75
  it "must be able to set the password" do
76
76
  muc_user = Blather::Stanza::Presence::MUCUser.new
77
- muc_user.password.should == nil
77
+ expect(muc_user.password).to eq(nil)
78
78
  muc_user.password = 'barbaz'
79
- muc_user.password.should == 'barbaz'
79
+ expect(muc_user.password).to eq('barbaz')
80
80
  muc_user.password = 'hello_world'
81
- muc_user.password.should == 'hello_world'
81
+ expect(muc_user.password).to eq('hello_world')
82
82
  end
83
83
  end
@@ -2,15 +2,15 @@ require 'spec_helper'
2
2
 
3
3
  describe Blather::Stanza::Presence::Status do
4
4
  it 'registers itself' do
5
- Blather::XMPPNode.class_from_registration(:status, nil).should == Blather::Stanza::Presence::Status
5
+ expect(Blather::XMPPNode.class_from_registration(:status, nil)).to eq(Blather::Stanza::Presence::Status)
6
6
  end
7
7
 
8
8
  it 'must be importable as unavailable' do
9
- Blather::XMPPNode.parse('<presence type="unavailable"/>').should be_kind_of Blather::Stanza::Presence::Status::InstanceMethods
9
+ expect(Blather::XMPPNode.parse('<presence type="unavailable"/>')).to be_kind_of Blather::Stanza::Presence::Status::InstanceMethods
10
10
  end
11
11
 
12
12
  it 'must be importable as nil' do
13
- Blather::XMPPNode.parse('<presence/>').should be_kind_of Blather::Stanza::Presence::Status::InstanceMethods
13
+ expect(Blather::XMPPNode.parse('<presence/>')).to be_kind_of Blather::Stanza::Presence::Status::InstanceMethods
14
14
  end
15
15
 
16
16
  it 'must be importable with show, status and priority children' do
@@ -21,83 +21,83 @@ describe Blather::Stanza::Presence::Status do
21
21
  <priority>10</priority>
22
22
  </presence>
23
23
  XML
24
- n.should be_kind_of Blather::Stanza::Presence::Status::InstanceMethods
25
- n.state.should == :chat
26
- n.message.should == 'Talk to me!'
27
- n.priority.should == 10
24
+ expect(n).to be_kind_of Blather::Stanza::Presence::Status::InstanceMethods
25
+ expect(n.state).to eq(:chat)
26
+ expect(n.message).to eq('Talk to me!')
27
+ expect(n.priority).to eq(10)
28
28
  end
29
29
 
30
30
  it 'can set state on creation' do
31
31
  status = Blather::Stanza::Presence::Status.new :away
32
- status.state.should == :away
32
+ expect(status.state).to eq(:away)
33
33
  end
34
34
 
35
35
  it 'can set a message on creation' do
36
36
  status = Blather::Stanza::Presence::Status.new nil, 'Say hello!'
37
- status.message.should == 'Say hello!'
37
+ expect(status.message).to eq('Say hello!')
38
38
  end
39
39
 
40
40
  it 'ensures type is nil or :unavailable' do
41
41
  status = Blather::Stanza::Presence::Status.new
42
- lambda { status.type = :invalid_type_name }.should raise_error(Blather::ArgumentError)
42
+ expect { status.type = :invalid_type_name }.to raise_error(Blather::ArgumentError)
43
43
 
44
44
  [nil, :unavailable].each do |valid_type|
45
45
  status.type = valid_type
46
- status.type.should == valid_type
46
+ expect(status.type).to eq(valid_type)
47
47
  end
48
48
  end
49
49
 
50
50
  it 'ensures state is one of Presence::Status::VALID_STATES' do
51
51
  status = Blather::Stanza::Presence::Status.new
52
- lambda { status.state = :invalid_type_name }.should raise_error(Blather::ArgumentError)
52
+ expect { status.state = :invalid_type_name }.to raise_error(Blather::ArgumentError)
53
53
 
54
54
  Blather::Stanza::Presence::Status::VALID_STATES.each do |valid_state|
55
55
  status.state = valid_state
56
- status.state.should == valid_state
56
+ expect(status.state).to eq(valid_state)
57
57
  end
58
58
  end
59
59
 
60
60
  it 'returns :available if state is nil' do
61
- Blather::Stanza::Presence::Status.new.state.should == :available
61
+ expect(Blather::Stanza::Presence::Status.new.state).to eq(:available)
62
62
  end
63
63
 
64
64
  it 'returns :available if <show/> is blank' do
65
65
  status = Blather::XMPPNode.parse(<<-NODE)
66
66
  <presence><show/></presence>
67
67
  NODE
68
- status.state.should == :available
68
+ expect(status.state).to eq(:available)
69
69
  end
70
70
 
71
71
  it 'returns :unavailable if type is :unavailable' do
72
72
  status = Blather::Stanza::Presence::Status.new
73
73
  status.type = :unavailable
74
- status.state.should == :unavailable
74
+ expect(status.state).to eq(:unavailable)
75
75
  end
76
76
 
77
77
  it 'ensures priority is not greater than 127' do
78
- lambda { Blather::Stanza::Presence::Status.new.priority = 128 }.should raise_error(Blather::ArgumentError)
78
+ expect { Blather::Stanza::Presence::Status.new.priority = 128 }.to raise_error(Blather::ArgumentError)
79
79
  end
80
80
 
81
81
  it 'ensures priority is not less than -128' do
82
- lambda { Blather::Stanza::Presence::Status.new.priority = -129 }.should raise_error(Blather::ArgumentError)
82
+ expect { Blather::Stanza::Presence::Status.new.priority = -129 }.to raise_error(Blather::ArgumentError)
83
83
  end
84
84
 
85
85
  it 'has "attr_accessor" for priority' do
86
86
  status = Blather::Stanza::Presence::Status.new
87
- status.priority.should == 0
87
+ expect(status.priority).to eq(0)
88
88
 
89
89
  status.priority = 10
90
- status.children.detect { |n| n.element_name == 'priority' }.should_not be_nil
91
- status.priority.should == 10
90
+ expect(status.children.detect { |n| n.element_name == 'priority' }).not_to be_nil
91
+ expect(status.priority).to eq(10)
92
92
  end
93
93
 
94
94
  it 'has "attr_accessor" for message' do
95
95
  status = Blather::Stanza::Presence::Status.new
96
- status.message.should be_nil
96
+ expect(status.message).to be_nil
97
97
 
98
98
  status.message = 'new message'
99
- status.children.detect { |n| n.element_name == 'status' }.should_not be_nil
100
- status.message.should == 'new message'
99
+ expect(status.children.detect { |n| n.element_name == 'status' }).not_to be_nil
100
+ expect(status.message).to eq('new message')
101
101
  end
102
102
 
103
103
  it 'must be comparable by priority' do
@@ -111,11 +111,11 @@ describe Blather::Stanza::Presence::Status do
111
111
 
112
112
  status1.priority = 1
113
113
  status2.priority = -1
114
- (status1 <=> status2).should == 1
115
- (status2 <=> status1).should == -1
114
+ expect(status1 <=> status2).to eq(1)
115
+ expect(status2 <=> status1).to eq(-1)
116
116
 
117
117
  status2.priority = 1
118
- (status1 <=> status2).should == 0
118
+ expect(status1 <=> status2).to eq(0)
119
119
  end
120
120
 
121
121
  it 'must should sort by status if priorities are equal' do
@@ -128,8 +128,8 @@ describe Blather::Stanza::Presence::Status do
128
128
  status2.from = jid
129
129
 
130
130
  status1.priority = status2.priority = 1
131
- (status1 <=> status2).should == -1
132
- (status2 <=> status1).should == 1
131
+ expect(status1 <=> status2).to eq(-1)
132
+ expect(status2 <=> status1).to eq(1)
133
133
  end
134
134
 
135
135
  it 'raises an argument error if compared to a status with a different Blather::JID' do
@@ -139,20 +139,20 @@ describe Blather::Stanza::Presence::Status do
139
139
  status2 = Blather::Stanza::Presence::Status.new
140
140
  status2.from = 'd@e/f'
141
141
 
142
- lambda { status1 <=> status2 }.should raise_error(Blather::ArgumentError)
142
+ expect { status1 <=> status2 }.to raise_error(Blather::ArgumentError)
143
143
  end
144
144
 
145
145
  ([:available] + Blather::Stanza::Presence::Status::VALID_STATES).each do |valid_state|
146
146
  it "provides a helper (#{valid_state}?) for state #{valid_state}" do
147
- Blather::Stanza::Presence::Status.new.should respond_to :"#{valid_state}?"
147
+ expect(Blather::Stanza::Presence::Status.new).to respond_to :"#{valid_state}?"
148
148
  end
149
149
 
150
150
  it "returns true on call to (#{valid_state}?) if state == #{valid_state}" do
151
151
  method = "#{valid_state}?".to_sym
152
152
  stat = Blather::Stanza::Presence::Status.new
153
153
  stat.state = valid_state
154
- stat.should respond_to method
155
- stat.__send__(method).should == true
154
+ expect(stat).to respond_to method
155
+ expect(stat.__send__(method)).to eq(true)
156
156
  end
157
157
  end
158
158
  end
@@ -2,35 +2,35 @@ require 'spec_helper'
2
2
 
3
3
  describe Blather::Stanza::Presence::Subscription do
4
4
  it 'registers itself' do
5
- Blather::XMPPNode.class_from_registration(:subscription, nil).should == Blather::Stanza::Presence::Subscription
5
+ expect(Blather::XMPPNode.class_from_registration(:subscription, nil)).to eq(Blather::Stanza::Presence::Subscription)
6
6
  end
7
7
 
8
8
  [:subscribe, :subscribed, :unsubscribe, :unsubscribed].each do |type|
9
9
  it "must be importable as #{type}" do
10
- Blather::XMPPNode.parse("<presence type='#{type}'/>").should be_kind_of Blather::Stanza::Presence::Subscription::InstanceMethods
10
+ expect(Blather::XMPPNode.parse("<presence type='#{type}'/>")).to be_kind_of Blather::Stanza::Presence::Subscription::InstanceMethods
11
11
  end
12
12
  end
13
13
 
14
14
  it 'can set to on creation' do
15
15
  sub = Blather::Stanza::Presence::Subscription.new 'a@b'
16
- sub.to.to_s.should == 'a@b'
16
+ expect(sub.to.to_s).to eq('a@b')
17
17
  end
18
18
 
19
19
  it 'can set a type on creation' do
20
20
  sub = Blather::Stanza::Presence::Subscription.new nil, :subscribed
21
- sub.type.should == :subscribed
21
+ expect(sub.type).to eq(:subscribed)
22
22
  end
23
23
 
24
24
  it 'strips Blather::JIDs when setting #to' do
25
25
  sub = Blather::Stanza::Presence::Subscription.new 'a@b/c'
26
- sub.to.to_s.should == 'a@b'
26
+ expect(sub.to.to_s).to eq('a@b')
27
27
  end
28
28
 
29
29
  it 'generates an approval using #approve!' do
30
30
  sub = Blather::Stanza.import Nokogiri::XML('<presence from="a@b" type="subscribe"><status/></presence>').root
31
31
  sub.approve!
32
- sub.to.should == 'a@b'
33
- sub.type.should == :subscribed
32
+ expect(sub.to).to eq('a@b')
33
+ expect(sub.type).to eq(:subscribed)
34
34
  end
35
35
 
36
36
  it 'generates a refusal using #refuse!' do
@@ -38,8 +38,8 @@ describe Blather::Stanza::Presence::Subscription do
38
38
  sub = Blather::Stanza::Presence::Subscription.new
39
39
  sub.from = jid
40
40
  sub.refuse!
41
- sub.to.should == jid
42
- sub.type.should == :unsubscribed
41
+ expect(sub.to).to eq(jid)
42
+ expect(sub.type).to eq(:unsubscribed)
43
43
  end
44
44
 
45
45
  it 'generates an unsubscript using #unsubscribe!' do
@@ -47,8 +47,8 @@ describe Blather::Stanza::Presence::Subscription do
47
47
  sub = Blather::Stanza::Presence::Subscription.new
48
48
  sub.from = jid
49
49
  sub.unsubscribe!
50
- sub.to.should == jid
51
- sub.type.should == :unsubscribe
50
+ expect(sub.to).to eq(jid)
51
+ expect(sub.type).to eq(:unsubscribe)
52
52
  end
53
53
 
54
54
  it 'generates a cancellation using #cancel!' do
@@ -56,8 +56,8 @@ describe Blather::Stanza::Presence::Subscription do
56
56
  sub = Blather::Stanza::Presence::Subscription.new
57
57
  sub.from = jid
58
58
  sub.cancel!
59
- sub.to.should == jid
60
- sub.type.should == :unsubscribed
59
+ expect(sub.to).to eq(jid)
60
+ expect(sub.type).to eq(:unsubscribed)
61
61
  end
62
62
 
63
63
  it 'generates a request using #request!' do
@@ -65,15 +65,15 @@ describe Blather::Stanza::Presence::Subscription do
65
65
  sub = Blather::Stanza::Presence::Subscription.new
66
66
  sub.from = jid
67
67
  sub.request!
68
- sub.to.should == jid
69
- sub.type.should == :subscribe
68
+ expect(sub.to).to eq(jid)
69
+ expect(sub.type).to eq(:subscribe)
70
70
  end
71
71
 
72
72
  it 'has a #request? helper' do
73
73
  sub = Blather::Stanza::Presence::Subscription.new
74
- sub.should respond_to :request?
74
+ expect(sub).to respond_to :request?
75
75
  sub.type = :subscribe
76
- sub.request?.should == true
76
+ expect(sub.request?).to eq(true)
77
77
  end
78
78
 
79
79
  it "successfully routes chained actions" do
@@ -84,9 +84,9 @@ describe Blather::Stanza::Presence::Subscription do
84
84
  sub.to = to
85
85
  sub.cancel!
86
86
  sub.unsubscribe!
87
- sub.type.should == :unsubscribe
88
- sub.to.should == from
89
- sub.from.should == to
87
+ expect(sub.type).to eq(:unsubscribe)
88
+ expect(sub.to).to eq(from)
89
+ expect(sub.from).to eq(to)
90
90
  end
91
91
 
92
92
  it "will inherit only another node's attributes" do
@@ -94,9 +94,9 @@ describe Blather::Stanza::Presence::Subscription do
94
94
  inheritable[:bar] = 'baz'
95
95
 
96
96
  sub = Blather::Stanza::Presence::Subscription.new
97
- sub.should respond_to :inherit
97
+ expect(sub).to respond_to :inherit
98
98
 
99
99
  sub.inherit inheritable
100
- sub[:bar].should == 'baz'
100
+ expect(sub[:bar]).to eq('baz')
101
101
  end
102
102
  end