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
@@ -4,68 +4,68 @@ describe Blather::RosterItem do
4
4
  it 'can be initialized with Blather::JID' do
5
5
  jid = Blather::JID.new(jid)
6
6
  i = Blather::RosterItem.new jid
7
- i.jid.must_equal jid
7
+ i.jid.should == jid
8
8
  end
9
9
 
10
10
  it 'can be initialized with an Iq::RosterItem' do
11
11
  jid = 'n@d/r'
12
12
  i = Blather::RosterItem.new Blather::Stanza::Iq::Roster::RosterItem.new(jid)
13
- i.jid.must_equal Blather::JID.new(jid).stripped
13
+ i.jid.should == Blather::JID.new(jid).stripped
14
14
  end
15
15
 
16
16
  it 'can be initialized with a string' do
17
17
  jid = 'n@d/r'
18
18
  i = Blather::RosterItem.new jid
19
- i.jid.must_equal Blather::JID.new(jid).stripped
19
+ i.jid.should == Blather::JID.new(jid).stripped
20
20
  end
21
21
 
22
22
  it 'returns the same object when intialized with a Blather::RosterItem' do
23
23
  control = Blather::RosterItem.new 'n@d/r'
24
- Blather::RosterItem.new(control).must_be_same_as control
24
+ Blather::RosterItem.new(control).should be control
25
25
  end
26
26
 
27
27
  it 'has a Blather::JID setter that strips the Blather::JID' do
28
28
  jid = Blather::JID.new('n@d/r')
29
29
  i = Blather::RosterItem.new nil
30
30
  i.jid = jid
31
- i.jid.must_equal jid.stripped
31
+ i.jid.should == jid.stripped
32
32
  end
33
33
 
34
34
  it 'has a subscription setter that forces a symbol' do
35
35
  i = Blather::RosterItem.new nil
36
36
  i.subscription = 'remove'
37
- i.subscription.must_equal :remove
37
+ i.subscription.should == :remove
38
38
  end
39
39
 
40
40
  it 'forces the type of subscription' do
41
- proc { Blather::RosterItem.new(nil).subscription = 'foo' }.must_raise Blather::ArgumentError
41
+ proc { Blather::RosterItem.new(nil).subscription = 'foo' }.should raise_error Blather::ArgumentError
42
42
  end
43
43
 
44
44
  it 'returns :none if the subscription field is blank' do
45
- Blather::RosterItem.new(nil).subscription.must_equal :none
45
+ Blather::RosterItem.new(nil).subscription.should == :none
46
46
  end
47
47
 
48
48
  it 'ensure #ask is a symbol' do
49
49
  i = Blather::RosterItem.new(nil)
50
50
  i.ask = 'subscribe'
51
- i.ask.must_equal :subscribe
51
+ i.ask.should == :subscribe
52
52
  end
53
53
 
54
54
  it 'forces #ask to be :subscribe or nothing at all' do
55
- proc { Blather::RosterItem.new(nil).ask = 'foo' }.must_raise Blather::ArgumentError
55
+ proc { Blather::RosterItem.new(nil).ask = 'foo' }.should raise_error Blather::ArgumentError
56
56
  end
57
57
 
58
58
  it 'generates a stanza with #to_stanza' do
59
59
  jid = Blather::JID.new('n@d/r')
60
60
  i = Blather::RosterItem.new jid
61
61
  s = i.to_stanza
62
- s.must_be_kind_of Blather::Stanza::Iq::Roster
63
- s.items.first.jid.must_equal jid.stripped
62
+ s.should be_kind_of Blather::Stanza::Iq::Roster
63
+ s.items.first.jid.should == jid.stripped
64
64
  end
65
65
 
66
66
  it 'returns status based on priority' do
67
67
  setup_item_with_presences
68
- @i.status.must_equal @p3
68
+ @i.status.should == @p3
69
69
  end
70
70
 
71
71
  it 'returns status based on priority and state' do
@@ -77,12 +77,12 @@ describe Blather::RosterItem do
77
77
  @p4.priority = 15
78
78
  @i.status = @p4
79
79
 
80
- @i.status.must_equal @p3
80
+ @i.status.should == @p3
81
81
  end
82
82
 
