cerberus 0.6 → 0.7

Sign up to get free protection for your applications and to get access to all the features.
Files changed (290) hide show
  1. data/Authors.txt +4 -0
  2. data/Changelog.txt +11 -0
  3. data/Copyright.txt +16 -0
  4. data/Rakefile +16 -25
  5. data/Readme.markdown +1 -3
  6. data/bin/cerberus +5 -0
  7. data/lib/cerberus/builder/bjam.rb +1 -3
  8. data/lib/cerberus/builder/maven2.rb +0 -1
  9. data/lib/cerberus/builder/rake.rb +1 -1
  10. data/lib/cerberus/builder/rspec.rb +0 -1
  11. data/lib/cerberus/builder/ruby_base.rb +0 -1
  12. data/lib/cerberus/component_lazy_loader.rb +6 -2
  13. data/lib/cerberus/config.example.yml +1 -0
  14. data/lib/cerberus/constants.rb +2 -2
  15. data/lib/cerberus/manager.rb +7 -1
  16. data/lib/cerberus/publisher/mail.rb +4 -4
  17. data/lib/cerberus/publisher/twitter.rb +0 -1
  18. data/lib/cerberus/scm/base.rb +19 -0
  19. data/lib/cerberus/scm/bzr.rb +62 -0
  20. data/lib/cerberus/scm/cvs.rb +2 -7
  21. data/lib/cerberus/scm/darcs.rb +2 -11
  22. data/lib/cerberus/scm/git.rb +6 -14
  23. data/lib/cerberus/scm/perforce.rb +4 -4
  24. data/lib/cerberus/scm/svn.rb +2 -7
  25. data/lib/cerberus/utils.rb +5 -0
  26. data/lib/vendor/irc/README +23 -0
  27. data/lib/vendor/irc/lib/IRC.rb +164 -0
  28. data/lib/vendor/irc/lib/IRCChannel.rb +33 -0
  29. data/lib/vendor/irc/lib/IRCConnection.rb +134 -0
  30. data/lib/vendor/irc/lib/IRCEvent.rb +91 -0
  31. data/lib/vendor/irc/lib/IRCUser.rb +23 -0
  32. data/lib/vendor/irc/lib/IRCUtil.rb +49 -0
  33. data/lib/vendor/irc/lib/eventmap.yml +247 -0
  34. data/lib/vendor/twitter/CHANGES +129 -0
  35. data/lib/vendor/twitter/MIT-LICENSE +20 -0
  36. data/lib/vendor/twitter/README +37 -0
  37. data/lib/vendor/twitter/TODO +7 -0
  38. data/lib/vendor/twitter/lib/twitter.rb +34 -0
  39. data/lib/vendor/twitter/lib/twitter/client.rb +24 -0
  40. data/lib/vendor/twitter/lib/twitter/client/account.rb +24 -0
  41. data/lib/vendor/twitter/lib/twitter/client/auth.rb +27 -0
  42. data/lib/vendor/twitter/lib/twitter/client/base.rb +93 -0
  43. data/lib/vendor/twitter/lib/twitter/client/blocks.rb +35 -0
  44. data/lib/vendor/twitter/lib/twitter/client/favorites.rb +53 -0
  45. data/lib/vendor/twitter/lib/twitter/client/friendship.rb +35 -0
  46. data/lib/vendor/twitter/lib/twitter/client/graph.rb +37 -0
  47. data/lib/vendor/twitter/lib/twitter/client/messaging.rb +79 -0
  48. data/lib/vendor/twitter/lib/twitter/client/profile.rb +29 -0
  49. data/lib/vendor/twitter/lib/twitter/client/search.rb +27 -0
  50. data/lib/vendor/twitter/lib/twitter/client/status.rb +51 -0
  51. data/lib/vendor/twitter/lib/twitter/client/timeline.rb +72 -0
  52. data/lib/vendor/twitter/lib/twitter/client/user.rb +65 -0
  53. data/lib/vendor/twitter/lib/twitter/config.rb +77 -0
  54. data/lib/vendor/twitter/lib/twitter/console.rb +31 -0
  55. data/lib/vendor/twitter/lib/twitter/core.rb +137 -0
  56. data/lib/vendor/twitter/lib/twitter/ext.rb +2 -0
  57. data/lib/vendor/twitter/lib/twitter/ext/stdlib.rb +52 -0
  58. data/lib/vendor/twitter/lib/twitter/extras.rb +39 -0
  59. data/lib/vendor/twitter/lib/twitter/meta.rb +56 -0
  60. data/lib/vendor/twitter/lib/twitter/model.rb +360 -0
  61. data/lib/vendor/twitter/lib/twitter/version.rb +19 -0
  62. data/lib/vendor/twitter/spec/twitter/client/account_spec.rb +28 -0
  63. data/lib/vendor/twitter/spec/twitter/client/auth_spec.rb +34 -0
  64. data/lib/vendor/twitter/spec/twitter/client/base_spec.rb +242 -0
  65. data/lib/vendor/twitter/spec/twitter/client/blocks_spec.rb +76 -0
  66. data/lib/vendor/twitter/spec/twitter/client/favorites_spec.rb +183 -0
  67. data/lib/vendor/twitter/spec/twitter/client/friendship_spec.rb +76 -0
  68. data/lib/vendor/twitter/spec/twitter/client/graph_spec.rb +67 -0
  69. data/lib/vendor/twitter/spec/twitter/client/messaging_spec.rb +135 -0
  70. data/lib/vendor/twitter/spec/twitter/client/profile_spec.rb +91 -0
  71. data/lib/vendor/twitter/spec/twitter/client/search_spec.rb +68 -0
  72. data/lib/vendor/twitter/spec/twitter/client/status_spec.rb +119 -0
  73. data/lib/vendor/twitter/spec/twitter/client/timeline_spec.rb +79 -0
  74. data/lib/vendor/twitter/spec/twitter/client/user_spec.rb +203 -0
  75. data/lib/vendor/twitter/spec/twitter/client_spec.rb +2 -0
  76. data/lib/vendor/twitter/spec/twitter/config_spec.rb +86 -0
  77. data/lib/vendor/twitter/spec/twitter/console_spec.rb +15 -0
  78. data/lib/vendor/twitter/spec/twitter/core_spec.rb +127 -0
  79. data/lib/vendor/twitter/spec/twitter/ext/stdlib_spec.rb +59 -0
  80. data/lib/vendor/twitter/spec/twitter/extras_spec.rb +46 -0
  81. data/lib/vendor/twitter/spec/twitter/meta_spec.rb +90 -0
  82. data/lib/vendor/twitter/spec/twitter/model_spec.rb +508 -0
  83. data/lib/vendor/twitter/spec/twitter/version_spec.rb +19 -0
  84. data/lib/vendor/xmpp4r/CHANGELOG +83 -0
  85. data/lib/vendor/xmpp4r/COPYING +340 -0
  86. data/lib/vendor/xmpp4r/LICENSE +59 -0
  87. data/lib/vendor/xmpp4r/README.rdoc +110 -0
  88. data/lib/vendor/xmpp4r/README_ruby19.txt +43 -0
  89. data/lib/vendor/xmpp4r/Rakefile +262 -0
  90. data/lib/vendor/xmpp4r/data/doc/xmpp4r/examples/advanced/adventure/README +56 -0
  91. data/lib/vendor/xmpp4r/data/doc/xmpp4r/examples/advanced/adventure/adventure.rb +23 -0
  92. data/lib/vendor/xmpp4r/data/doc/xmpp4r/examples/advanced/adventure/adventuremuc.rb +136 -0
  93. data/lib/vendor/xmpp4r/data/doc/xmpp4r/examples/advanced/adventure/cube.xml +15 -0
  94. data/lib/vendor/xmpp4r/data/doc/xmpp4r/examples/advanced/adventure/tower.xml +69 -0
  95. data/lib/vendor/xmpp4r/data/doc/xmpp4r/examples/advanced/adventure/world.rb +424 -0
  96. data/lib/vendor/xmpp4r/data/doc/xmpp4r/examples/advanced/fileserve.conf +11 -0
  97. data/lib/vendor/xmpp4r/data/doc/xmpp4r/examples/advanced/fileserve.rb +346 -0
  98. data/lib/vendor/xmpp4r/data/doc/xmpp4r/examples/advanced/getonline.rb +56 -0
  99. data/lib/vendor/xmpp4r/data/doc/xmpp4r/examples/advanced/gtkmucclient.rb +315 -0
  100. data/lib/vendor/xmpp4r/data/doc/xmpp4r/examples/advanced/migrate.rb +88 -0
  101. data/lib/vendor/xmpp4r/data/doc/xmpp4r/examples/advanced/minimuc.rb +266 -0
  102. data/lib/vendor/xmpp4r/data/doc/xmpp4r/examples/advanced/pep-aggregator/index.xsl +235 -0
  103. data/lib/vendor/xmpp4r/data/doc/xmpp4r/examples/advanced/pep-aggregator/pep-aggregator.rb +147 -0
  104. data/lib/vendor/xmpp4r/data/doc/xmpp4r/examples/advanced/recvfile.rb +84 -0
  105. data/lib/vendor/xmpp4r/data/doc/xmpp4r/examples/advanced/rosterdiscovery.rb +129 -0
  106. data/lib/vendor/xmpp4r/data/doc/xmpp4r/examples/advanced/sendfile.conf +10 -0
  107. data/lib/vendor/xmpp4r/data/doc/xmpp4r/examples/advanced/sendfile.rb +72 -0
  108. data/lib/vendor/xmpp4r/data/doc/xmpp4r/examples/advanced/shellmgr/shellmgr.rb +51 -0
  109. data/lib/vendor/xmpp4r/data/doc/xmpp4r/examples/advanced/shellmgr/shellmgr_jabber.rb +43 -0
  110. data/lib/vendor/xmpp4r/data/doc/xmpp4r/examples/advanced/shellmgr/shellmgr_test.rb +10 -0
  111. data/lib/vendor/xmpp4r/data/doc/xmpp4r/examples/advanced/versionpoll.rb +90 -0
  112. data/lib/vendor/xmpp4r/data/doc/xmpp4r/examples/advanced/xmpping.rb +146 -0
  113. data/lib/vendor/xmpp4r/data/doc/xmpp4r/examples/advanced/xmppingrc.sample +14 -0
  114. data/lib/vendor/xmpp4r/data/doc/xmpp4r/examples/basic/change_password.rb +41 -0
  115. data/lib/vendor/xmpp4r/data/doc/xmpp4r/examples/basic/client.rb +70 -0
  116. data/lib/vendor/xmpp4r/data/doc/xmpp4r/examples/basic/component.rb +11 -0
  117. data/lib/vendor/xmpp4r/data/doc/xmpp4r/examples/basic/echo.rb +37 -0
  118. data/lib/vendor/xmpp4r/data/doc/xmpp4r/examples/basic/jabbersend.rb +41 -0
  119. data/lib/vendor/xmpp4r/data/doc/xmpp4r/examples/basic/mass_sender.rb +68 -0
  120. data/lib/vendor/xmpp4r/data/doc/xmpp4r/examples/basic/muc_owner_config.rb +12 -0
  121. data/lib/vendor/xmpp4r/data/doc/xmpp4r/examples/basic/mucinfo.rb +41 -0
  122. data/lib/vendor/xmpp4r/data/doc/xmpp4r/examples/basic/mucsimplebot.rb +82 -0
  123. data/lib/vendor/xmpp4r/data/doc/xmpp4r/examples/basic/register.rb +42 -0
  124. data/lib/vendor/xmpp4r/data/doc/xmpp4r/examples/basic/remove_registration.rb +18 -0
  125. data/lib/vendor/xmpp4r/data/doc/xmpp4r/examples/basic/roster.rb +44 -0
  126. data/lib/vendor/xmpp4r/data/doc/xmpp4r/examples/basic/rosterprint.rb +50 -0
  127. data/lib/vendor/xmpp4r/data/doc/xmpp4r/examples/basic/rosterrename.rb +34 -0
  128. data/lib/vendor/xmpp4r/data/doc/xmpp4r/examples/basic/rosterwatch.rb +171 -0
  129. data/lib/vendor/xmpp4r/data/doc/xmpp4r/examples/basic/send_vcard.rb +67 -0
  130. data/lib/vendor/xmpp4r/data/doc/xmpp4r/examples/basic/tune_client.rb +56 -0
  131. data/lib/vendor/xmpp4r/data/doc/xmpp4r/examples/basic/tune_server.rb +58 -0
  132. data/lib/vendor/xmpp4r/data/doc/xmpp4r/examples/basic/versionbot.rb +75 -0
  133. data/lib/vendor/xmpp4r/lib/xmpp4r.rb +116 -0
  134. data/lib/vendor/xmpp4r/lib/xmpp4r/base64.rb +32 -0
  135. data/lib/vendor/xmpp4r/lib/xmpp4r/bytestreams.rb +15 -0
  136. data/lib/vendor/xmpp4r/lib/xmpp4r/bytestreams/helper/filetransfer.rb +319 -0
  137. data/lib/vendor/xmpp4r/lib/xmpp4r/bytestreams/helper/ibb/base.rb +257 -0
  138. data/lib/vendor/xmpp4r/lib/xmpp4r/bytestreams/helper/ibb/initiator.rb +31 -0
  139. data/lib/vendor/xmpp4r/lib/xmpp4r/bytestreams/helper/ibb/target.rb +47 -0
  140. data/lib/vendor/xmpp4r/lib/xmpp4r/bytestreams/helper/socks5bytestreams/base.rb +152 -0
  141. data/lib/vendor/xmpp4r/lib/xmpp4r/bytestreams/helper/socks5bytestreams/initiator.rb +86 -0
  142. data/lib/vendor/xmpp4r/lib/xmpp4r/bytestreams/helper/socks5bytestreams/server.rb +198 -0
  143. data/lib/vendor/xmpp4r/lib/xmpp4r/bytestreams/helper/socks5bytestreams/socks5.rb +65 -0
  144. data/lib/vendor/xmpp4r/lib/xmpp4r/bytestreams/helper/socks5bytestreams/target.rb +73 -0
  145. data/lib/vendor/xmpp4r/lib/xmpp4r/bytestreams/helper/socks5bytestreams/target.rb.orig +62 -0
  146. data/lib/vendor/xmpp4r/lib/xmpp4r/bytestreams/iq/bytestreams.rb +170 -0
  147. data/lib/vendor/xmpp4r/lib/xmpp4r/bytestreams/iq/si.rb +206 -0
  148. data/lib/vendor/xmpp4r/lib/xmpp4r/callbacks.rb +124 -0
  149. data/lib/vendor/xmpp4r/lib/xmpp4r/caps.rb +1 -0
  150. data/lib/vendor/xmpp4r/lib/xmpp4r/caps/c.rb +53 -0
  151. data/lib/vendor/xmpp4r/lib/xmpp4r/caps/helper/generator.rb +160 -0
  152. data/lib/vendor/xmpp4r/lib/xmpp4r/caps/helper/helper.rb +87 -0
  153. data/lib/vendor/xmpp4r/lib/xmpp4r/client.rb +317 -0
  154. data/lib/vendor/xmpp4r/lib/xmpp4r/command/helper/responder.rb +53 -0
  155. data/lib/vendor/xmpp4r/lib/xmpp4r/command/iq/command.rb +154 -0
  156. data/lib/vendor/xmpp4r/lib/xmpp4r/component.rb +103 -0
  157. data/lib/vendor/xmpp4r/lib/xmpp4r/connection.rb +219 -0
  158. data/lib/vendor/xmpp4r/lib/xmpp4r/dataforms.rb +5 -0
  159. data/lib/vendor/xmpp4r/lib/xmpp4r/dataforms/x/data.rb +297 -0
  160. data/lib/vendor/xmpp4r/lib/xmpp4r/debuglog.rb +42 -0
  161. data/lib/vendor/xmpp4r/lib/xmpp4r/delay.rb +5 -0
  162. data/lib/vendor/xmpp4r/lib/xmpp4r/delay/x/delay.rb +99 -0
  163. data/lib/vendor/xmpp4r/lib/xmpp4r/discovery.rb +7 -0
  164. data/lib/vendor/xmpp4r/lib/xmpp4r/discovery/helper/responder.rb +165 -0
  165. data/lib/vendor/xmpp4r/lib/xmpp4r/discovery/iq/discoinfo.rb +211 -0
  166. data/lib/vendor/xmpp4r/lib/xmpp4r/discovery/iq/discoitems.rb +147 -0
  167. data/lib/vendor/xmpp4r/lib/xmpp4r/errors.rb +281 -0
  168. data/lib/vendor/xmpp4r/lib/xmpp4r/feature_negotiation.rb +5 -0
  169. data/lib/vendor/xmpp4r/lib/xmpp4r/feature_negotiation/iq/feature.rb +28 -0
  170. data/lib/vendor/xmpp4r/lib/xmpp4r/framework/base.rb +55 -0
  171. data/lib/vendor/xmpp4r/lib/xmpp4r/framework/bot.rb +148 -0
  172. data/lib/vendor/xmpp4r/lib/xmpp4r/httpbinding.rb +5 -0
  173. data/lib/vendor/xmpp4r/lib/xmpp4r/httpbinding/client.rb +285 -0
  174. data/lib/vendor/xmpp4r/lib/xmpp4r/idgenerator.rb +37 -0
  175. data/lib/vendor/xmpp4r/lib/xmpp4r/iq.rb +221 -0
  176. data/lib/vendor/xmpp4r/lib/xmpp4r/jid.rb +167 -0
  177. data/lib/vendor/xmpp4r/lib/xmpp4r/message.rb +148 -0
  178. data/lib/vendor/xmpp4r/lib/xmpp4r/muc.rb +14 -0
  179. data/lib/vendor/xmpp4r/lib/xmpp4r/muc/helper/mucbrowser.rb +92 -0
  180. data/lib/vendor/xmpp4r/lib/xmpp4r/muc/helper/mucclient.rb +462 -0
  181. data/lib/vendor/xmpp4r/lib/xmpp4r/muc/helper/simplemucclient.rb +332 -0
  182. data/lib/vendor/xmpp4r/lib/xmpp4r/muc/iq/mucadmin.rb +23 -0
  183. data/lib/vendor/xmpp4r/lib/xmpp4r/muc/iq/mucadminitem.rb +20 -0
  184. data/lib/vendor/xmpp4r/lib/xmpp4r/muc/iq/mucowner.rb +15 -0
  185. data/lib/vendor/xmpp4r/lib/xmpp4r/muc/item.rb +143 -0
  186. data/lib/vendor/xmpp4r/lib/xmpp4r/muc/x/muc.rb +70 -0
  187. data/lib/vendor/xmpp4r/lib/xmpp4r/muc/x/mucuserinvite.rb +60 -0
  188. data/lib/vendor/xmpp4r/lib/xmpp4r/muc/x/mucuseritem.rb +36 -0
  189. data/lib/vendor/xmpp4r/lib/xmpp4r/presence.rb +232 -0
  190. data/lib/vendor/xmpp4r/lib/xmpp4r/pubsub.rb +8 -0
  191. data/lib/vendor/xmpp4r/lib/xmpp4r/pubsub/children/configuration.rb +86 -0
  192. data/lib/vendor/xmpp4r/lib/xmpp4r/pubsub/children/event.rb +49 -0
  193. data/lib/vendor/xmpp4r/lib/xmpp4r/pubsub/children/item.rb +35 -0
  194. data/lib/vendor/xmpp4r/lib/xmpp4r/pubsub/children/items.rb +44 -0
  195. data/lib/vendor/xmpp4r/lib/xmpp4r/pubsub/children/node_config.rb +48 -0
  196. data/lib/vendor/xmpp4r/lib/xmpp4r/pubsub/children/publish.rb +24 -0
  197. data/lib/vendor/xmpp4r/lib/xmpp4r/pubsub/children/subscription.rb +62 -0
  198. data/lib/vendor/xmpp4r/lib/xmpp4r/pubsub/children/subscription_config.rb +67 -0
  199. data/lib/vendor/xmpp4r/lib/xmpp4r/pubsub/children/unsubscribe.rb +48 -0
  200. data/lib/vendor/xmpp4r/lib/xmpp4r/pubsub/helper/nodebrowser.rb +130 -0
  201. data/lib/vendor/xmpp4r/lib/xmpp4r/pubsub/helper/nodehelper.rb +156 -0
  202. data/lib/vendor/xmpp4r/lib/xmpp4r/pubsub/helper/servicehelper.rb +417 -0
  203. data/lib/vendor/xmpp4r/lib/xmpp4r/pubsub/iq/pubsub.rb +19 -0
  204. data/lib/vendor/xmpp4r/lib/xmpp4r/query.rb +15 -0
  205. data/lib/vendor/xmpp4r/lib/xmpp4r/rexmladdons.rb +151 -0
  206. data/lib/vendor/xmpp4r/lib/xmpp4r/roster.rb +7 -0
  207. data/lib/vendor/xmpp4r/lib/xmpp4r/roster/helper/roster.rb +519 -0
  208. data/lib/vendor/xmpp4r/lib/xmpp4r/roster/iq/roster.rb +215 -0
  209. data/lib/vendor/xmpp4r/lib/xmpp4r/roster/x/roster.rb +138 -0
  210. data/lib/vendor/xmpp4r/lib/xmpp4r/rpc.rb +2 -0
  211. data/lib/vendor/xmpp4r/lib/xmpp4r/rpc/helper/client.rb +123 -0
  212. data/lib/vendor/xmpp4r/lib/xmpp4r/rpc/helper/server.rb +74 -0
  213. data/lib/vendor/xmpp4r/lib/xmpp4r/rpc/helper/xmlrpcaddons.rb +67 -0
  214. data/lib/vendor/xmpp4r/lib/xmpp4r/rpc/iq/rpc.rb +23 -0
  215. data/lib/vendor/xmpp4r/lib/xmpp4r/sasl.rb +237 -0
  216. data/lib/vendor/xmpp4r/lib/xmpp4r/semaphore.rb +38 -0
  217. data/lib/vendor/xmpp4r/lib/xmpp4r/stream.rb +497 -0
  218. data/lib/vendor/xmpp4r/lib/xmpp4r/streamparser.rb +77 -0
  219. data/lib/vendor/xmpp4r/lib/xmpp4r/tune.rb +2 -0
  220. data/lib/vendor/xmpp4r/lib/xmpp4r/tune/helper/helper.rb +58 -0
  221. data/lib/vendor/xmpp4r/lib/xmpp4r/tune/tune.rb +113 -0
  222. data/lib/vendor/xmpp4r/lib/xmpp4r/vcard.rb +6 -0
  223. data/lib/vendor/xmpp4r/lib/xmpp4r/vcard/helper/vcard.rb +84 -0
  224. data/lib/vendor/xmpp4r/lib/xmpp4r/vcard/iq/vcard.rb +109 -0
  225. data/lib/vendor/xmpp4r/lib/xmpp4r/version.rb +7 -0
  226. data/lib/vendor/xmpp4r/lib/xmpp4r/version/helper/responder.rb +72 -0
  227. data/lib/vendor/xmpp4r/lib/xmpp4r/version/helper/simpleresponder.rb +44 -0
  228. data/lib/vendor/xmpp4r/lib/xmpp4r/version/iq/version.rb +105 -0
  229. data/lib/vendor/xmpp4r/lib/xmpp4r/x.rb +37 -0
  230. data/lib/vendor/xmpp4r/lib/xmpp4r/xhtml.rb +1 -0
  231. data/lib/vendor/xmpp4r/lib/xmpp4r/xhtml/html.rb +115 -0
  232. data/lib/vendor/xmpp4r/lib/xmpp4r/xmpp4r.rb +18 -0
  233. data/lib/vendor/xmpp4r/lib/xmpp4r/xmppelement.rb +168 -0
  234. data/lib/vendor/xmpp4r/lib/xmpp4r/xmppstanza.rb +162 -0
  235. data/lib/vendor/xmpp4r/setup.rb +1586 -0
  236. data/lib/vendor/xmpp4r/test/bytestreams/tc_ibb.rb +186 -0
  237. data/lib/vendor/xmpp4r/test/bytestreams/tc_socks5bytestreams.rb +113 -0
  238. data/lib/vendor/xmpp4r/test/caps/tc_helper.rb +156 -0
  239. data/lib/vendor/xmpp4r/test/dataforms/tc_data.rb +81 -0
  240. data/lib/vendor/xmpp4r/test/delay/tc_xdelay.rb +51 -0
  241. data/lib/vendor/xmpp4r/test/discovery/tc_responder.rb +91 -0
  242. data/lib/vendor/xmpp4r/test/lib/assert_equal_xml.rb +14 -0
  243. data/lib/vendor/xmpp4r/test/lib/clienttester.rb +120 -0
  244. data/lib/vendor/xmpp4r/test/muc/tc_muc_mucclient.rb +830 -0
  245. data/lib/vendor/xmpp4r/test/muc/tc_muc_simplemucclient.rb +114 -0
  246. data/lib/vendor/xmpp4r/test/muc/tc_mucowner.rb +50 -0
  247. data/lib/vendor/xmpp4r/test/pubsub/tc_helper.rb +662 -0
  248. data/lib/vendor/xmpp4r/test/pubsub/tc_nodeconfig.rb +54 -0
  249. data/lib/vendor/xmpp4r/test/pubsub/tc_subscriptionconfig.rb +41 -0
  250. data/lib/vendor/xmpp4r/test/roster/tc_helper.rb +514 -0
  251. data/lib/vendor/xmpp4r/test/roster/tc_iqqueryroster.rb +173 -0
  252. data/lib/vendor/xmpp4r/test/roster/tc_xroster.rb +73 -0
  253. data/lib/vendor/xmpp4r/test/rpc/tc_helper.rb +96 -0
  254. data/lib/vendor/xmpp4r/test/tc_callbacks.rb +129 -0
  255. data/lib/vendor/xmpp4r/test/tc_class_names.rb +146 -0
  256. data/lib/vendor/xmpp4r/test/tc_client.rb +30 -0
  257. data/lib/vendor/xmpp4r/test/tc_errors.rb +146 -0
  258. data/lib/vendor/xmpp4r/test/tc_idgenerator.rb +30 -0
  259. data/lib/vendor/xmpp4r/test/tc_iq.rb +113 -0
  260. data/lib/vendor/xmpp4r/test/tc_iqquery.rb +31 -0
  261. data/lib/vendor/xmpp4r/test/tc_jid.rb +204 -0
  262. data/lib/vendor/xmpp4r/test/tc_message.rb +116 -0
  263. data/lib/vendor/xmpp4r/test/tc_presence.rb +150 -0
  264. data/lib/vendor/xmpp4r/test/tc_rexml.rb +139 -0
  265. data/lib/vendor/xmpp4r/test/tc_stream.rb +229 -0
  266. data/lib/vendor/xmpp4r/test/tc_streamComponent.rb +95 -0
  267. data/lib/vendor/xmpp4r/test/tc_streamError.rb +131 -0
  268. data/lib/vendor/xmpp4r/test/tc_streamSend.rb +59 -0
  269. data/lib/vendor/xmpp4r/test/tc_streamparser.rb +112 -0
  270. data/lib/vendor/xmpp4r/test/tc_xmppstanza.rb +135 -0
  271. data/lib/vendor/xmpp4r/test/ts_xmpp4r.rb +53 -0
  272. data/lib/vendor/xmpp4r/test/tune/tc_helper_recv.rb +84 -0
  273. data/lib/vendor/xmpp4r/test/tune/tc_helper_send.rb +74 -0
  274. data/lib/vendor/xmpp4r/test/tune/tc_tune.rb +79 -0
  275. data/lib/vendor/xmpp4r/test/vcard/tc_helper.rb +49 -0
  276. data/lib/vendor/xmpp4r/test/vcard/tc_iqvcard.rb +62 -0
  277. data/lib/vendor/xmpp4r/test/version/tc_helper.rb +60 -0
  278. data/lib/vendor/xmpp4r/test/version/tc_iqqueryversion.rb +97 -0
  279. data/lib/vendor/xmpp4r/test/xhtml/tc_html.rb +41 -0
  280. data/lib/vendor/xmpp4r/tools/gen_requires.bash +31 -0
  281. data/lib/vendor/xmpp4r/tools/xmpp4r-gemspec-test.rb +11 -0
  282. data/lib/vendor/xmpp4r/xmpp4r.gemspec +291 -0
  283. data/test/jabber_publisher_test.rb +1 -1
  284. data/test/mail_publisher_test.rb +2 -2
  285. data/test/mock/twitter.rb +0 -1
  286. data/test/rspec_builder_test.rb +39 -2
  287. data/test/rss_publisher_test.rb +1 -1
  288. data/test/twitter_publisher_test.rb +1 -1
  289. metadata +268 -53
  290. data/lib/cerberus/publisher/gmailer.rb +0 -17
