jubjub 0.0.7 → 0.0.8

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 (62) hide show
  1. data/README.mdown +27 -1
  2. data/lib/jubjub.rb +1 -1
  3. data/lib/jubjub/connection/xmpp_gateway.rb +9 -9
  4. data/lib/jubjub/connection/xmpp_gateway/helper.rb +5 -5
  5. data/lib/jubjub/connection/xmpp_gateway/muc.rb +127 -32
  6. data/lib/jubjub/connection/xmpp_gateway/pubsub.rb +64 -64
  7. data/lib/jubjub/data_form.rb +16 -13
  8. data/lib/jubjub/errors.rb +2 -2
  9. data/lib/jubjub/helpers.rb +32 -0
  10. data/lib/jubjub/jid.rb +8 -8
  11. data/lib/jubjub/muc.rb +3 -1
  12. data/lib/jubjub/muc/affiliation.rb +77 -0
  13. data/lib/jubjub/muc/affiliations_collection.rb +31 -0
  14. data/lib/jubjub/muc/collection.rb +12 -19
  15. data/lib/jubjub/muc/configuration.rb +2 -2
  16. data/lib/jubjub/muc/muc.rb +24 -11
  17. data/lib/jubjub/pubsub.rb +1 -1
  18. data/lib/jubjub/pubsub/affiliation.rb +20 -20
  19. data/lib/jubjub/pubsub/affiliation_collection.rb +11 -18
  20. data/lib/jubjub/pubsub/collection.rb +14 -21
  21. data/lib/jubjub/pubsub/configuration.rb +2 -2
  22. data/lib/jubjub/pubsub/item.rb +8 -8
  23. data/lib/jubjub/pubsub/item_collection.rb +10 -17
  24. data/lib/jubjub/pubsub/pubsub.rb +17 -17
  25. data/lib/jubjub/pubsub/subscription.rb +6 -6
  26. data/lib/jubjub/response.rb +1 -1
  27. data/lib/jubjub/response/error.rb +6 -6
  28. data/lib/jubjub/response/proxy.rb +8 -8
  29. data/lib/jubjub/response/response.rb +10 -10
  30. data/lib/jubjub/user.rb +16 -15
  31. data/spec/connection/xmpp_gateway_muc_spec.rb +174 -40
  32. data/spec/connection/xmpp_gateway_pubsub_spec.rb +100 -104
  33. data/spec/fixtures/vcr_cassettes/muc_configuration.yml +73 -6
  34. data/spec/fixtures/vcr_cassettes/muc_create_with_configuration.yml +8 -8
  35. data/spec/fixtures/vcr_cassettes/muc_message.yml +89 -0
  36. data/spec/fixtures/vcr_cassettes/muc_modify_affiliations.yml +367 -0
  37. data/spec/fixtures/vcr_cassettes/muc_retrieve_affiliations.yml +93 -0
  38. data/spec/fixtures/vcr_cassettes/pubsub_publish_with_dataform_payload.yml +3 -3
  39. data/spec/fixtures/vcr_cassettes/pubsub_retrieve_items.yml +24 -18
  40. data/spec/mixins/user_spec.rb +37 -37
  41. data/spec/models/data_form_spec.rb +3 -3
  42. data/spec/models/jid_spec.rb +41 -41
  43. data/spec/models/muc_affiliation_collection_spec.rb +146 -0
  44. data/spec/models/muc_affiliation_spec.rb +215 -0
  45. data/spec/models/muc_collection_spec.rb +64 -32
  46. data/spec/models/muc_configuration_spec.rb +3 -3
  47. data/spec/models/muc_spec.rb +44 -23
  48. data/spec/models/pubsub_affiliation_collection_spec.rb +65 -30
  49. data/spec/models/pubsub_affiliation_spec.rb +50 -50
  50. data/spec/models/pubsub_collection_spec.rb +65 -49
  51. data/spec/models/pubsub_item_collection_spec.rb +17 -17
  52. data/spec/models/pubsub_item_spec.rb +18 -18
  53. data/spec/models/pubsub_spec.rb +41 -41
  54. data/spec/models/pubsub_subscription_spec.rb +23 -23
  55. data/spec/models/response_error_spec.rb +19 -19
  56. data/spec/models/response_proxy_spec.rb +51 -49
  57. data/spec/models/response_spec.rb +33 -33
  58. data/spec/support/helpers.rb +21 -1
  59. data/spec/support/matchers.rb +4 -4
  60. data/spec/support/shared_examples.rb +132 -94
  61. data/spec/support/webmock_stanza_matching.rb +43 -0
  62. metadata +45 -16