83
83
  it 'returns status based on resource' do
84
84
  setup_item_with_presences
85
- @i.status('a').must_equal @p
85
+ @i.status('a').should == @p
86
86
  end
87
87
 
88
88
  def setup_item_with_presences
@@ -116,12 +116,12 @@ describe Blather::RosterItem do
116
116
  @i.status = p
117
117
  end
118
118
 
119
- @i.statuses.size.must_equal 4
119
+ @i.statuses.size.should == 4
120
120
  end
121
121
 
122
122
  it 'initializes groups to [nil] if the item is not part of a group' do
123
123
  i = Blather::RosterItem.new 'n@d'
124
- i.groups.must_equal [nil]
124
+ i.groups.should == [nil]
125
125
  end
126
126
 
127
127
  it 'can determine equality' do
@@ -129,6 +129,6 @@ describe Blather::RosterItem do
129
129
  item2 = Blather::RosterItem.new 'n@d'
130
130
  item1.groups = %w[group1 group2]
131
131
  item2.groups = %w[group1 group2]
132
- (item1 == item2).must_equal true
132
+ (item1 == item2).should == true
133
133
  end
134
134
  end
@@ -13,31 +13,31 @@ describe Blather::Roster do
13
13
  end
14
14
 
15
15
  it 'initializes with items' do
16
- @roster.items.map { |_,i| i.jid.to_s }.must_equal(@stanza.items.map { |i| i.stripped.to_s }.uniq)
16
+ @roster.items.map { |_,i| i.jid.to_s }.should == (@stanza.items.map { |i| i.stripped.to_s }.uniq)
17
17
  end
18
18
 
19
19
  it 'processes @stanzas with remove requests' do
20
20
  s = @roster['n@d/0r']
21
21
  s.subscription = :remove
22
- proc { @roster.process(s.to_stanza) }.must_change('@roster.items.length', :by => -1)
22
+ proc { @roster.process(s.to_stanza) }.should change(@roster, :length).by -1
23
23
  end
24
24
 
25
25
  it 'processes @stanzas with add requests' do
26
26
  s = Blather::Stanza::Iq::Roster::RosterItem.new('a@b/c').to_stanza
27
- proc { @roster.process(s) }.must_change('@roster.items.length', :by => 1)
27
+ proc { @roster.process(s) }.should change(@roster, :length).by 1
28
28
  end
29
29
 
30
30
  it 'allows a jid to be pushed' do
31
31
  jid = 'a@b/c'
32
- proc { @roster.push(jid) }.must_change('@roster.items.length', :by => 1)
33
- @roster[jid].wont_be_nil
32
+ proc { @roster.push(jid) }.should change(@roster, :length).by 1
33
+ @roster[jid].should_not be_nil
34
34
  end
35
35
 
36
36
  it 'allows an item to be pushed' do
37
37
  jid = 'a@b/c'
38
38
  item = Blather::RosterItem.new(Blather::JID.new(jid))
39
- proc { @roster.push(item) }.must_change('@roster.items.length', :by => 1)
40
- @roster[jid].wont_be_nil
39
+ proc { @roster.push(item) }.should change(@roster, :length).by 1
40
+ @roster[jid].should_not be_nil
41
41
  end
42
42
 
43
43
  it 'aliases #<< to #push and returns self to allow for chaining' do
@@ -45,9 +45,9 @@ describe Blather::Roster do
45
45
  item = Blather::RosterItem.new(Blather::JID.new(jid))
46
46
  jid2 = 'd@e/f'
47
47
  item2 = Blather::RosterItem.new(Blather::JID.new(jid2))
48
- proc { @roster << item << item2 }.must_change('@roster.items.length', :by => 2)
49
- @roster[jid].wont_be_nil
50
- @roster[jid2].wont_be_nil
48
+ proc { @roster << item << item2 }.should change(@roster, :length).by 2
49
+ @roster[jid].should_not be_nil
50
+ @roster[jid2].should_not be_nil
51
51
  end
52
52
 
53
53
  it 'sends a @roster addition over the wire' do
@@ -57,7 +57,7 @@ describe Blather::Roster do
57
57
  end
58
58
 
59
59
  it 'removes a Blather::JID' do
