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
@@ -3,72 +3,72 @@ require 'fixtures/pubsub'
3
3
 
4
4
  describe Blather::Stanza::PubSub::Unsubscribe do
5
5
  it 'registers itself' do
6
- Blather::XMPPNode.class_from_registration(:unsubscribe, 'http://jabber.org/protocol/pubsub').must_equal Blather::Stanza::PubSub::Unsubscribe
6
+ Blather::XMPPNode.class_from_registration(:unsubscribe, 'http://jabber.org/protocol/pubsub').should == Blather::Stanza::PubSub::Unsubscribe
7
7
  end
8
8
 
9
9
  it 'can be imported' do
10
- Blather::XMPPNode.import(parse_stanza(unsubscribe_xml).root).must_be_instance_of Blather::Stanza::PubSub::Unsubscribe
10
+ Blather::XMPPNode.parse(unsubscribe_xml).should be_instance_of Blather::Stanza::PubSub::Unsubscribe
11
11
  end
12
12
 
13
13
  it 'ensures an unsubscribe node is present on create' do
14
14
  unsubscribe = Blather::Stanza::PubSub::Unsubscribe.new :set, 'host', 'node', 'jid'
15
- unsubscribe.find('//ns:pubsub/ns:unsubscribe', :ns => Blather::Stanza::PubSub.registered_ns).wont_be_empty
15
+ unsubscribe.find('//ns:pubsub/ns:unsubscribe', :ns => Blather::Stanza::PubSub.registered_ns).should_not be_empty
16
16
  end
17
17
 
18
18
  it 'ensures an unsubscribe node exists when calling #unsubscribe' do
19
19
  unsubscribe = Blather::Stanza::PubSub::Unsubscribe.new :set, 'host', 'node', 'jid'
20
20
  unsubscribe.pubsub.remove_children :unsubscribe
21
- unsubscribe.find('//ns:pubsub/ns:unsubscribe', :ns => Blather::Stanza::PubSub.registered_ns).must_be_empty
21
+ unsubscribe.find('//ns:pubsub/ns:unsubscribe', :ns => Blather::Stanza::PubSub.registered_ns).should be_empty
22
22
 
23
- unsubscribe.unsubscribe.wont_be_nil
24
- unsubscribe.find('//ns:pubsub/ns:unsubscribe', :ns => Blather::Stanza::PubSub.registered_ns).wont_be_empty
23
+ unsubscribe.unsubscribe.should_not be_nil
24
+ unsubscribe.find('//ns:pubsub/ns:unsubscribe', :ns => Blather::Stanza::PubSub.registered_ns).should_not be_empty
25
25
  end
26
26
 
27
27
  it 'defaults to a set node' do
28
28
  unsubscribe = Blather::Stanza::PubSub::Unsubscribe.new :set, 'host', 'node', 'jid'
29
- unsubscribe.type.must_equal :set
29
+ unsubscribe.type.should == :set
30
30
  end
31
31
 
32
32
  it 'sets the host if requested' do
33
33
  unsubscribe = Blather::Stanza::PubSub::Unsubscribe.new :set, 'pubsub.jabber.local', 'node', 'jid'
34
- unsubscribe.to.must_equal Blather::JID.new('pubsub.jabber.local')
34
+ unsubscribe.to.should == Blather::JID.new('pubsub.jabber.local')
35
35
  end
36
36
 
37
37
  it 'sets the node' do
38
38
  unsubscribe = Blather::Stanza::PubSub::Unsubscribe.new :set, 'host', 'node-name', 'jid'
39
- unsubscribe.node.must_equal 'node-name'
39
+ unsubscribe.node.should == 'node-name'
40
40
  end
41
41
 
42
42
  it 'has a node attribute' do
43
43
  unsubscribe = Blather::Stanza::PubSub::Unsubscribe.new :set, 'host', 'node-name', 'jid'
44
- unsubscribe.find('//ns:pubsub/ns:unsubscribe[@node="node-name"]', :ns => Blather::Stanza::PubSub.registered_ns).wont_be_empty
45
- unsubscribe.node.must_equal 'node-name'
44
+ unsubscribe.find('//ns:pubsub/ns:unsubscribe[@node="node-name"]', :ns => Blather::Stanza::PubSub.registered_ns).should_not be_empty
45
+ unsubscribe.node.should == 'node-name'
46
46
 