@@ -0,0 +1,93 @@
1
+ ---
2
+ - !ruby/struct:VCR::HTTPInteraction
3
+ request: !ruby/struct:VCR::Request
4
+ method: :post
5
+ uri: http://theozaurus%40theo-template.local:secret@127.0.0.1:8000/
6
+ body: stanza=%3c%3fxml%20version%3d%221.0%22%3f%3e%0a%3cpresence%20to%3d%22retrieve_affiliations%40conference.theo-template.local%2ftheozaurus%22%3e%0a%20%20%3cx%20xmlns%3d%22http%3a%2f%2fjabber.org%2fprotocol%2fmuc%22%2f%3e%0a%3c%2fpresence%3e%0a
7
+ headers:
8
+ content-type:
9
+ - application/x-www-form-urlencoded
10
+ response: !ruby/struct:VCR::Response
11
+ status: !ruby/struct:VCR::ResponseStatus
12
+ code: 200
13
+ message: ...
14
+ headers:
15
+ content-type:
16
+ - application/xml
17
+ content-length:
18
+ - "40"
19
+ body: |
20
+ #<EventMachine::Timer:0x000001009733c0>
21
+
22
+ http_version: "1.1"
23
+ - !ruby/struct:VCR::HTTPInteraction
24
+ request: !ruby/struct:VCR::Request
25
+ method: :post
26
+ uri: http://theozaurus%40theo-template.local:secret@127.0.0.1:8000/
27
+ body: stanza=%3c%3fxml%20version%3d%221.0%22%3f%3e%0a%3ciq%20type%3d%22set%22%20to%3d%22retrieve_affiliations%40conference.theo-template.local%22%3e%0a%20%20%3cquery%20xmlns%3d%22http%3a%2f%2fjabber.org%2fprotocol%2fmuc%23owner%22%3e%0a%20%20%20%20%3cx%20xmlns%3d%22jabber%3ax%3adata%22%20type%3d%22submit%22%2f%3e%0a%20%20%3c%2fquery%3e%0a%3c%2fiq%3e%0a
28
+ headers:
29
+ content-type:
30
+ - application/x-www-form-urlencoded
31
+ response: !ruby/struct:VCR::Response
32
+ status: !ruby/struct:VCR::ResponseStatus
33
+ code: 200
34
+ message: ...
35
+ headers:
36
+ content-type:
37
+ - application/xml
38
+ content-length:
39
+ - "220"
40
+ body: |
41
+ <iq type="result" id="blather002f" from="retrieve_affiliations@conference.theo-template.local" to="theozaurus@theo-template.local/1919184006131046693197331">
42
+ <query xmlns="http://jabber.org/protocol/muc#owner"/>
43
+ </iq>
44
+
45
+ http_version: "1.1"
46
+ - !ruby/struct:VCR::HTTPInteraction
47
+ request: !ruby/struct:VCR::Request
48
+ method: :post
49
+ uri: http://theozaurus%40theo-template.local:secret@127.0.0.1:8000/
50
+ body: stanza=%3c%3fxml%20version%3d%221.0%22%3f%3e%0a%3ciq%20type%3d%22get%22%20to%3d%22retrieve_affiliations%40conference.theo-template.local%22%3e%0a%20%20%3cquery%20xmlns%3d%22http%3a%2f%2fjabber.org%2fprotocol%2fmuc%23admin%22%3e%0a%20%20%20%20%3citem%20affiliation%3d%22owner%22%2f%3e%0a%20%20%3c%2fquery%3e%0a%3c%2fiq%3e%0a
51
+ headers:
52
+ content-type:
53
+ - application/x-www-form-urlencoded
54
+ response: !ruby/struct:VCR::Response
55
+ status: !ruby/struct:VCR::ResponseStatus
56
+ code: 200
57
+ message: ...
58
+ headers:
59
+ content-type:
60
+ - application/xml
61
+ content-length:
62
+ - "299"
63
+ body: |
64
+ <iq type="result" id="blather0031" from="retrieve_affiliations@conference.theo-template.local" to="theozaurus@theo-template.local/1919184006131046693197331">
65
+ <query xmlns="http://jabber.org/protocol/muc#admin">
66
+ <item affiliation="owner" jid="theozaurus@theo-template.local"/>
67
+ </query>
68
+ </iq>
69
+
70
+ http_version: "1.1"
71
+ - !ruby/struct:VCR::HTTPInteraction
72
+ request: !ruby/struct:VCR::Request
73
+ method: :post
74
+ uri: http://theozaurus%40theo-template.local:secret@127.0.0.1:8000/
75
+ body: stanza=%3c%3fxml%20version%3d%221.0%22%3f%3e%0a%3ciq%20type%3d%22set%22%20to%3d%22retrieve_affiliations%40conference.theo-template.local%22%3e%0a%20%20%3cquery%20xmlns%3d%22http%3a%2f%2fjabber.org%2fprotocol%2fmuc%23owner%22%3e%0a%20%20%20%20%3cdestroy%2f%3e%0a%20%20%3c%2fquery%3e%0a%3c%2fiq%3e%0a
76
+ headers:
77
+ content-type:
78
+ - application/x-www-form-urlencoded
79
+ response: !ruby/struct:VCR::Response
80
+ status: !ruby/struct:VCR::ResponseStatus
81
+ code: 200
82
+ message: ...
83
+ headers:
84
+ content-type:
85
+ - application/xml
86
+ content-length:
87
+ - "220"
88
+ body: |
89
+ <iq type="result" id="blather0033" from="retrieve_affiliations@conference.theo-template.local" to="theozaurus@theo-template.local/1919184006131046693197331">
90
+ <query xmlns="http://jabber.org/protocol/muc#owner"/>
91
+ </iq>
92
+
93
+ http_version: "1.1"
@@ -3,7 +3,7 @@
3
3
  request: !ruby/struct:VCR::Request