60
- proc { @roster.delete 'n@d' }.must_change('@roster.items.length', :by => -1)
60
+ proc { @roster.delete 'n@d' }.should change(@roster, :length).by -1
61
61
  end
62
62
 
63
63
  it 'sends a @roster removal over the wire' do
@@ -68,26 +68,26 @@ describe Blather::Roster do
68
68
 
69
69
  it 'returns an item through []' do
70
70
  item = @roster['n@d']
71
- item.must_be_kind_of Blather::RosterItem
72
- item.jid.must_equal Blather::JID.new('n@d')
71
+ item.should be_kind_of Blather::RosterItem
72
+ item.jid.should == Blather::JID.new('n@d')
73
73
  end
74
74
 
75
75
  it 'responds to #each' do
76
- @roster.must_respond_to :each
76
+ @roster.should respond_to :each
77
77
  end
78
78
 
79
79
  it 'cycles through all the items using #each' do
80
- @roster.map { |i| i }.sort.must_equal(@roster.items.values.sort)
80
+ @roster.map { |i| i }.sort.should ==(@roster.items.values.sort)
81
81
  end
82
82
 
83
83
  it 'yields RosterItems from #each' do
84
- @roster.map { |i| i.must_be_kind_of Blather::RosterItem }
84
+ @roster.map { |i| i.should be_kind_of Blather::RosterItem }
85
85
  end
86
86
 
87
87
  it 'returns a duplicate of items through #items' do
88
88
  items = @roster.items
89
89
  items.delete 'n@d'
90
- items.wont_equal @roster.items
90
+ items.should_not equal @roster.items
91
91
  end
92
92
 
93
93
  it 'will group roster items' do
@@ -98,7 +98,7 @@ describe Blather::Roster do
98
98
  item2.groups = ['group1', 'group3']
99
99
  @roster << item1 << item2
100
100
 