@@ -0,0 +1,59 @@
1
+ require File.join(File.dirname(__FILE__), '..', '..', 'spec_helper')
2
+
3
+ describe Hash, "#to_http_str" do
4
+ before(:each) do
5
+ @http_params = {:id => 'otherlogin', :since_id => 3953743, :full_name => 'Lucy Cross'}
6
+ @id_regexp = Regexp.new("id=#{CGI.escape(@http_params[:id].to_s)}")
7
+ @since_id_regexp = Regexp.new("since_id=#{CGI.escape(@http_params[:since_id].to_s)}")
8
+ @full_name_regexp = Regexp.new("full_name=Lucy\\+Cross")
9
+ end
10
+
11
+ it "should generate expected URL encoded string" do
12
+ http_str = @http_params.to_http_str
13
+ http_str.should match(@id_regexp)
14
+ http_str.should match(@since_id_regexp)
15
+ http_str.should match(@full_name_regexp)
16
+ end
17
+
18
+ after(:each) do
19
+ @http_params = nil
20
+ @id_kv_str, @since_id_kv_str, @full_name_kv_str = nil
21
+ end
22
+ end
23
+
24
+ describe Time, "#to_s" do
25
+ before(:each) do
26
+ @time = Time.now
27
+ @expected_string = @time.rfc2822
28
+ end
29
+
30
+ it "should output RFC2822 compliant string" do
31
+ time_string = @time.to_s
32
+ time_string.should eql(@expected_string)
33
+ end
34
+
35
+ it "should respond to #old_to_s" do
36
+ @time.should respond_to(:old_to_s)
37
+ end
38
+
39
+ after(:each) do
40
+ nilize(@time, @expected_string)
41
+ end
42
+ end
43
+
44
+ # TODO: figure out how to stub the gem method to do what we want rather than this monstrousity. It is dependent on the system installation, which is always a bad thing. For now it will do so we can ship with 100% C0 coverage.
45
+ describe Kernel, "#gem_present?" do
46
+ before(:each) do
47
+ @present_gem = "rake"
48
+ @uninstalled_gem = "uninstalled-gem-crap"
49
+ end
50
+
51
+ it "should return true when a gem isn't present on system" do
52
+ gem_present?(@present_gem).should eql(true)
53
+ end
54
+
55
+ it "should return false when a gem isn't present on system" do
56
+ gem_present?(@uninstalled_gem).should eql(false)
57
+ end
58
+ end
59
+
@@ -0,0 +1,46 @@
1
+ require File.join(File.dirname(__FILE__), '..', 'spec_helper')
2
+
3
+ describe Twitter::Client, "#featured(:users)" do
4
+ before(:each) do
5
+ @twitter = client_context
6
+ @uris = Twitter::Client.class_eval("@@FEATURED_URIS")
7
+ @request = mas_net_http_get(:basic_auth => nil)
8
+ @response = mas_net_http_response(:success)
9
+ @connection = mas_net_http(@response)
10
+ Net::HTTP.stub!(:new).and_return(@connection)
11
+ @users = [
12
+ Twitter::User.new(:screen_name => 'twitter4r'),
13
+ Twitter::User.new(:screen_name => 'dictionary'),
14
+ ]
15
+ Twitter::User.stub!(:unmarshal).and_return(@users)
16
+ end
17
+
18
+ it "should create expected HTTP GET request" do
19
+ @twitter.should_receive(:create_http_get_request).with(@uris[:users]).and_return(@request)
20
+ @twitter.featured(:users)
21
+ end
22
+
23
+ it "should bless Twitter::User models returned" do
24
+ @twitter.should_receive(:bless_models).with(@users).and_return(@users)
25
+ @twitter.featured(:users)
26
+ end
27
+
28
+ after(:each) do
29
+ nilize(@twitter, @uris, @request, @response, @connection)
30
+ end
31
+ end
32
+
33
+ describe Twitter::User, ".featured" do
34
+ before(:each) do
35
+ @twitter = client_context
36
+ end
37
+
38
+ it "should delegate #featured(:users) message to given client context" do
39
+ @twitter.should_receive(:featured).with(:users).and_return([])
40
+ Twitter::User.featured(@twitter)
41
+ end
42
+
43
+ after(:each) do
44
+ nilize(@twitter)
45
+ end
46
+ end
@@ -0,0 +1,90 @@
1
+ require File.join(File.dirname(__FILE__), '..', 'spec_helper')
2
+
3
+ def glob_files(*path_elements)
4
+ Dir.glob(File.join(*path_elements))
5
+ end
6
+
7
+ def load_erb_yaml(path, context)
8
+ ryaml = ERB.new(File.read(path), 0)
9
+ YAML.load(ryaml.result(context))
10
+ end
11
+
12
+ module ERBMetaMixin
13
+ # Needed to make the YAML load work...
14
+ def project_files
15
+ glob_files(@root_dir, 'lib', '**/*.rb')
16
+ end
17
+
18
+ # Needed to make the YAML load work...
19
+ def spec_files
20
+ glob_files(@root_dir, 'spec', '**/*_spec.rb')
21
+ end
22
+ end
23
+
24
+ describe "Twitter::Meta cache policy" do
25
+ include ERBMetaMixin
26
+ before(:each) do
27
+ @root_dir = project_root_dir
28
+ @meta = Twitter::Meta.new(@root_dir)
29
+ @expected_pkg_info = load_erb_yaml(File.join(@root_dir, 'pkg-info.yml'), binding)
30
+ @expected_project_files = project_files
31
+ @expected_spec_files = spec_files
32
+ end
33
+
34
+ it "should store value returned from project_files in @project_files after first glob" do
35
+ @meta.instance_eval("@project_files").should eql(nil)
36
+ @meta.project_files
37
+ @meta.instance_eval("@project_files").should eql(@expected_project_files)
38
+ @meta.project_files
39
+ @meta.instance_eval("@project_files").should eql(@expected_project_files)
40
+ end
41
+
42
+ it "should store value returned from spec_files in @spec_files after first glob" do
43
+ @meta.instance_eval("@spec_files").should eql(nil)
44
+ @meta.spec_files
45
+ @meta.instance_eval("@spec_files").should eql(@expected_spec_files)
46
+ @meta.spec_files
47
+ @meta.instance_eval("@spec_files").should eql(@expected_spec_files)
48
+ end
49
+ end
50
+
51
+ describe "Twitter::Meta" do
52
+ include ERBMetaMixin
53
+ before(:each) do
54
+ @root_dir = project_root_dir
55
+ @meta = Twitter::Meta.new(@root_dir)
56
+ @expected_yaml_hash = load_erb_yaml(File.join(@root_dir, 'pkg-info.yml'), binding)
57
+ @expected_project_files = project_files
58
+ @expected_spec_files = spec_files
59
+ end
60
+
61
+ it "should load and return YAML file into Hash object upon #pkg_info call" do
62
+ yaml_hash = @meta.pkg_info
63
+ yaml_hash.should.eql? @expected_yaml_hash
64
+ end
65
+
66
+ it "should return the embedded hash responding to key 'spec' of #pkg_info call upon #spec_info call" do
67
+ yaml_hash = @meta.spec_info
68
+ yaml_hash.should.eql? @expected_yaml_hash['spec']
69
+ end
70
+
71
+ it "should return list of files matching ROOT_DIR/lib/**/*.rb upon #project_files call" do
72
+ project_files = @meta.project_files
73
+ project_files.should.eql? @expected_project_files
74
+ end
75
+
76
+ it "should return list of files matching ROOT_DIR/spec/**/*.rb upon #spec_files call" do
77
+ spec_files = @meta.spec_files
78
+ spec_files.should.eql? @expected_spec_files
79
+ end
80
+
81
+ it "should return Gem specification based on YAML file contents and #project_files and #spec_files return values" do
82
+ spec = @meta.gem_spec
83
+ expected_spec_hash = @expected_yaml_hash['spec']
84
+ expected_spec_hash.each do |key, val|
85
+ unless val.is_a?(Hash)
86
+ spec.send(key).should.eql? expected_spec_hash[key]
87
+ end
88
+ end
89
+ end
90
+ end
@@ -0,0 +1,508 @@
1
+ require File.join(File.dirname(__FILE__), '..', 'spec_helper')
2
+
3
+ module Test
4
+ class Model
5
+ include Twitter::ModelMixin
6
+ end
7
+ end
8
+
9
+ describe Twitter::Status, "unmarshaling" do
10
+ before(:each) do
11
+ @json_hash = { "text" => "Thinking Zipcar is lame...",
12
+ "id" => 46672912,
13
+ "user" => {"name" => "Angie",
14
+ "description" => "TV junkie...",
15
+ "location" => "NoVA",
16
+ "profile_image_url" => "http:\/\/assets0.twitter.com\/system\/user\/profile_image\/5483072\/normal\/eye.jpg?1177462492",
17
+ "url" => nil,
18
+ "id" => 5483072,
19
+ "protected" => false,
20
+ "screen_name" => "ang_410"},
21
+ "created_at" => "Wed May 02 03:04:54 +0000 2007"}
22
+ @user = Twitter::User.new @json_hash["user"]
23
+ @status = Twitter::Status.new @json_hash
24
+ @status.user = @user
25
+ end
26
+
27
+ it "should respond to unmarshal class method" do
28
+ Twitter::Status.should respond_to(:unmarshal)
29
+ end
30
+
31
+ it "should return expected Twitter::Status object for singular case" do
32
+ status = Twitter::Status.unmarshal(JSON.unparse(@json_hash))
33
+ status.should_not be(nil)
34
+ status.should eql(@status)
35
+ end
36
+
37
+ it "should return expected array of Twitter::Status objects for plural case" do
38
+ statuses = Twitter::Status.unmarshal(JSON.unparse([@json_hash]))
39
+ statuses.should_not be(nil)
40
+ statuses.should have(1).entries
41
+ statuses.first.should eql(@status)
42
+ end
43
+ end
44
+
45
+ describe Twitter::User, "unmarshaling" do
46
+ before(:each) do
47
+ @json_hash = { "name" => "Lucy Snowe",
48
+ "description" => "School Mistress Entrepreneur",
49
+ "location" => "Villette",
50
+ "url" => "http://villetteschoolforgirls.com",
51
+ "id" => 859303,
52
+ "protected" => true,
53
+ "screen_name" => "LucyDominatrix", }
54
+ @user = Twitter::User.new @json_hash
55
+ end
56
+
57
+ it "should respond to unmarshal class method" do
58
+ Twitter::User.should respond_to(:unmarshal)
59
+ end
60
+
61
+ it "should return expected arry of Twitter::User objects for plural case" do
62
+ users = Twitter::User.unmarshal(JSON.unparse([@json_hash]))
63
+ users.should have(1).entries
64
+ users.first.should eql(@user)
65
+ end
66
+
67
+ it "should return expected Twitter::User object for singular case" do
68
+ user = Twitter::User.unmarshal(JSON.unparse(@json_hash))
69
+ user.should_not be(nil)
70
+ user.should eql(@user)
71
+ end
72
+ end
73
+
74
+ describe "Twitter::ModelMixin#to_hash" do
75
+ before(:all) do
76
+ class Model
77
+ include Twitter::ModelMixin
78
+ @@ATTRIBUTES = [:id, :name, :value, :unused_attr]
79
+ attr_accessor *@@ATTRIBUTES
80
+ def self.attributes; @@ATTRIBUTES; end
81
+ end
82
+
83
+ class Hash
84
+ def eql?(other)
85
+ return false unless other # trivial nil case.
86
+ return false unless self.keys.eql?(other.keys)
87
+ self.each do |key,val|
88
+ return false unless self[key].eql?(other[key])
89
+ end
90
+ true
91
+ end
92
+ end
93
+ end
94
+
95
+ before(:each) do
96
+ @attributes = {:id => 14, :name => 'State', :value => 'Illinois'}
97
+ @model = Model.new(@attributes)
98
+ end
99
+
100
+ it "should return expected hash representation of given model object" do
101
+ @model.to_hash.should eql(@attributes)
102
+ end
103
+
104
+ after(:each) do
105
+ nilize(@attributes, @model)
106
+ end
107
+ end
108
+
109
+ describe Twitter::User, ".find" do
110
+ before(:each) do
111
+ @twitter = Twitter::Client.from_config 'config/twitter.yml'
112
+ @id = 2423423
113
+ @screen_name = 'ascreenname'
114
+ @expected_user = Twitter::User.new(:id => @id, :screen_name => @screen_name)
115
+ end
116
+
117
+ it "should invoke given Twitter::Client's #user method with expected arguments" do
118
+ # case where id => @id
119
+ @twitter.should_receive(:user).with(@id).and_return(@expected_user)
120
+ user = Twitter::User.find(@id, @twitter)
121
+ user.should eql(@expected_user)
122
+
123
+ # case where id => @screen_name, which is also valid
124
+ @twitter.should_receive(:user).with(@screen_name).and_return(@expected_user)
125
+ user = Twitter::User.find(@screen_name, @twitter)
126
+ user.should eql(@expected_user)
127
+ end
128
+
129
+ after(:each) do
130
+ nilize(@twitter, @id, @screen_name, @expected_user)
131
+ end
132
+ end
133
+
134
+ describe Twitter::Status, ".find" do
135
+ before(:each) do
136
+ @twitter = Twitter::Client.from_config 'config/twitter.yml'
137
+ @id = 9439843
138
+ @text = 'My crummy status message'
139
+ @user = Twitter::User.new(:id => @id, :screen_name => @screen_name)
140
+ @expected_status = Twitter::Status.new(:id => @id, :text => @text, :user => @user)
141
+ end
142
+
143
+ it "should invoke given Twitter::Client's #status method with expected arguments" do
144
+ @twitter.should_receive(:status).with(:get, @id).and_return(@expected_status)
145
+ status = Twitter::Status.find(@id, @twitter)
146
+ status.should eql(@expected_status)
147
+ end
148
+
149
+ after(:each) do
150
+ nilize(@twitter, @id, @text, @user, @expected_status)
151
+ end
152
+ end
153
+
154
+ describe Test::Model, "#bless" do
155
+ before(:each) do
156
+ @twitter = Twitter::Client.from_config('config/twitter.yml')
157
+ @model = Test::Model.new
158
+ end
159
+
160
+ it "should delegate to #basic_bless" do
161
+ @model.should_receive(:basic_bless).and_return(@twitter)
162
+ @model.bless(@twitter)
163
+ end
164
+
165
+ it "should set client attribute of self" do
166
+ @model.should_receive(:client=).once
167
+ @model.bless(@twitter)
168
+ end
169
+
170
+ after(:each) do
171
+ nilize(@model, @twitter)
172
+ end
173
+ end
174
+
175
+ describe Twitter::User, "#is_me?" do
176
+ before(:each) do
177
+ @twitter = Twitter::Client.from_config('config/twitter.yml')
178
+ @user_not_me = Twitter::User.new(:screen_name => 'notmylogin')
179
+ @user_me = Twitter::User.new(:screen_name => @twitter.instance_eval("@login"))
180
+ @user_not_me.bless(@twitter)
181
+ @user_me.bless(@twitter)
182
+ end
183
+
184
+ it "should return true when Twitter::User object represents authenticated user of client context" do
185
+ @user_me.is_me?.should be_true
186
+ end
187
+
188
+ it "should return false when Twitter::User object does not represent authenticated user of client context" do
189
+ @user_not_me.is_me?.should be_false
190
+ end
191
+
192
+ after(:each) do
193
+ nilize(@twitter, @user_not_me, @user_me)
194
+ end
195
+ end
196
+
197
+ describe Twitter::User, "#friends" do
198
+ before(:each) do
199
+ @twitter = Twitter::Client.from_config('config/twitter.yml')
200
+ @id = 5701682
201
+ @user = Twitter::User.new(:id => @id, :screen_name => 'twitter4r')
202
+ @user.bless(@twitter)
203
+ end
204
+
205
+ it "should delegate to @client.user(@id, :friends)" do
206
+ @twitter.should_receive(:user).with(@id, :friends)
207
+ @user.friends
208
+ end
209
+
210
+ after(:each) do
211
+ nilize(@twitter, @id, @user)
212
+ end
213
+ end
214
+
215
+ describe Twitter::User, "#followers" do
216
+ before(:each) do
217
+ @twitter = Twitter::Client.from_config('config/twitter.yml')
218
+ @id = 5701682
219
+ @user = Twitter::User.new(:id => @id, :screen_name => 'twitter4r')
220
+ @user.bless(@twitter)
221
+ end
222
+
223
+ it "should delegate to @client.my(:followers)" do
224
+ @twitter.should_receive(:my).with(:followers, {})
225
+ @user.followers
226
+ end
227
+
228
+ after(:each) do
229
+ nilize(@twitter, @id, @user)
230
+ end
231
+ end
232
+
233
+ describe Test::Model, "#to_i" do
234
+ before(:each) do
235
+ @id = 234324285
236
+ class Test::Model
237
+ attr_accessor :id
238
+ end
239
+ @model = Test::Model.new(:id => @id)
240
+ end
241
+
242
+ it "should return @id attribute" do
243
+ @model.to_i.should eql(@id)
244
+ end
245
+
246
+ after(:each) do
247
+ nilize(@model, @id)
248
+ end
249
+ end
250
+
251
+ describe Test::Model, "#to_s" do
252
+ before(:each) do
253
+ class Test::Model
254
+ attr_accessor :text
255
+ end
256
+ @text = 'Some text for the message body here'
257
+ @model = Test::Model.new(:text => @text)
258
+ end
259
+
260
+ it "should return expected text when a @text attribute exists for the model" do
261
+ @model.to_s.should eql(@text)
262
+ end
263
+
264
+ after(:each) do
265
+ nilize(@model)
266
+ end
267
+ end
268
+
269
+ describe Twitter::Message, ".find" do
270
+ it "should raise NotImplementedError due to Twitter (as opposed to Twitter4R) API limitation" do
271
+ lambda {
272
+ Twitter::Message.find(123, nil)
273
+ }.should raise_error(NotImplementedError)
274
+ end
275
+ end
276
+
277
+ describe Twitter::Status, ".create" do
278
+ before(:each) do
279
+ @twitter = client_context
280
+ @text = 'My status update'
281
+ @status = Twitter::Status.new(:text => @text, :client => @twitter)
282
+ end
283
+
284
+ it "should invoke #status(:post, text) on client context given" do
285
+ @twitter.should_receive(:status).with(:post, @text).and_return(@status)
286
+ Twitter::Status.create(:text => @text, :client => @twitter)
287
+ end
288
+
289
+ it "should raise an ArgumentError when no client is given in params" do
290
+ lambda {
291
+ Twitter::Status.create(:text => @text)
292
+ }.should raise_error(ArgumentError)
293
+ end
294
+
295
+ it "should raise an ArgumentError when no text is given in params" do
296
+ @twitter.should_receive(:is_a?).with(Twitter::Client)
297
+ lambda {
298
+ Twitter::Status.create(:client => @twitter)
299
+ }.should raise_error(ArgumentError)
300
+ end
301
+
302
+ it "should raise an ArgumentError when text given in params is not a String" do
303
+ lambda {
304
+ Twitter::Status.create(:client => @twitter, :text => 234493)
305
+ }.should raise_error(ArgumentError)
306
+ end
307
+
308
+ it "should raise an ArgumentError when client context given in params is not a Twitter::Client object" do
309
+ lambda {
310
+ Twitter::Status.create(:client => 'a string instead of a Twitter::Client', :text => @text)
311
+ }.should raise_error(ArgumentError)
312
+ end
313
+
314
+ after(:each) do
315
+ nilize(@twitter, @text, @status)
316
+ end
317
+ end
318
+
319
+ describe Twitter::Message, ".create" do
320
+ before(:each) do
321
+ @twitter = client_context
322
+ @text = 'Just between you and I, Lantana and Gosford Park are two of my favorite movies'
323
+ @recipient = Twitter::User.new(:id => 234958)
324
+ @message = Twitter::Message.new(:text => @text, :recipient => @recipient)
325
+ end
326
+
327
+ it "should invoke #message(:post, text, recipient) on client context given" do
328
+ @twitter.should_receive(:message).with(:post, @text, @recipient).and_return(@message)
329
+ Twitter::Message.create(:client => @twitter, :text => @text, :recipient => @recipient)
330
+ end
331
+
332
+ it "should raise an ArgumentError if no client context is given in params" do
333
+ lambda {
334
+ Twitter::Message.create(:text => @text, :recipient => @recipient)
335
+ }.should raise_error(ArgumentError)
336
+ end
337
+
338
+ it "should raise an ArgumentError if client conext given in params is not a Twitter::Client object" do
339
+ lambda {
340
+ Twitter::Message.create(
341
+ :client => 3.14159,
342
+ :text => @text,
343
+ :recipient => @recipient)
344
+ }.should raise_error(ArgumentError)
345
+ end
346
+
347
+ it "should raise an ArgumentError if no text is given in params" do
348
+ @twitter.should_receive(:is_a?).with(Twitter::Client)
349
+ lambda {
350
+ Twitter::Message.create(
351
+ :client => @twitter,
352
+ :recipient => @recipient)
353
+ }.should raise_error(ArgumentError)
354
+ end
355
+
356
+ it "should raise an ArgumentError if text given in params is not a String" do
357
+ @twitter.should_receive(:is_a?).with(Twitter::Client)
358
+ lambda {
359
+ Twitter::Message.create(
360
+ :client => @twitter,
361
+ :text => Object.new,
362
+ :recipient => @recipient)
363
+ }.should raise_error(ArgumentError)
364
+ end
365
+
366
+ it "should raise an ArgumentError if no recipient is given in params" do
367
+ @text.should_receive(:is_a?).with(String)
368
+ lambda {
369
+ Twitter::Message.create(
370
+ :client => @twitter,
371
+ :text => @text)
372
+ }.should raise_error(ArgumentError)
373
+ end
374
+
375
+ it "should raise an ArgumentError if recipient given in params is not a Twitter::User, Integer or String object" do
376
+ @text.should_receive(:is_a?).with(String)
377
+ lambda {
378
+ Twitter::Message.create(
379
+ :client => @twitter,
380
+ :text => @text,
381
+ :recipient => 3.14159)
382
+ }.should raise_error(ArgumentError)
383
+ end
384
+
385
+ after(:each) do
386
+ nilize(@twitter, @text, @recipient, @message)
387
+ end
388
+ end
389
+
390
+ describe Twitter::User, "#befriend" do
391
+ before(:each) do
392
+ @twitter = client_context
393
+ @user = Twitter::User.new(
394
+ :id => 1234,
395
+ :screen_name => 'mylogin',
396
+ :client => @twitter)
397
+ @friend = Twitter::User.new(
398
+ :id => 5678,
399
+ :screen_name => 'friend',
400
+ :client => @twitter)
401
+ end
402
+
403
+ it "should invoke #friend(:add, user) on client context" do
404
+ @twitter.should_receive(:friend).with(:add, @friend).and_return(@friend)
405
+ @user.befriend(@friend)
406
+ end
407
+
408
+ after(:each) do
409
+ nilize(@twitter, @user, @friend)
410
+ end
411
+ end
412
+
413
+ describe Twitter::User, "#defriend" do
414
+ before(:each) do
415
+ @twitter = client_context
416
+ @user = Twitter::User.new(
417
+ :id => 1234,
418
+ :screen_name => 'mylogin',
419
+ :client => @twitter)
420
+ @friend = Twitter::User.new(
421
+ :id => 5678,
422
+ :screen_name => 'friend',
423
+ :client => @twitter)
424
+ end
425
+
426
+ it "should invoke #friend(:remove, user) on client context" do
427
+ @twitter.should_receive(:friend).with(:remove, @friend).and_return(@friend)
428
+ @user.defriend(@friend)
429
+ end
430
+
431
+ after(:each) do
432
+ nilize(@twitter, @user, @friend)
433
+ end
434
+ end
435
+
436
+ describe Twitter::Status, "#reply?" do
437
+ before(:each) do
438
+ @status = Twitter::Status.new(
439
+ :id => 123456789,
440
+ :text => "Wazzup?",
441
+ :user => mock(Twitter::User)
442
+ )
443
+ @reply = Twitter::Status.new(
444
+ :text => "No much bro. You?",
445
+ :user => mock(Twitter::User),
446
+ :in_reply_to_status_id => @status.id
447
+ )
448
+ end
449
+
450
+ it "should return false for the original status" do
451
+ @status.reply?.should be(false)
452
+ end
453
+
454
+ it "should return true for the reply to the original status" do
455
+ @reply.reply?.should be(true)
456
+ end
457
+ end
458
+
459
+ describe Twitter::Status, "#reply(status_text)" do
460
+ before(:each) do
461
+ @twitter = client_context
462
+ @status = Twitter::Status.new(
463
+ :id => 1234,
464
+ :text => "The status text",
465
+ :client => @twitter)
466
+ @reply_text = "Reply text goes here"
467
+ @reply_status = Twitter::Status.new()
468
+ end
469
+
470
+ it "should invoke #status(:reply, :status => ..., :in_reply_to_status_id => ...) on client context" do
471
+ @twitter.should_receive(:status).with(:reply, :status => @reply_text, :in_reply_to_status_id => @status.id).and_return(@reply_status)
472
+ @status.reply(@reply_text)
473
+ end
474
+
475
+ after(:each) do
476
+ nilize(@twitter, @status)
477
+ end
478
+ end
479
+
480
+ describe Twitter::Status, "#to_s" do
481
+ before(:each) do
482
+ @text = 'Aloha'
483
+ @status = Twitter::Status.new(:text => @text)
484
+ end
485
+
486
+ it "should render text attribute" do
487
+ @status.to_s.should be(@text)
488
+ end
489
+
490
+ after(:each) do
491
+ nilize(@text, @status)
492
+ end
493
+ end
494
+
495
+ describe Twitter::Message, "#to_s" do
496
+ before(:each) do
497
+ @text = 'Aloha'
498
+ @message = Twitter::Message.new(:text => @text)
499
+ end
500
+
501
+ it "should render text attribute" do
502
+ @message.to_s.should be(@text)
503
+ end
504
+
505
+ after(:each) do
506
+ nilize(@text, @message)
507
+ end
508
+ end