47
47
  unsubscribe.node = 'new-node'
48
- unsubscribe.find('//ns:pubsub/ns:unsubscribe[@node="new-node"]', :ns => Blather::Stanza::PubSub.registered_ns).wont_be_empty
49
- unsubscribe.node.must_equal 'new-node'
48
+ unsubscribe.find('//ns:pubsub/ns:unsubscribe[@node="new-node"]', :ns => Blather::Stanza::PubSub.registered_ns).should_not be_empty
49
+ unsubscribe.node.should == 'new-node'
50
50
  end
51
51
 
52
52
  it 'has a jid attribute' do
53
53
  unsubscribe = Blather::Stanza::PubSub::Unsubscribe.new :set, 'host', 'node-name', 'jid'
54
- unsubscribe.find('//ns:pubsub/ns:unsubscribe[@jid="jid"]', :ns => Blather::Stanza::PubSub.registered_ns).wont_be_empty
55
- unsubscribe.jid.must_equal Blather::JID.new('jid')
54
+ unsubscribe.find('//ns:pubsub/ns:unsubscribe[@jid="jid"]', :ns => Blather::Stanza::PubSub.registered_ns).should_not be_empty
55
+ unsubscribe.jid.should == Blather::JID.new('jid')
56
56
 
57
57
  unsubscribe.jid = Blather::JID.new('n@d/r')
58
- unsubscribe.find('//ns:pubsub/ns:unsubscribe[@jid="n@d/r"]', :ns => Blather::Stanza::PubSub.registered_ns).wont_be_empty
59
- unsubscribe.jid.must_equal Blather::JID.new('n@d/r')
58
+ unsubscribe.find('//ns:pubsub/ns:unsubscribe[@jid="n@d/r"]', :ns => Blather::Stanza::PubSub.registered_ns).should_not be_empty
59
+ unsubscribe.jid.should == Blather::JID.new('n@d/r')
60
60
  end
61
61
 
62
62
  it 'has a subid attribute' do
63
63
  unsubscribe = Blather::Stanza::PubSub::Unsubscribe.new :set, 'host', 'node-name', 'jid'
64
- unsubscribe.find('//ns:pubsub/ns:unsubscribe[@subid="subid"]', :ns => Blather::Stanza::PubSub.registered_ns).must_be_empty
64
+ unsubscribe.find('//ns:pubsub/ns:unsubscribe[@subid="subid"]', :ns => Blather::Stanza::PubSub.registered_ns).should be_empty
65
65
 
66
66
  unsubscribe = Blather::Stanza::PubSub::Unsubscribe.new :set, 'host', 'node-name', 'jid', 'subid'
67
- unsubscribe.find('//ns:pubsub/ns:unsubscribe[@subid="subid"]', :ns => Blather::Stanza::PubSub.registered_ns).wont_be_empty
68
- unsubscribe.subid.must_equal 'subid'
67
+ unsubscribe.find('//ns:pubsub/ns:unsubscribe[@subid="subid"]', :ns => Blather::Stanza::PubSub.registered_ns).should_not be_empty
68
+ unsubscribe.subid.should == 'subid'
69
69
 
70
70
  unsubscribe.subid = 'newsubid'
71
- unsubscribe.find('//ns:pubsub/ns:unsubscribe[@subid="newsubid"]', :ns => Blather::Stanza::PubSub.registered_ns).wont_be_empty
72
- unsubscribe.subid.must_equal 'newsubid'
71
+ unsubscribe.find('//ns:pubsub/ns:unsubscribe[@subid="newsubid"]', :ns => Blather::Stanza::PubSub.registered_ns).should_not be_empty
72
+ unsubscribe.subid.should == 'newsubid'
73
73
  end
74
74
  end
@@ -3,11 +3,11 @@ require 'fixtures/pubsub'
3
3
 
4
4
  describe Blather::Stanza::PubSubOwner::Delete do
5
5
  it 'registers itself' do