4
4
  method: :post
5
5
  uri: http://theozaurus%40theo-template.local:secret@127.0.0.1:8000/
6
- body: stanza=%3c%3fxml%20version%3d%221.0%22%3f%3e%0a%3ciq%20type%3d%22set%22%20to%3d%22pubsub.theo-template.local%22%3e%0a%20%20%3cpubsub%20xmlns%3d%22http%3a%2f%2fjabber.org%2fprotocol%2fpubsub%22%3e%0a%20%20%20%20%3cpublish%20node%3d%22node_1%22%3e%0a%20%20%20%20%20%20%3citem%3e%0a%20%20%20%20%20%20%20%20%3cx%20xmlns%3d%22jabber%3ax%3adata%22%20type%3d%22submit%22%3e%0a%20%20%20%20%20%20%20%20%20%20%3cfield%20var%3d%22foo%22%3e%0a%20%20%20%20%20%20%20%20%20%20%20%20%3cvalue%3etrue%3c%2fvalue%3e%0a%20%20%20%20%20%20%20%20%20%20%3c%2ffield%3e%0a%20%20%20%20%20%20%20%20%3c%2fx%3e%0a%20%20%20%20%20%20%3c%2fitem%3e%0a%20%20%20%20%3c%2fpublish%3e%0a%20%20%3c%2fpubsub%3e%0a%3c%2fiq%3e%0a
6
+ body: stanza=%3ciq%20type%3d%22set%22%20to%3d%22pubsub.theo-template.local%22%3e%3cpubsub%20xmlns%3d%22http%3a%2f%2fjabber.org%2fprotocol%2fpubsub%22%3e%3cpublish%20node%3d%22node_1%22%3e%3citem%3e%3cx%20xmlns%3d%22jabber%3ax%3adata%22%20type%3d%22submit%22%3e%3cfield%20type%3d%22boolean%22%20var%3d%22foo%22%3e%3cvalue%3etrue%3c%2fvalue%3e%3c%2ffield%3e%3c%2fx%3e%3c%2fitem%3e%3c%2fpublish%3e%3c%2fpubsub%3e%3c%2fiq%3e%0a
7
7
  headers:
8
8
  content-type:
9
9
  - application/x-www-form-urlencoded
@@ -17,10 +17,10 @@
17
17
  content-length:
18
18
  - "280"
19
19
  body: |
20
- <iq type="result" id="blather004d" to="theozaurus@theo-template.local/39957870571305901244463676" from="pubsub.theo-template.local">
20
+ <iq type="result" id="blather06b1" to="theozaurus@theo-template.local/12410623761325794466810696" from="pubsub.theo-template.local">
21
21
  <pubsub xmlns="http://jabber.org/protocol/pubsub">
22
22
  <publish node="node_1">
23
- <item id="519DC0A278204"/>
23
+ <item id="52DC1F7BD2334"/>
24
24
  </publish>
25
25
  </pubsub>
26
26
  </iq>
@@ -3,7 +3,7 @@
3
3
  request: !ruby/struct:VCR::Request
4
4
  method: :post
5
5
  uri: http://theozaurus%40theo-template.local:secret@127.0.0.1:8000/
6
- body: stanza=%3c%3fxml%20version%3d%221.0%22%3f%3e%0a%3ciq%20type%3d%22set%22%20to%3d%22pubsub.theo-template.local%22%3e%0a%20%20%3cpubsub%20xmlns%3d%22http%3a%2f%2fjabber.org%2fprotocol%2fpubsub%22%3e%0a%20%20%20%20%3ccreate%20node%3d%22node_retrieve_items%22%2f%3e%0a%20%20%3c%2fpubsub%3e%0a%3c%2fiq%3e%0a
6
+ body: stanza=%3ciq%20type%3d%22set%22%20to%3d%22pubsub.theo-template.local%22%3e%3cpubsub%20xmlns%3d%22http%3a%2f%2fjabber.org%2fprotocol%2fpubsub%22%3e%3ccreate%20node%3d%22node_retrieve_items%22%2f%3e%3c%2fpubsub%3e%3c%2fiq%3e%0a
7
7
  headers:
8
8
  content-type:
9
9
  - application/x-www-form-urlencoded
@@ -15,12 +15,15 @@
15
15
  content-type:
16
16
  - application/xml
17
17
  content-length:
18
- - "245"
18
+ - "360"
19
19
  body: |