101
- @roster.grouped.must_equal({
101
+ @roster.grouped.should ==({
102
102
  'group1' => [item1, item2],
103
103
  'group2' => [item1],
104
104
  'group3' => [item2]
@@ -21,61 +21,60 @@ end
21
21
 
22
22
  describe Blather::Stanza::Iq::DiscoInfo do
23
23
  it 'registers itself' do
24
- Blather::XMPPNode.class_from_registration(:query, 'http://jabber.org/protocol/disco#info').must_equal Blather::Stanza::Iq::DiscoInfo
24
+ Blather::XMPPNode.class_from_registration(:query, 'http://jabber.org/protocol/disco#info').should == Blather::Stanza::Iq::DiscoInfo
25
25
  end
26
26
 
27
27
  it 'must be importable' do
28
- doc = parse_stanza disco_info_xml
29
- Blather::XMPPNode.import(doc.root).must_be_instance_of Blather::Stanza::Iq::DiscoInfo
28
+ Blather::XMPPNode.parse(disco_info_xml).should be_instance_of Blather::Stanza::Iq::DiscoInfo
30
29
  end
31
30
 
32
31
  it 'has a node attribute' do
33
32
  n = Blather::Stanza::Iq::DiscoInfo.new nil, 'music', [], []
34
- n.node.must_equal 'music'
33
+ n.node.should == 'music'
35
34
  n.node = :foo
36
- n.node.must_equal 'foo'
35
+ n.node.should == 'foo'
37
36
  end
38
37
 
39
38
  it 'inherits a list of identities' do
40
39
  n = parse_stanza disco_info_xml
41
40
  r = Blather::Stanza::Iq::DiscoInfo.new.inherit n.root
42
- r.identities.size.must_equal 1
43
- r.identities.map { |i| i.class }.uniq.must_equal [Blather::Stanza::Iq::DiscoInfo::Identity]
41
+ r.identities.size.should == 1
42
+ r.identities.map { |i| i.class }.uniq.should == [Blather::Stanza::Iq::DiscoInfo::Identity]
44
43
  end
45
44
 
46
45
  it 'inherits a list of features' do
47
46
  n = parse_stanza disco_info_xml
48
47
  r = Blather::Stanza::Iq::DiscoInfo.new.inherit n.root
49
- r.features.size.must_equal 2
50
- r.features.map { |i| i.class }.uniq.must_equal [Blather::Stanza::Iq::DiscoInfo::Feature]
48
+ r.features.size.should == 2
49
+ r.features.map { |i| i.class }.uniq.should == [Blather::Stanza::Iq::DiscoInfo::Feature]
51
50
  end
52
51
 
53
52
  it 'is constructed properly' do
54
53
  n = Blather::Stanza::Iq::DiscoInfo.new :get, '/path/to/node'
55
54
  n.to = 'to@jid.com'
56
- n.find("/iq[@to='to@jid.com' and @type='get' and @id='#{n.id}']/ns:query[@node='/path/to/node']", :ns => Blather::Stanza::Iq::DiscoInfo.registered_ns).wont_be_empty
55
+ n.find("/iq[@to='to@jid.com' and @type='get' and @id='#{n.id}']/ns:query[@node='/path/to/node']", :ns => Blather::Stanza::Iq::DiscoInfo.registered_ns).should_not be_empty
57
56
  end
58
57
 
59
58
  it 'allows adding of identities' do
60
59
  di = Blather::Stanza::Iq::DiscoInfo.new
61
- di.identities.size.must_equal 0
60
+ di.identities.size.should == 0
62
61
  di.identities = [{:name => 'name', :type => 'type', :category => 'category'}]
63
- di.identities.size.must_equal 1
62
+ di.identities.size.should == 1
64
63
  di.identities += [Blather::Stanza::Iq::DiscoInfo::Identity.new(*%w[name type category])]
65
- di.identities.size.must_equal 2
64
+ di.identities.size.should == 2
66
65
  di.identities = nil
67
- di.identities.size.must_equal 0
66
+ di.identities.size.should == 0
68
67
  end
69
68
 
70
69
  it 'allows adding of features' do
71
70
  di = Blather::Stanza::Iq::DiscoInfo.new
72
- di.features.size.must_equal 0
71
+ di.features.size.should == 0
73
72
  di.features = ["feature1"]
74
- di.features.size.must_equal 1
73
+ di.features.size.should == 1
75
74
  di.features += [Blather::Stanza::Iq::DiscoInfo::Feature.new("feature2")]
76
- di.features.size.must_equal 2
75
+ di.features.size.should == 2
77
76
  di.features = nil
78
- di.features.size.must_equal 0
77
+ di.features.size.should == 0
79
78
  end
80
79
 
81
80
  end
@@ -91,8 +90,8 @@ describe 'Blather::Stanza::Iq::DiscoInfo identities' do
91
90
  Blather::Stanza::Iq::DiscoInfo::Identity.new(*%w[name1 type1 category1])]
92
91
 
93
92
  di = Blather::Stanza::Iq::DiscoInfo.new nil, nil, ids
94
- di.identities.size.must_equal 2
95
- di.identities.each { |i| control.include?(i).must_equal true }
93
+ di.identities.size.should == 2
94
+ di.identities.each { |i| control.include?(i).should == true }
96
95
  end
97
96
 
98
97
  it 'takes a list of Identity objects as identities' do
@@ -100,24 +99,24 @@ describe 'Blather::Stanza::Iq::DiscoInfo identities' do
100
99
  Blather::Stanza::Iq::DiscoInfo::Identity.new(*%w[name1 type1 category1])]
101
100
 
102
101
  di = Blather::Stanza::Iq::DiscoInfo.new nil, nil, control
103
- di.identities.size.must_equal 2
104
- di.identities.each { |i| control.include?(i).must_equal true }
102
+ di.identities.size.should == 2
103
+ di.identities.each { |i| control.include?(i).should == true }
105
104
  end
106
105
 
107
106
  it 'takes a single hash as identity' do
108
107
  control = [Blather::Stanza::Iq::DiscoInfo::Identity.new(*%w[name type category])]
109
108
 
110
109
  di = Blather::Stanza::Iq::DiscoInfo.new nil, nil, {:name => 'name', :type => 'type', :category => 'category'}
111
- di.identities.size.must_equal 1
112
- di.identities.each { |i| control.include?(i).must_equal true }
110
+ di.identities.size.should == 1
111
+ di.identities.each { |i| control.include?(i).should == true }
113
112
  end
114
113
 
115
114
  it 'takes a single identity object as identity' do
116
115
  control = [Blather::Stanza::Iq::DiscoInfo::Identity.new(*%w[name type category])]
117
116
 
118
117
  di = Blather::Stanza::Iq::DiscoInfo.new nil, nil, control.first
119
- di.identities.size.must_equal 1
120
- di.identities.each { |i| control.include?(i).must_equal true }
118
+ di.identities.size.should == 1
119
+ di.identities.each { |i| control.include?(i).should == true }
121
120
  end
122
121
 
123
122
  it 'takes a mix of hashes and identity objects as identities' do
@@ -130,8 +129,8 @@ describe 'Blather::Stanza::Iq::DiscoInfo identities' do
130
129
  Blather::Stanza::Iq::DiscoInfo::Identity.new(*%w[name1 type1 category1])]
131
130
 
132
131
  di = Blather::Stanza::Iq::DiscoInfo.new nil, nil, ids
133
- di.identities.size.must_equal 2
134
- di.identities.each { |i| control.include?(i).must_equal true }
132
+ di.identities.size.should == 2
133
+ di.identities.each { |i| control.include?(i).should == true }
135
134
  end
136
135
  end
137
136
 
@@ -141,8 +140,8 @@ describe 'Blather::Stanza::Iq::DiscoInfo features' do
141
140
  control = features.map { |f| Blather::Stanza::Iq::DiscoInfo::Feature.new f }
142
141
 
143
142
  di = Blather::Stanza::Iq::DiscoInfo.new nil, nil, [], features
144
- di.features.size.must_equal 3
145
- di.features.each { |f| control.include?(f).must_equal true }
143
+ di.features.size.should == 3
144
+ di.features.each { |f| control.include?(f).should == true }
146
145
  end
147
146
 
148
147
  it 'takes a list of features as Feature objects' do
@@ -150,24 +149,24 @@ describe 'Blather::Stanza::Iq::DiscoInfo features' do
150
149
  control = features.map { |f| Blather::Stanza::Iq::DiscoInfo::Feature.new f }
151
150
 
152
151
  di = Blather::Stanza::Iq::DiscoInfo.new nil, nil, [], control
153
- di.features.size.must_equal 3
154
- di.features.each { |f| control.include?(f).must_equal true }
152
+ di.features.size.should == 3
153
+ di.features.each { |f| control.include?(f).should == true }
155
154
  end
156
155
 
157
156
  it 'takes a single string' do
158
157
  control = [Blather::Stanza::Iq::DiscoInfo::Feature.new('feature1')]
159
158
 
160
159
  di = Blather::Stanza::Iq::DiscoInfo.new nil, nil, [], 'feature1'
161
- di.features.size.must_equal 1
162
- di.features.each { |f| control.include?(f).must_equal true }
160
+ di.features.size.should == 1
161
+ di.features.each { |f| control.include?(f).should == true }
163
162
  end
164
163
 
165
164
  it 'takes a single Feature object' do
166
165
  control = [Blather::Stanza::Iq::DiscoInfo::Feature.new('feature1')]
167
166
 
168
167
  di = Blather::Stanza::Iq::DiscoInfo.new nil, nil, [], control.first
169
- di.features.size.must_equal 1
170
- di.features.each { |f| control.include?(f).must_equal true }
168
+ di.features.size.should == 1
169
+ di.features.each { |f| control.include?(f).should == true }
171
170
  end
172
171
 
173
172
  it 'takes a mixed list of features as Feature objects and strings' do
@@ -176,8 +175,8 @@ describe 'Blather::Stanza::Iq::DiscoInfo features' do
176
175
  features[1] = control[1]
177
176
 
178
177
  di = Blather::Stanza::Iq::DiscoInfo.new nil, nil, [], features
179
- di.features.size.must_equal 3
180
- di.features.each { |f| control.include?(f).must_equal true }
178
+ di.features.size.should == 3
179
+ di.features.each { |f| control.include?(f).should == true }
181
180
  end
182
181
  end
183
182
 
@@ -185,44 +184,44 @@ describe Blather::Stanza::Iq::DiscoInfo::Identity do
185
184
  it 'will auto-inherit nodes' do
186
185
  n = parse_stanza "<identity name='Personal Events' type='pep' category='pubsub' node='publish' xml:lang='en' />"
187
186
  i = Blather::Stanza::Iq::DiscoInfo::Identity.new n.root
188
- i.name.must_equal 'Personal Events'
189
- i.type.must_equal :pep
190
- i.category.must_equal :pubsub
191
- i.xml_lang.must_equal 'en'
187
+ i.name.should == 'Personal Events'
188
+ i.type.should == :pep
189
+ i.category.should == :pubsub
190
+ i.xml_lang.should == 'en'
192
191
  end
193
192
 
194
193
  it 'has a category attribute' do
195
194
  n = Blather::Stanza::Iq::DiscoInfo::Identity.new(*%w[name type cat])
196
- n.category.must_equal :cat
195
+ n.category.should == :cat
197
196
  n.category = :foo
198
- n.category.must_equal :foo
197
+ n.category.should == :foo
199
198
  end
200
199
 
201
200
  it 'has a type attribute' do
202
201
  n = Blather::Stanza::Iq::DiscoInfo::Identity.new(*%w[name type cat])
203
- n.type.must_equal :type
202
+ n.type.should == :type
204
203
  n.type = :foo
205
- n.type.must_equal :foo
204
+ n.type.should == :foo
206
205
  end
207
206
 
208
207
  it 'has a name attribute' do
209
208
  n = Blather::Stanza::Iq::DiscoInfo::Identity.new(*%w[name type cat])
210
- n.name.must_equal 'name'
209
+ n.name.should == 'name'
211
210
  n.name = :foo
212
- n.name.must_equal 'foo'
211
+ n.name.should == 'foo'
213
212
  end
214
213
 
215
214
  it 'has an xml:lang attribute' do
216
215
  n = Blather::Stanza::Iq::DiscoInfo::Identity.new(*%w[name type cat en])
217
- n.xml_lang.must_equal 'en'
216
+ n.xml_lang.should == 'en'
218
217
  n.xml_lang = 'de'
219
- n.xml_lang.must_equal 'de'
218
+ n.xml_lang.should == 'de'
220
219
  end
221
220
 
222
221
  it 'can determine equality' do
223
222
  a = Blather::Stanza::Iq::DiscoInfo::Identity.new(*%w[name type cat])
224
- a.must_equal Blather::Stanza::Iq::DiscoInfo::Identity.new(*%w[name type cat])
225
- a.wont_equal Blather::Stanza::Iq::DiscoInfo::Identity.new(*%w[not-name not-type not-cat])
223
+ a.should == Blather::Stanza::Iq::DiscoInfo::Identity.new(*%w[name type cat])
224
+ a.should_not equal Blather::Stanza::Iq::DiscoInfo::Identity.new(*%w[not-name not-type not-cat])
226
225
  end
227
226
  end
228
227
 
@@ -230,19 +229,19 @@ describe Blather::Stanza::Iq::DiscoInfo::Feature do
230
229
  it 'will auto-inherit nodes' do
231
230
  n = parse_stanza "<feature var='ipv6' />"
232
231
  i = Blather::Stanza::Iq::DiscoInfo::Feature.new n.root
233
- i.var.must_equal 'ipv6'
232
+ i.var.should == 'ipv6'
234
233
  end
235
234
 
236
235
  it 'has a var attribute' do
237
236
  n = Blather::Stanza::Iq::DiscoInfo::Feature.new 'var'
238
- n.var.must_equal 'var'
237
+ n.var.should == 'var'
239
238
  n.var = :foo
240
- n.var.must_equal 'foo'
239
+ n.var.should == 'foo'
241
240
  end
242
241
 
243
242
  it 'can determine equality' do
244
243
  a = Blather::Stanza::Iq::DiscoInfo::Feature.new('var')
245
- a.must_equal Blather::Stanza::Iq::DiscoInfo::Feature.new('var')
246
- a.wont_equal Blather::Stanza::Iq::DiscoInfo::Feature.new('not-var')
244
+ a.should == Blather::Stanza::Iq::DiscoInfo::Feature.new('var')
245
+ a.should_not equal Blather::Stanza::Iq::DiscoInfo::Feature.new('not-var')
247
246
  end
248
247
  end