6
- Blather::XMPPNode.class_from_registration(:delete, 'http://jabber.org/protocol/pubsub#owner').must_equal Blather::Stanza::PubSubOwner::Delete
6
+ Blather::XMPPNode.class_from_registration(:delete, 'http://jabber.org/protocol/pubsub#owner').should == Blather::Stanza::PubSubOwner::Delete
7
7
  end
8
8
 
9
9
  it 'can be imported' do
10
- Blather::XMPPNode.import(parse_stanza(<<-NODE).root).must_be_instance_of Blather::Stanza::PubSubOwner::Delete
10
+ Blather::XMPPNode.parse(<<-NODE).should be_instance_of Blather::Stanza::PubSubOwner::Delete
11
11
  <iq type='set'
12
12
  from='hamlet@denmark.lit/elsinore'
13
13
  to='pubsub.shakespeare.lit'
@@ -21,30 +21,30 @@ describe Blather::Stanza::PubSubOwner::Delete do
21
21
 
22
22
  it 'ensures an delete node is present on delete' do
23
23
  delete = Blather::Stanza::PubSubOwner::Delete.new
24
- delete.find('//ns:pubsub/ns:delete', :ns => Blather::Stanza::PubSubOwner.registered_ns).wont_be_empty
24
+ delete.find('//ns:pubsub/ns:delete', :ns => Blather::Stanza::PubSubOwner.registered_ns).should_not be_empty
25
25
  end
26
26
 
27
27
  it 'ensures an delete node exists when calling #delete_node' do
28
28
  delete = Blather::Stanza::PubSubOwner::Delete.new
29
29
  delete.pubsub.remove_children :delete
30
- delete.find('//ns:pubsub/ns:delete', :ns => Blather::Stanza::PubSubOwner.registered_ns).must_be_empty
30
+ delete.find('//ns:pubsub/ns:delete', :ns => Blather::Stanza::PubSubOwner.registered_ns).should be_empty
31
31
 
32
- delete.delete_node.wont_be_nil
33
- delete.find('//ns:pubsub/ns:delete', :ns => Blather::Stanza::PubSubOwner.registered_ns).wont_be_empty
32
+ delete.delete_node.should_not be_nil
33
+ delete.find('//ns:pubsub/ns:delete', :ns => Blather::Stanza::PubSubOwner.registered_ns).should_not be_empty
34
34
  end
35
35
 
36
36
  it 'defaults to a set node' do
37
37
  delete = Blather::Stanza::PubSubOwner::Delete.new
38
- delete.type.must_equal :set
38
+ delete.type.should == :set
39
39
  end
40
40
 
41
41
  it 'sets the host if requested' do
42
42
  delete = Blather::Stanza::PubSubOwner::Delete.new :set, 'pubsub.jabber.local'
43
- delete.to.must_equal Blather::JID.new('pubsub.jabber.local')
43
+ delete.to.should == Blather::JID.new('pubsub.jabber.local')
44
44
  end
45
45
 
46
46
  it 'sets the node' do
47
47
  delete = Blather::Stanza::PubSubOwner::Delete.new :set, 'host', 'node-name'
48
- delete.node.must_equal 'node-name'
48
+ delete.node.should == 'node-name'
49
49
  end
50
50
  end
@@ -3,11 +3,11 @@ require 'fixtures/pubsub'
3
3
 
4
4
  describe Blather::Stanza::PubSubOwner::Purge do
5
5
  it 'registers itself' do
6
- Blather::XMPPNode.class_from_registration(:purge, 'http://jabber.org/protocol/pubsub#owner').must_equal Blather::Stanza::PubSubOwner::Purge
6
+ Blather::XMPPNode.class_from_registration(:purge, 'http://jabber.org/protocol/pubsub#owner').should == Blather::Stanza::PubSubOwner::Purge
7
7
  end
8
8
 
9
9
  it 'can be imported' do
10
- Blather::XMPPNode.import(parse_stanza(<<-NODE).root).must_be_instance_of Blather::Stanza::PubSubOwner::Purge
10
+ Blather::XMPPNode.parse(<<-NODE).should be_instance_of Blather::Stanza::PubSubOwner::Purge
11
11
  <iq type='set'
