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