20
- <iq type="result" id="blather006b" from="pubsub.theo-template.local" to="theozaurus@theo-template.local/26631567861306144312811586">
20
+ <iq type="error" id="blather06b3" from="pubsub.theo-template.local" to="theozaurus@theo-template.local/12410623761325794466810696" lang="en">
21
21
  <pubsub xmlns="http://jabber.org/protocol/pubsub">
22
22
  <create node="node_retrieve_items"/>
23
23
  </pubsub>
24
+ <error code="409" type="cancel">
25
+ <conflict xmlns="urn:ietf:params:xml:ns:xmpp-stanzas"/>
26
+ </error>
24
27
  </iq>
25
28
 
26
29
  http_version: "1.1"
@@ -28,7 +31,7 @@
28
31
  request: !ruby/struct:VCR::Request
29
32
  method: :post
30
33
  uri: http://theozaurus%40theo-template.local:secret@127.0.0.1:8000/
31
- body: stanza=%3c%3fxml%20version%3d%221.0%22%3f%3e%0a%3ciq%20type%3d%22set%22%20to%3d%22pubsub.theo-template.local%22%3e%0a%20%20%3cpubsub%20xmlns%3d%22http%3a%2f%2fjabber.org%2fprotocol%2fpubsub%22%3e%0a%20%20%20%20%3cpublish%20node%3d%22node_retrieve_items%22%3e%0a%20%20%20%20%20%20%3citem%20id%3d%22efg%22%3e%0a%20%20%20%20%20%20%20%20%3cx%20xmlns%3d%22jabber%3ax%3adata%22%20type%3d%22submit%22%3e%0a%20%20%20%20%20%20%20%20%20%20%3cfield%20var%3d%22bar%22%3e%0a%20%20%20%20%20%20%20%20%20%20%20%20%3cvalue%3etrue%3c%2fvalue%3e%0a%20%20%20%20%20%20%20%20%20%20%3c%2ffield%3e%0a%20%20%20%20%20%20%20%20%3c%2fx%3e%0a%20%20%20%20%20%20%3c%2fitem%3e%0a%20%20%20%20%3c%2fpublish%3e%0a%20%20%3c%2fpubsub%3e%0a%3c%2fiq%3e%0a
34
+ body: stanza=%3ciq%20type%3d%22set%22%20to%3d%22pubsub.theo-template.local%22%3e%3cpubsub%20xmlns%3d%22http%3a%2f%2fjabber.org%2fprotocol%2fpubsub%22%3e%3cpublish%20node%3d%22node_retrieve_items%22%3e%3citem%20id%3d%22efg%22%3e%3cx%20xmlns%3d%22jabber%3ax%3adata%22%20type%3d%22submit%22%3e%3cfield%20type%3d%22boolean%22%20var%3d%22bar%22%3e%3cvalue%3etrue%3c%2fvalue%3e%3c%2ffield%3e%3c%2fx%3e%3c%2fitem%3e%3c%2fpublish%3e%3c%2fpubsub%3e%3c%2fiq%3e%0a
32
35
  headers:
33
36
  content-type:
34
37
  - application/x-www-form-urlencoded
@@ -42,7 +45,7 @@
42
45
  content-length:
43
46
  - "283"
44
47
  body: |
45
- <iq type="result" id="blather006d" to="theozaurus@theo-template.local/26631567861306144312811586" from="pubsub.theo-template.local">
48
+ <iq type="result" id="blather06b5" to="theozaurus@theo-template.local/12410623761325794466810696" from="pubsub.theo-template.local">
46
49
  <pubsub xmlns="http://jabber.org/protocol/pubsub">
47
50
  <publish node="node_retrieve_items">
48
51
  <item id="efg"/>
@@ -55,7 +58,7 @@
55
58
  request: !ruby/struct:VCR::Request
56
59
  method: :post
57
60
  uri: http://theozaurus%40theo-template.local:secret@127.0.0.1:8000/
58
- body: stanza=%3c%3fxml%20version%3d%221.0%22%3f%3e%0a%3ciq%20type%3d%22set%22%20to%3d%22pubsub.theo-template.local%22%3e%0a%20%20%3cpubsub%20xmlns%3d%22http%3a%2f%2fjabber.org%2fprotocol%2fpubsub%22%3e%0a%20%20%20%20%3cpublish%20node%3d%22node_retrieve_items%22%3e%0a%20%20%20%20%20%20%3citem%20id%3d%22abc%22%3e%0a%20%20%20%20%20%20%20%20%3cx%20xmlns%3d%22jabber%3ax%3adata%22%20type%3d%22submit%22%3e%0a%20%20%20%20%20%20%20%20%20%20%3cfield%20var%3d%22foo%22%3e%0a%20%20%20%20%20%20%20%20%20%20%20%20%3cvalue%3efalse%3c%2fvalue%3e%0a%20%20%20%20%20%20%20%20%20%20%3c%2ffield%3e%0a%20%20%20%20%20%20%20%20%3c%2fx%3e%0a%20%20%20%20%20%20%3c%2fitem%3e%0a%20%20%20%20%3c%2fpublish%3e%0a%20%20%3c%2fpubsub%3e%0a%3c%2fiq%3e%0a
61
+ body: stanza=%3ciq%20type%3d%22set%22%20to%3d%22pubsub.theo-template.local%22%3e%3cpubsub%20xmlns%3d%22http%3a%2f%2fjabber.org%2fprotocol%2fpubsub%22%3e%3cpublish%20node%3d%22node_retrieve_items%22%3e%3citem%20id%3d%22abc%22%3e%3cx%20xmlns%3d%22jabber%3ax%3adata%22%20type%3d%22submit%22%3e%3cfield%20type%3d%22boolean%22%20var%3d%22foo%22%3e%3cvalue%3efalse%3c%2fvalue%3e%3c%2ffield%3e%3c%2fx%3e%3c%2fitem%3e%3c%2fpublish%3e%3c%2fpubsub%3e%3c%2fiq%3e%0a
59
62
  headers:
60
63
  content-type:
61
64
  - application/x-www-form-urlencoded
@@ -69,7 +72,7 @@
69
72
  content-length:
70
73
  - "283"
71
74
  body: |
72
- <iq type="result" id="blather006f" to="theozaurus@theo-template.local/26631567861306144312811586" from="pubsub.theo-template.local">
75
+ <iq type="result" id="blather06b7" to="theozaurus@theo-template.local/12410623761325794466810696" from="pubsub.theo-template.local">
73
76
  <pubsub xmlns="http://jabber.org/protocol/pubsub">
74
77
  <publish node="node_retrieve_items">
75
78
  <item id="abc"/>
@@ -82,7 +85,7 @@
82
85
  request: !ruby/struct:VCR::Request
83
86
  method: :post
84
87
  uri: http://theozaurus%40theo-template.local:secret@127.0.0.1:8000/
85
- body: stanza=%3c%3fxml%20version%3d%221.0%22%3f%3e%0a%3ciq%20type%3d%22get%22%20to%3d%22pubsub.theo-template.local%22%3e%0a%20%20%3cpubsub%20xmlns%3d%22http%3a%2f%2fjabber.org%2fprotocol%2fpubsub%22%3e%0a%20%20%20%20%3citems%20node%3d%22node_retrieve_items%22%2f%3e%0a%20%20%3c%2fpubsub%3e%0a%3c%2fiq%3e%0a
88
+ body: stanza=%3ciq%20type%3d%22get%22%20to%3d%22pubsub.theo-template.local%22%3e%3cpubsub%20xmlns%3d%22http%3a%2f%2fjabber.org%2fprotocol%2fpubsub%22%3e%3citems%20node%3d%22node_retrieve_items%22%2f%3e%3c%2fpubsub%3e%3c%2fiq%3e%0a
86
89
  headers:
87
90
  content-type:
88
91
  - application/x-www-form-urlencoded
@@ -94,21 +97,21 @@
94
97
  content-type:
95
98
  - application/xml
96
99
  content-length:
97
- - "609"
100
+ - "639"
98
101
  body: |
99
- <iq type="result" id="blather0071" from="pubsub.theo-template.local" to="theozaurus@theo-template.local/26631567861306144312811586">
102
+ <iq type="result" id="blather06b9" from="pubsub.theo-template.local" to="theozaurus@theo-template.local/12410623761325794466810696">
100
103
  <pubsub xmlns="http://jabber.org/protocol/pubsub">
101
104
  <items node="node_retrieve_items">
102
105
  <item id="abc">
103
106
  <x xmlns="jabber:x:data" type="submit">
104
- <field var="foo">
107
+ <field type="boolean" var="foo">
105
108
  <value>false</value>
106
109
  </field>
107
110
  </x>
108
111
  </item>
109
112
  <item id="efg">
110
113
  <x xmlns="jabber:x:data" type="submit">
111
- <field var="bar">
114
+ <field type="boolean" var="bar">
112
115
  <value>true</value>
113
116
  </field>
114
117
  </x>
@@ -122,7 +125,7 @@
122
125
  request: !ruby/struct:VCR::Request
123
126
  method: :post
124
127
  uri: http://theozaurus%40theo-template.local:secret@127.0.0.1:8000/
125
- body: stanza=%3c%3fxml%20version%3d%221.0%22%3f%3e%0a%3ciq%20type%3d%22set%22%20to%3d%22pubsub.theo-template.local%22%3e%0a%20%20%3cpubsub%20xmlns%3d%22http%3a%2f%2fjabber.org%2fprotocol%2fpubsub%23owner%22%3e%0a%20%20%20%20%3cdelete%20node%3d%22node_retrieve_items%22%2f%3e%0a%20%20%3c%2fpubsub%3e%0a%3c%2fiq%3e%0a
128
+ body: stanza=%3ciq%20type%3d%22set%22%20to%3d%22pubsub.theo-template.local%22%3e%3cpubsub%20xmlns%3d%22http%3a%2f%2fjabber.org%2fprotocol%2fpubsub%23owner%22%3e%3cdelete%20node%3d%22node_retrieve_items%22%2f%3e%3c%2fpubsub%3e%3c%2fiq%3e%0a
126
129
  headers:
127
130
  content-type:
128
131
  - application/x-www-form-urlencoded
@@ -136,14 +139,14 @@
136
139
  content-length:
137
140
  - "134"
138
141
  body: |
139
- <iq type="result" id="blather0073" from="pubsub.theo-template.local" to="theozaurus@theo-template.local/26631567861306144312811586"/>
142
+ <iq type="result" id="blather06bb" from="pubsub.theo-template.local" to="theozaurus@theo-template.local/12410623761325794466810696"/>
140
143
 
141
144
  http_version: "1.1"
142
145
  - !ruby/struct:VCR::HTTPInteraction
143
146
  request: !ruby/struct:VCR::Request
144
147
  method: :post
145
148
  uri: http://theozaurus%40theo-template.local:secret@127.0.0.1:8000/
146
- body: stanza=%3c%3fxml%20version%3d%221.0%22%3f%3e%0a%3ciq%20type%3d%22get%22%20to%3d%22pubsub.theo-template.local%22%3e%0a%20%20%3cpubsub%20xmlns%3d%22http%3a%2f%2fjabber.org%2fprotocol%2fpubsub%22%3e%0a%20%20%20%20%3citems%20node%3d%22node_retrieve_items_wibble%22%2f%3e%0a%20%20%3c%2fpubsub%3e%0a%3c%2fiq%3e%0a
149
+ body: stanza=%3ciq%20type%3d%22get%22%20to%3d%22pubsub.theo-template.local%22%3e%3cpubsub%20xmlns%3d%22http%3a%2f%2fjabber.org%2fprotocol%2fpubsub%22%3e%3citems%20node%3d%22node_retrieve_items_wibble%22%2f%3e%3c%2fpubsub%3e%3c%2fiq%3e%0a
147
150
  headers:
148
151
  content-type:
149
152
  - application/x-www-form-urlencoded
@@ -155,12 +158,15 @@
155
158
  content-type:
156
159
  - application/xml
157
160
  content-length:
158
- - "361"
161
+ - "372"
159
162
  body: |
160
- <iq type="error" id="blather0075" from="pubsub.theo-template.local" to="theozaurus@theo-template.local/26631567861306144312811586" lang="en">
163
+ <iq type="error" id="blather06bd" from="pubsub.theo-template.local" to="theozaurus@theo-template.local/12410623761325794466810696" lang="en">
161
164
  <pubsub xmlns="http://jabber.org/protocol/pubsub">
162
165
  <items node="node_retrieve_items_wibble"/>
163
166
  </pubsub>
164
- <error code="404" type="cancel"><item-not-found xmlns="urn:ietf:params:xml:ns:xmpp-stanzas"/></error></iq>
167
+ <error code="404" type="cancel">
168
+ <item-not-found xmlns="urn:ietf:params:xml:ns:xmpp-stanzas"/>
169
+ </error>
170
+ </iq>
165
171
 
166
172
  http_version: "1.1"
@@ -5,20 +5,20 @@ class User
5
5
  end
6
6
 
7
7
  describe Jubjub::User do
8
-
8
+
9
9
  describe 'class method' do
10
-
10
+
11
11
  describe 'jubjub' do
12
-
12
+
13
13
  it 'should require :jid option' do