12
12
  from='hamlet@denmark.lit/elsinore'
13
13
  to='pubsub.shakespeare.lit'
@@ -21,30 +21,30 @@ describe Blather::Stanza::PubSubOwner::Purge do
21
21
 
22
22
  it 'ensures an purge node is present on create' do
23
23
  purge = Blather::Stanza::PubSubOwner::Purge.new
24
- purge.find('//ns:pubsub/ns:purge', :ns => Blather::Stanza::PubSubOwner.registered_ns).wont_be_empty
24
+ purge.find('//ns:pubsub/ns:purge', :ns => Blather::Stanza::PubSubOwner.registered_ns).should_not be_empty
25
25
  end
26
26
 
27
27
  it 'ensures an purge node exists when calling #purge_node' do
28
28
  purge = Blather::Stanza::PubSubOwner::Purge.new
29
29
  purge.pubsub.remove_children :purge
30
- purge.find('//ns:pubsub/ns:purge', :ns => Blather::Stanza::PubSubOwner.registered_ns).must_be_empty
30
+ purge.find('//ns:pubsub/ns:purge', :ns => Blather::Stanza::PubSubOwner.registered_ns).should be_empty
31
31
 
32
- purge.purge_node.wont_be_nil
33
- purge.find('//ns:pubsub/ns:purge', :ns => Blather::Stanza::PubSubOwner.registered_ns).wont_be_empty
32
+ purge.purge_node.should_not be_nil
33
+ purge.find('//ns:pubsub/ns:purge', :ns => Blather::Stanza::PubSubOwner.registered_ns).should_not be_empty
34
34
  end
35
35
 
36
36
  it 'defaults to a set node' do
37
37
  purge = Blather::Stanza::PubSubOwner::Purge.new
38
- purge.type.must_equal :set
38
+ purge.type.should == :set
39
39
  end
40
40
 
41
41
  it 'sets the host if requested' do
42
42
  purge = Blather::Stanza::PubSubOwner::Purge.new :set, 'pubsub.jabber.local'
43
- purge.to.must_equal Blather::JID.new('pubsub.jabber.local')
43
+ purge.to.should == Blather::JID.new('pubsub.jabber.local')
44
44
  end
45
45
 
46
46
  it 'sets the node' do
47
47
  purge = Blather::Stanza::PubSubOwner::Purge.new :set, 'host', 'node-name'
48
- purge.node.must_equal 'node-name'
48
+ purge.node.should == 'node-name'
49
49
  end
50
50
  end
@@ -3,25 +3,25 @@ require 'fixtures/pubsub'
3
3
 
4
4
  describe Blather::Stanza::PubSubOwner do
5
5
  it 'registers itself' do
6
- Blather::XMPPNode.class_from_registration(:pubsub, 'http://jabber.org/protocol/pubsub#owner').must_equal Blather::Stanza::PubSubOwner
6
+ Blather::XMPPNode.class_from_registration(:pubsub, 'http://jabber.org/protocol/pubsub#owner').should == Blather::Stanza::PubSubOwner
7
7
  end
8
8
 
9
9
  it 'ensures a pubusb node is present on create' do
10
10
  pubsub = Blather::Stanza::PubSubOwner.new
11
- pubsub.find_first('/iq/ns:pubsub', :ns => Blather::Stanza::PubSubOwner.registered_ns).wont_be_nil
11
+ pubsub.find_first('/iq/ns:pubsub', :ns => Blather::Stanza::PubSubOwner.registered_ns).should_not be_nil
12
12
  end
13
13
 
14
14
  it 'ensures a pubsub node exists when calling #pubsub' do
15
15
  pubsub = Blather::Stanza::PubSubOwner.new
16
16
  pubsub.remove_children :pubsub
17
- pubsub.find_first('/iq/ns:pubsub', :ns => Blather::Stanza::PubSubOwner.registered_ns).must_be_nil
17
+ pubsub.find_first('/iq/ns:pubsub', :ns => Blather::Stanza::PubSubOwner.registered_ns).should be_nil
18
18
 
19
- pubsub.pubsub.wont_be_nil
20
- pubsub.find_first('/iq/ns:pubsub', :ns => Blather::Stanza::PubSubOwner.registered_ns).wont_be_nil
19
+ pubsub.pubsub.should_not be_nil
20
+ pubsub.find_first('/iq/ns:pubsub', :ns => Blather::Stanza::PubSubOwner.registered_ns).should_not be_nil
21
21
  end
22
22
 
23
23
  it 'sets the host if requested' do
24
24
  aff = Blather::Stanza::PubSubOwner.new :get, 'pubsub.jabber.local'
25
- aff.to.must_equal Blather::JID.new('pubsub.jabber.local')
25
+ aff.to.should == Blather::JID.new('pubsub.jabber.local')
26
26
  end
27
27
  end
@@ -3,31 +3,31 @@ require 'fixtures/pubsub'
3
3
 
4
4
  describe Blather::Stanza::PubSub do
5
5
  it 'registers itself' do
6
- Blather::XMPPNode.class_from_registration(:pubsub, 'http://jabber.org/protocol/pubsub').must_equal Blather::Stanza::PubSub
6
+ Blather::XMPPNode.class_from_registration(:pubsub, 'http://jabber.org/protocol/pubsub').should == Blather::Stanza::PubSub
7
7
  end
8
8
 
9
9
  it 'ensures a pubusb node is present on create' do
10
10
  pubsub = Blather::Stanza::PubSub.new
11
- pubsub.find_first('/iq/ns:pubsub', :ns => Blather::Stanza::PubSub.registered_ns).wont_be_nil
11
+ pubsub.find_first('/iq/ns:pubsub', :ns => Blather::Stanza::PubSub.registered_ns).should_not be_nil
12
12
  end
13
13
 
14
14
  it 'ensures a pubsub node exists when calling #pubsub' do
15
15
  pubsub = Blather::Stanza::PubSub.new
16
16
  pubsub.remove_children :pubsub
17
- pubsub.find_first('/iq/ns:pubsub', :ns => Blather::Stanza::PubSub.registered_ns).must_be_nil
17
+ pubsub.find_first('/iq/ns:pubsub', :ns => Blather::Stanza::PubSub.registered_ns).should be_nil
18
18
 
19
- pubsub.pubsub.wont_be_nil
20
- pubsub.find_first('/iq/ns:pubsub', :ns => Blather::Stanza::PubSub.registered_ns).wont_be_nil
19
+ pubsub.pubsub.should_not be_nil
20
+ pubsub.find_first('/iq/ns:pubsub', :ns => Blather::Stanza::PubSub.registered_ns).should_not be_nil
21
21
  end
22
22
 
23
23
  it 'sets the host if requested' do
24
24
  aff = Blather::Stanza::PubSub.new :get, 'pubsub.jabber.local'
25
- aff.to.must_equal Blather::JID.new('pubsub.jabber.local')
25
+ aff.to.should == Blather::JID.new('pubsub.jabber.local')
26
26
  end
27
27
 
28
28
  it 'ensures newly inherited items are PubSubItem objects' do
29
- pubsub = Blather::XMPPNode.import(parse_stanza(items_all_nodes_xml).root)
30
- pubsub.items.map { |i| i.class }.uniq.must_equal [Blather::Stanza::PubSub::PubSubItem]
29
+ pubsub = Blather::XMPPNode.parse(items_all_nodes_xml)
30
+ pubsub.items.map { |i| i.class }.uniq.should == [Blather::Stanza::PubSub::PubSubItem]
31
31
  end
32
32
  end
33
33
 
@@ -35,34 +35,34 @@ describe Blather::Stanza::PubSub::PubSubItem do
35
35
  it 'can be initialized with just an ID' do
36
36
  id = 'foobarbaz'
37
37
  item = Blather::Stanza::PubSub::Items::PubSubItem.new id
38
- item.id.must_equal id
38
+ item.id.should == id
39
39
  end
40
40
 
41
41
  it 'can be initialized with a payload' do
42
42
  payload = 'foobarbaz'
43
43
  item = Blather::Stanza::PubSub::Items::PubSubItem.new 'foo', payload
44
- item.payload.must_equal payload
44
+ item.payload.should == payload
45
45
  end
46
46
 