14
- expect {
14
+ expect {
15
15
  User.instance_eval{ jubjub_client :password => :foo }
16
16
  }.to raise_error(
17
17
  Jubjub::ArgumentError,
18
18
  'missing :jid option'
19
19
  )
20
20
  end
21
-
21
+
22
22
  it 'should require :password option' do
23
23
  expect {
24
24
  User.instance_eval{ jubjub_client :jid => :foo }
@@ -27,62 +27,62 @@ describe Jubjub::User do
27
27
  'missing :password option'
28
28
  )
29
29
  end
30
-
30
+
31
31
  it 'should setup jubjub_jid' do
32
32
  User.instance_eval{ jubjub_client :jid => :foo, :password => :bar }
33
-
33
+
34
34
  u = User.new
35
35
  u.stub(:foo).and_return('hello@jiggery')
36
36
 
37
37
  u.jubjub_jid.should be_kind_of(Jubjub::Jid)
38
38
  u.jubjub_jid.to_s.should eql('hello@jiggery')
39
39
  end
40
-
40
+
41
41
  it 'should setup jubjub_password' do
42
42
  User.instance_eval{ jubjub_client :jid => :foo, :password => :bar }
43
-
43
+
44
44
  u = User.new
45
45
  u.stub(:bar).and_return('secr3t')
46
46
 
47
47
  u.jubjub_password.should eql('secr3t')
48
48
  end
49
-
49
+
50
50
  describe 'connection settings' do
51
51
  it 'should use sensible defaults' do
52
52
  User.instance_eval{ jubjub_client :jid => :jid, :password => :password }
53
-
53
+
54
54
  u = User.new
55
55
  u.jubjub_connection_settings.should eql( :host => '127.0.0.1', :port => '8000' )
56
56
  end
57
-
57
+
58
58
  it 'should have :host overrideable' do
59
59
  User.instance_eval{ jubjub_client :jid => :jid, :password => :password, :connection_settings => {:host => '192.168.1.1'} }
60
-
60
+
61
61
  u = User.new
62
62
  u.jubjub_connection_settings.should eql( :host => '192.168.1.1', :port => '8000' )
63
63
  end
64
-
64
+
65
65
  it 'should have :port overrideable' do
66
66
  User.instance_eval{ jubjub_client :jid => :jid, :password => :password, :connection_settings => {:port => '7000'} }
67
-
67
+
68
68
  u = User.new
69
69
  u.jubjub_connection_settings.should eql( :host => '127.0.0.1', :port => '7000' )
70
70
  end
71
71
  end
72
-
72
+
73
73
  end
74
-
74
+
75
75
  end
76
-
76
+
77
77
  describe 'instance method' do
78
78
  def mock_jubjub_connection
79
79
  @jubjub_connection = mock
80
80
  @user.stub(:jubjub_connection).and_return(@jubjub_connection)
81
81
  end
82
-
82
+
83
83
  before do
84
84
  User.instance_eval{ jubjub_client :jid => :jid, :password => :password }
85
-
85
+
86
86
  @user = User.new
87
87
  @user.stub(:jid).and_return('theozaurus@biggles.com')
88
88
  @user.stub(:password).and_return('123')
@@ -92,56 +92,56 @@ describe Jubjub::User do
92
92
  it 'should return Jubjub::Connection::XmppGateway instance' do
93
93
  @user.jubjub_connection.should be_kind_of(Jubjub::Connection::XmppGateway)
94
94
  end
95
-
95
+
96
96
  it 'should call Jubjub::Connection::XmppGateway with correct options' do
97
97
  @user.stub(:jubjub_jid).and_return('theozaurus@biggles.com')
98
98
  @user.stub(:jubjub_password).and_return('123')
99
99
  @user.stub(:jubjub_connection_settings).and_return(:host => 'zippy', :port => '1234')
100
-
100
+
101
101
  Jubjub::Connection::XmppGateway.should_receive(:new).with('theozaurus@biggles.com', '123', {:host => 'zippy', :port => '1234'} )
102
-
102
+
103
103
  @user.jubjub_connection
104
- end
104
+ end
105
105
  end
106
106
 
107
107
  describe 'authenticated?' do
108
108
  before do
109
109
  mock_jubjub_connection
110
110
  end
111
-
111
+
112
112
  it 'should call authenticated on jubjub_connection' do
113
- @jubjub_connection.should_receive(:authenticated?)
114
-
113
+ @jubjub_connection.should_receive(:authenticated?)
114
+
115
115
  @user.authenticated?
116
116
  end
117
117
  end
118
-
118
+
119
119
  describe 'mucs' do
120
120
  before do
121
121
  mock_jubjub_connection
122
122
  end
123
-
124
- it 'should return Jubjub::Muc::Collection for conference.biggles.com when no service specified' do
123
+
124
+ it 'should return Jubjub::Muc::Collection for conference.biggles.com when no service specified' do
125
125
  @user.mucs.should be_a Jubjub::Muc::Collection
126
126
  @user.mucs.jid.should == Jubjub::Jid.new('conference.biggles.com')
127
127
  end
128
-
128
+
129
129
  it 'should return Jubjub::Muc::Collection for service when specified' do
130
130
  @user.mucs('wibble.com').should be_a Jubjub::Muc::Collection
131
131
  @user.mucs('wibble.com').jid.should == Jubjub::Jid.new('wibble.com')
132
132
  end
133
133
  end
134
-
134
+
135
135
  describe 'pubsub' do
136
136
  before do
137
137
  mock_jubjub_connection
138
138
  end
139
-
140
- it 'should return Jubjub::Pubsub::Collection for conference.biggles.com when no service specified' do
139
+
140
+ it 'should return Jubjub::Pubsub::Collection for conference.biggles.com when no service specified' do
141
141
  @user.pubsub.should be_a Jubjub::Pubsub::Collection
142
142
  @user.pubsub.jid.should == Jubjub::Jid.new('pubsub.biggles.com')
143
143
  end
144
-
144
+
145
145
  it 'should return Jubjub::Pubsub::Collection for service when specified' do
146
146
  @user.pubsub('wibble.com').should be_a Jubjub::Pubsub::Collection
147
147
  @user.pubsub('wibble.com').jid.should == Jubjub::Jid.new('wibble.com')
@@ -149,5 +149,5 @@ describe Jubjub::User do
149
149
  end
150
150
 
151
151
  end
152
-
153
- end
152
+
153
+ end
@@ -1,7 +1,7 @@
1
1
  require 'spec_helper'
2
2
 
3
3
  describe Jubjub::DataForm do
4
-
4
+
5
5
  it_behaves_like "any data form"
6
-
7
- end
6
+
7
+ end
@@ -1,123 +1,123 @@
1
1
  require 'spec_helper'
2
2
 
3
3
  describe Jubjub::Jid do
4
-
4
+
5
5
  describe "creating" do
6
-
6
+
7
7
  describe "from a string" do
8
-
8
+
9
9
  it("should understand 'foo.bar'") do
10
10
  j = Jubjub::Jid.new('foo.bar')
11
-
11
+
12
12
  j.node.should be_nil
13
13
  j.domain.should eql('foo.bar')
14
- j.resource.should be_nil
14
+ j.resource.should be_nil
15
15
  end
16
-
16
+
17
17
  it("should understand 'bob@foo.bar'") do
18
18
  j = Jubjub::Jid.new('bob@foo.bar')
19
-
19
+
20
20
  j.node.should eql('bob')
21
21
  j.domain.should eql('foo.bar')
22
22
  j.resource.should be_nil
23
23
  end
24
-
24
+
25
25
  it("should understand 'bob@foo.bar/wibble'") do
26
26
  j = Jubjub::Jid.new('bob@foo.bar/wibble')
27
-
27
+
28
28
  j.node.should eql('bob')
29
29
  j.domain.should eql('foo.bar')
30
30
  j.resource.should eql('wibble')
31
31
  end
32
-
32
+
33
33
  end
34
-
34
+
35
35
  describe "from components" do
36
-
36
+
37
37
  it("should understand nil, 'foo.bar', nil") do
38
38
  j = Jubjub::Jid.new(nil, 'foo.bar', nil)
39
-
39
+
40
40
  j.node.should be_nil
41
41
  j.domain.should eql('foo.bar')
42
- j.resource.should be_nil
42
+ j.resource.should be_nil
43
43
  end
44
-
44
+
45
45
  it("should understand 'bob', 'foo.bar', nil") do
46
46
  j = Jubjub::Jid.new('bob','foo.bar',nil)
47
-
47
+
48
48
  j.node.should eql('bob')
49
49
  j.domain.should eql('foo.bar')
50
50
  j.resource.should be_nil
51
51
  end
52
-
52
+
53
53
  it("should understand 'bob','foo.bar','wibble'") do
54
54
  j = Jubjub::Jid.new('bob','foo.bar','wibble')
55
-
55
+
56
56
  j.node.should eql('bob')
57
57
  j.domain.should eql('foo.bar')
58
58
  j.resource.should eql('wibble')
59
59
  end
60
-
60
+
61
61
  end
62
-
62
+
63
63
  describe "from a Jubjub::Jid" do
64
64
  it("should understand Jid.new('foo.bar')") do
65
65
  j = Jubjub::Jid.new( Jubjub::Jid.new('foo.bar') )
66
-
66
+
67
67
  j.node.should be_nil
68
68
  j.domain.should eql('foo.bar')
69
- j.resource.should be_nil
69
+ j.resource.should be_nil
70
70
  end
71
-
71
+
72
72
  it("should understand Jid.new('bob@foo.bar')") do
73
73
  j = Jubjub::Jid.new( Jubjub::Jid.new('bob@foo.bar') )
74
-
74
+
75
75
  j.node.should eql('bob')
76
76
  j.domain.should eql('foo.bar')
77
77
  j.resource.should be_nil
78
78
  end
79
-
79
+
80
80
  it("should understand Jid.new('bob@foo.bar/wibble')") do
81
81
  j = Jubjub::Jid.new( Jubjub::Jid.new('bob@foo.bar/wibble') )
82
-
82
+
83
83
  j.node.should eql('bob')
84
84
  j.domain.should eql('foo.bar')
85
85
  j.resource.should eql('wibble')
86
86
  end
87
87
  end
88
-
88
+
89
89
  end
90
-
90
+
91
91
  describe "instance method" do
92
-
92
+
93
93
  describe "to_s" do
94
-
94
+
95
95
  it "should support just a domain" do
96
96
  j = Jubjub::Jid.new nil, 'biggles.com'
97
-
97
+
98
98
  j.to_s.should eql('biggles.com')
99
99
  end
100
-
100
+
101
101
  it "should support a node and a domain" do
102
102
  j = Jubjub::Jid.new 'theozaurus', 'biggles.com'
103
-
103
+
104
104
  j.to_s.should eql('theozaurus@biggles.com')
105
105
  end
106
-
106
+
107
107
  it "should support a node, domain and resource" do
108
108
  j = Jubjub::Jid.new 'theozaurus', 'biggles.com', 'rocket'
109
-
109
+
110
110
  j.to_s.should eql('theozaurus@biggles.com/rocket')
111
111
  end
112
-
112
+
113
113
  it "should support a domain and resource" do
114
114
  j = Jubjub::Jid.new nil, 'biggles.com', 'bingo'
115
-
115
+
116
116
  j.to_s.should eql('biggles.com/bingo')
117
117
  end
118
-
118
+
119
119
  end
120
-
120
+
121
121
  end
122
-
123
- end
122
+
123
+ end