47
47
  it 'allows the payload to be set' do
48
48
  item = Blather::Stanza::PubSub::Items::PubSubItem.new
49
- item.payload.must_be_nil
49
+ item.payload.should be_nil
50
50
  item.payload = 'testing'
51
- item.payload.must_equal 'testing'
52
- item.content.must_equal 'testing'
51
+ item.payload.should == 'testing'
52
+ item.content.should == 'testing'
53
53
  end
54
54
 
55
55
  it 'allows the payload to be unset' do
56
56
  payload = 'foobarbaz'
57
57
  item = Blather::Stanza::PubSub::Items::PubSubItem.new 'foo', payload
58
- item.payload.must_equal payload
58
+ item.payload.should == payload
59
59
  item.payload = nil
60
- item.payload.must_be_nil
60
+ item.payload.should be_nil
61
61
  end
62
62
 
63
63
  it 'makes payloads readable as string' do
64
64
  payload = Blather::XMPPNode.new 'foo'
65
65
  item = Blather::Stanza::PubSub::Items::PubSubItem.new 'bar', payload
66
- item.payload.must_equal payload.to_s
66
+ item.payload.should == payload.to_s
67
67
  end
68
68
  end
@@ -32,60 +32,60 @@ describe Blather::Stanza::X do
32
32
 
33
33
  it 'can be created from an XML string' do
34
34
  x = Blather::Stanza::X.new parse_stanza(x_xml).root
35
- x.type.must_equal :form
36
- x.must_be_instance_of Blather::Stanza::X
35
+ x.type.should == :form
36
+ x.should be_instance_of Blather::Stanza::X
37
37
  end
38
38
 
39
39
  [:cancel, :form, :result, :submit].each do |type|
40
40
  it "type can be set as \"#{type}\"" do
41
41
  x = Blather::Stanza::X.new type
42
- x.type.must_equal type
42
+ x.type.should == type
43
43
  end
44
44
  end
45
45
 
46
46
  it 'is constructed properly' do
47
47
  n = Blather::Stanza::X.new :form
48
- n.find("/ns:x[@type='form']", :ns => Blather::Stanza::X.registered_ns).wont_be_empty
48
+ n.find("/ns:x[@type='form']", :ns => Blather::Stanza::X.registered_ns).should_not be_empty
49
49
  end
50
50
 
51
51
  it 'has an action attribute' do
52
52
  n = Blather::Stanza::X.new :form
53
- n.type.must_equal :form
53
+ n.type.should == :form
54
54
  n.type = :submit
55
- n.type.must_equal :submit
55
+ n.type.should == :submit
56
56
  end
57
57
 
58
58
  it 'has a title attribute' do
59
59
  n = Blather::Stanza::X.new :form
60
- n.title.must_equal nil
60
+ n.title.should == nil
61
61
  n.title = "Hello World!"
62
- n.title.must_equal "Hello World!"
62
+ n.title.should == "Hello World!"
63
63
  n.title = "goodbye"
64
- n.title.must_equal "goodbye"
64
+ n.title.should == "goodbye"
65
65
  end
66
66
 
67
67
  it 'has an instructions attribute' do
68
68
  n = Blather::Stanza::X.new :form
69
- n.instructions.must_equal nil
69
+ n.instructions.should == nil
70
70
  n.instructions = "Please fill in this form"
71
- n.instructions.must_equal "Please fill in this form"
71
+ n.instructions.should == "Please fill in this form"
72
72
  n.instructions = "goodbye"
73
- n.instructions.must_equal "goodbye"
73
+ n.instructions.should == "goodbye"
74
74
  end
75
75
 
76
76
  it 'inherits a list of fields' do
77
77
  n = Blather::Stanza::Iq::Command.new
78
78
  n.command << parse_stanza(x_xml).root
79
79
  r = Blather::Stanza::X.new.inherit n.form
80
- r.fields.size.must_equal 4
81
- r.fields.map { |f| f.class }.uniq.must_equal [Blather::Stanza::X::Field]
80
+ r.fields.size.should == 4
81
+ r.fields.map { |f| f.class }.uniq.should == [Blather::Stanza::X::Field]
82
82
  end
83
83
 
84
84
  it 'returns a field object for a particular var' do
85
85
  x = Blather::Stanza::X.new parse_stanza(x_xml).root
86
86
  f = x.field 'field-name4'
87
- f.must_be_instance_of Blather::Stanza::X::Field
88
- f.value.must_equal 'field-value4'
87
+ f.should be_instance_of Blather::Stanza::X::Field
88
+ f.value.should == 'field-value4'
89
89
  end
90
90
 
91
91
  it 'takes a list of hashes for fields' do
@@ -98,8 +98,8 @@ describe Blather::Stanza::X do
98
98
  Blather::Stanza::X::Field.new(*%w[var1 text-single label1])]
99
99
 
100
100
  di = Blather::Stanza::X.new nil, fields
101
- di.fields.size.must_equal 2
102
- di.fields.each { |f| control.include?(f).must_equal true }
101
+ di.fields.size.should == 2
102
+ di.fields.each { |f| control.include?(f).should == true }
103
103
  end
104
104
 
105
105
  it 'takes a list of Field objects as fields' do
@@ -107,8 +107,8 @@ describe Blather::Stanza::X do
107
107
  Blather::Stanza::X::Field.new(*%w[var1 text-single label1])]
108
108
 
109
109
  di = Blather::Stanza::X.new nil, control
110
- di.fields.size.must_equal 2
111
- di.fields.each { |f| control.include?(f).must_equal true }
110
+ di.fields.size.should == 2
111
+ di.fields.each { |f| control.include?(f).should == true }
112
112
  end
113
113
 
114
114
  it 'takes a mix of hashes and field objects as fields' do
@@ -121,17 +121,17 @@ describe Blather::Stanza::X do
121
121
  Blather::Stanza::X::Field.new(*%w[var1 text-single label1])]
122
122
 
123
123
  di = Blather::Stanza::X.new nil, fields
124
- di.fields.size.must_equal 2
125
- di.fields.each { |f| control.include?(f).must_equal true }
124
+ di.fields.size.should == 2
125
+ di.fields.each { |f| control.include?(f).should == true }
126
126
  end
127
127
 
128
128
  it 'allows adding of fields' do
129
129
  di = Blather::Stanza::X.new nil
130
- di.fields.size.must_equal 0
130
+ di.fields.size.should == 0
131
131
  di.fields = [{:label => 'label', :type => 'text-single', :var => 'var', :required => true}]
132
- di.fields.size.must_equal 1
132
+ di.fields.size.should == 1
133
133
  di.fields += [Blather::Stanza::X::Field.new(*%w[var1 text-single label1])]
134
- di.fields.size.must_equal 2
134
+ di.fields.size.should == 2
135
135
  end
136
136
 
137
137
  end
@@ -140,73 +140,73 @@ describe Blather::Stanza::X::Field do
140
140
  it 'will auto-inherit nodes' do
141
141
  n = parse_stanza "<field type='text-single' var='music' label='Music from the time of Shakespeare' />"
142
142
  i = Blather::Stanza::X::Field.new n.root
143
- i.type.must_equal 'text-single'
144
- i.var.must_equal 'music'
145
- i.label.must_equal 'Music from the time of Shakespeare'
143
+ i.type.should == 'text-single'
144
+ i.var.should == 'music'
145
+ i.label.should == 'Music from the time of Shakespeare'
146
146
  end
147
147
 
148
148
  it 'has a type attribute' do
149
149
  n = Blather::Stanza::X::Field.new 'var', 'text-single'
150
- n.type.must_equal 'text-single'
150
+ n.type.should == 'text-single'
151
151
  n.type = 'hidden'
152
- n.type.must_equal 'hidden'
152
+ n.type.should == 'hidden'
153
153
  end
154
154
 
155
155
  it 'has a var attribute' do
156
156
  n = Blather::Stanza::X::Field.new 'name', 'text-single'
157
- n.var.must_equal 'name'
157
+ n.var.should == 'name'
158
158
  n.var = 'email'
159
- n.var.must_equal 'email'
159
+ n.var.should == 'email'
160
160
  end
161
161
 
162
162
  it 'has a label attribute' do
163
163
  n = Blather::Stanza::X::Field.new 'subject', 'text-single', 'Music from the time of Shakespeare'
164
- n.label.must_equal 'Music from the time of Shakespeare'
164
+ n.label.should == 'Music from the time of Shakespeare'
165
165
  n.label = 'Books by and about Shakespeare'
166
- n.label.must_equal 'Books by and about Shakespeare'
166
+ n.label.should == 'Books by and about Shakespeare'
167
167
  end
168
168
 
169
169
  it 'has a desc attribute' do
170
170
  n = Blather::Stanza::X::Field.new 'subject', 'text-single', 'Music from the time of Shakespeare'
171
- n.desc.must_equal nil
171
+ n.desc.should == nil
172
172
  n.desc = 'Books by and about Shakespeare'
173
- n.desc.must_equal 'Books by and about Shakespeare'
173
+ n.desc.should == 'Books by and about Shakespeare'
174
174
  n.desc = 'goodbye'
175
- n.desc.must_equal 'goodbye'
175
+ n.desc.should == 'goodbye'
176
176
  end
177
177
 
178
178
  it 'has a required? attribute' do
179
179
  n = Blather::Stanza::X::Field.new 'subject', 'text-single', 'Music from the time of Shakespeare'
180
- n.required?.must_equal false
180
+ n.required?.should == false
181
181
  n.required = true
182
- n.required?.must_equal true
182
+ n.required?.should == true
183
183
  n.required = false
184
- n.required?.must_equal false
184
+ n.required?.should == false
185
185
  end
186
186
 
187
187
  it 'has a value attribute' do
188
188
  n = Blather::Stanza::X::Field.new 'subject', 'text-single', 'Music from the time of Shakespeare'
189
- n.value.must_equal nil
189
+ n.value.should == nil
190
190
  n.value = 'book1'
191
- n.value.must_equal 'book1'
191
+ n.value.should == 'book1'
192
192
  n.value = 'book2'
193
- n.value.must_equal 'book2'
193
+ n.value.should == 'book2'
194
194
  end
195
195
 
196
196
  # Option child elements
197
197
  it 'allows adding of options' do
198
198
  di = Blather::Stanza::X::Field.new nil
199
- di.options.size.must_equal 0
199
+ di.options.size.should == 0
200
200
  di.options += [{:label => 'Person', :value => 'person'}]
201
- di.options.size.must_equal 1
201
+ di.options.size.should == 1
202
202
  di.options += [Blather::Stanza::X::Field::Option.new(*%w[person1 Person1])]
203
- di.options.size.must_equal 2
203
+ di.options.size.should == 2
204
204
  end
205
205
 
206
206
  it 'can determine equality' do
207
207
  a = Blather::Stanza::X::Field.new('subject', 'text-single')
208
- a.must_equal Blather::Stanza::X::Field.new('subject', 'text-single')
209
- a.wont_equal Blather::Stanza::X::Field.new('subject1', 'text-single')
208
+ a.should == Blather::Stanza::X::Field.new('subject', 'text-single')
209
+ a.should_not equal Blather::Stanza::X::Field.new('subject1', 'text-single')
210
210
  end
211
211
  end
212
212
 
@@ -214,17 +214,17 @@ describe Blather::Stanza::X::Field::Option do
214
214
 
215
215
  it 'has a value attribute' do
216
216
  n = Blather::Stanza::X::Field::Option.new 'person1', 'Person 1'
217
- n.value.must_equal 'person1'
217
+ n.value.should == 'person1'
218
218
  n.value = 'book1'
219
- n.value.must_equal 'book1'
219
+ n.value.should == 'book1'
220
220
  end
221
221
 
222
222
  it 'has a label attribute' do
223
223
  n = Blather::Stanza::X::Field::Option.new 'person1', 'Person 1'
224
- n.label.must_equal 'Person 1'
224
+ n.label.should == 'Person 1'
225
225
  n.label = 'Book 1'
226
- n.label.must_equal 'Book 1'
226
+ n.label.should == 'Book 1'
227
227
  n.label = 'Book 2'
228
- n.label.must_equal 'Book 2'
228
+ n.label.should == 'Book 2'
229
229
  end
230
230
  end