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,19 @@
1
+ # version.rb contains <tt>Twitter::Version</tt> that provides helper
2
+ # methods related to versioning of the <tt>Twitter4R</tt> project.
3
+
4
+ module Twitter::Version #:nodoc:
5
+ MAJOR = 0
6
+ MINOR = 3
7
+ REVISION = 1
8
+ class << self
9
+ # Returns X.Y.Z formatted version string
10
+ def to_version
11
+ "#{MAJOR}.#{MINOR}.#{REVISION}"
12
+ end
13
+
14
+ # Returns X-Y-Z formatted version name
15
+ def to_name
16
+ "#{MAJOR}_#{MINOR}_#{REVISION}"
17
+ end
18
+ end
19
+ end
@@ -0,0 +1,28 @@
1
+ require File.join(File.dirname(__FILE__), '..', '..', 'spec_helper')
2
+
3
+ describe Twitter::Client, "#account_info" do
4
+ before(:each) do
5
+ @uri = Twitter::Client.class_eval("@@ACCOUNT_URIS[:rate_limit_status]")
6
+ @request = mas_net_http_get(:basic_auth => nil)
7
+ @twitter = client_context
8
+ @default_header = @twitter.send(:http_header)
9
+ @response = mas_net_http_response(:success)
10
+ @connection = mas_net_http(@response)
11
+ @response.stub!(:body).and_return("{}")
12
+ Net::HTTP.stub!(:new).and_return(@connection)
13
+ @rate_limit_status = mock(Twitter::RateLimitStatus)
14
+ @twitter.stub!(:bless_models).and_return({})
15
+ end
16
+
17
+ it "should create expected HTTP GET request" do
18
+ @twitter.should_receive(:create_http_get_request).with(@uri).and_return(@request)
19
+ @twitter.account_info
20
+ end
21
+
22
+ it "should raise Twitter::RESTError when 500 HTTP response received when giving page options" do
23
+ @connection = mas_net_http(mas_net_http_response(:server_error))
24
+ lambda {
25
+ @twitter.account_info
26
+ }.should raise_error(Twitter::RESTError)
27
+ end
28
+ end
@@ -0,0 +1,34 @@
1
+ require File.join(File.dirname(__FILE__), '..', '..', 'spec_helper')
2
+
3
+ describe Twitter::Client, "#authenticate?" do
4
+ before(:each) do
5
+ @uri = '/account/verify_credentials.json'
6
+ @request = mas_net_http_get(:basic_auth => nil)
7
+ @twitter = client_context
8
+ @default_header = @twitter.send(:http_header)
9
+ @response = mas_net_http_response(:success)
10
+ @error_response = mas_net_http_response(404, "Resource Not Found")
11
+ @connection = mas_net_http(@response)
12
+ Net::HTTP.stub!(:new).and_return(@connection)
13
+ @login = "applestillsucks"
14
+ @password = "linuxstillrocks"
15
+ end
16
+
17
+ it "creates expected HTTP GET request" do
18
+ @twitter.should_receive(:create_http_get_request).with(@uri).and_return(@request)
19
+ @twitter.authenticate?(@login, @password)
20
+ end
21
+
22
+ it "should return true if HTTP response is 20X" do
23
+ @twitter.authenticate?(@login, @password).should be(true)
24
+ end
25
+
26
+ it "should return false if HTTP response is not 20X" do
27
+ Net::HTTP.stub!(:new).and_return(mas_net_http(@error_response))
28
+ @twitter.authenticate?(@login, @password).should be(false)
29
+ end
30
+
31
+ after(:each) do
32
+ nilize(@uri, @request, @twitter, @default_header, @response, @error_response, @connection, @login, @password)
33
+ end
34
+ end
@@ -0,0 +1,242 @@
1
+ require File.join(File.dirname(__FILE__), '..', '..', 'spec_helper')
2
+
3
+ describe "Twitter::Client" do
4
+ before(:each) do
5
+ @init_hash = { :login => 'user', :password => 'pass' }
6
+ end
7
+
8
+ it ".new should accept login and password as initializer hash keys and set the values to instance values" do
9
+ client = nil
10
+ lambda do
11
+ client = Twitter::Client.new(@init_hash)
12
+ end.should_not raise_error
13
+ client.send(:login).should eql(@init_hash[:login])
14
+ client.send(:password).should eql(@init_hash[:password])
15
+ end
16
+ end
17
+
18
+ describe Twitter::Client, "#inspect" do
19
+ before(:each) do
20
+ @client = Twitter::Client.new(:login => "NippleEquality", :password => "3rdnipple")
21
+ end
22
+
23
+ it "should block out password attribute values" do
24
+ @client.inspect.should_not match(/@password="3rdnipple"/)
25
+ end
26
+ end
27
+
28
+ describe Twitter::Client, "#http_header" do
29
+ before(:each) do
30
+ @user_agent = 'myapp'
31
+ @application_name = @user_agent
32
+ @application_version = '1.2.3'
33
+ @application_url = 'http://myapp.url'
34
+ Twitter::Client.configure do |conf|
35
+ conf.user_agent = @user_agent
36
+ conf.application_name = @application_name
37
+ conf.application_version = @application_version
38
+ conf.application_url = @application_url
39
+ end
40
+ @expected_headers = {
41
+ 'Accept' => 'text/x-json',
42
+ 'X-Twitter-Client' => @application_name,
43
+ 'X-Twitter-Client-Version' => @application_version,
44
+ 'X-Twitter-Client-URL' => @application_url,
45
+ 'User-Agent' => "Twitter4R v#{Twitter::Version.to_version} [#{@user_agent}]",
46
+ }
47
+ @twitter = client_context
48
+ # reset @@http_header class variable in Twitter::Client class
49
+ Twitter::Client.class_eval("@@http_header = nil")
50
+ end
51
+
52
+ it "should always return expected HTTP headers" do
53
+ headers = @twitter.send(:http_header)
54
+ headers.should === @expected_headers
55
+ end
56
+
57
+ it "should cache HTTP headers Hash in class variable after first invocation" do
58
+ cache = Twitter::Client.class_eval("@@http_header")
59
+ cache.should be_nil
60
+ @twitter.send(:http_header)
61
+ cache = Twitter::Client.class_eval("@@http_header")
62
+ cache.should_not be_nil
63
+ cache.should === @expected_headers
64
+ end
65
+
66
+ after(:each) do
67
+ nilize(@user_agent, @application_name, @application_version, @application_url, @twitter, @expected_headers)
68
+ end
69
+ end
70
+
71
+ describe Twitter::Client, "#create_http_get_request" do
72
+ before(:each) do
73
+ @uri = '/some/path'
74
+ @expected_get_request = mock(Net::HTTP::Get)
75
+ @twitter = client_context
76
+ @default_header = @twitter.send(:http_header)
77
+ end
78
+
79
+ it "should create new Net::HTTP::Get object with expected initialization arguments" do
80
+ Net::HTTP::Get.should_receive(:new).with(@uri, @default_header).and_return(@expected_get_request)
81
+ @twitter.send(:create_http_get_request, @uri)
82
+ end
83
+
84
+ after(:each) do
85
+ nilize(@twitter, @uri, @expected_get_request, @default_header)
86
+ end
87
+ end
88
+
89
+ describe Twitter::Client, "#create_http_post_request" do
90
+ before(:each) do
91
+ @uri = '/some/path'
92
+ @expected_post_request = mock(Net::HTTP::Post)
93
+ @twitter = client_context
94
+ @default_header = @twitter.send(:http_header)
95
+ end
96
+
97
+ it "should create new Net::HTTP::Post object with expected initialization arguments" do
98
+ Net::HTTP::Post.should_receive(:new).with(@uri, @default_header).and_return(@expected_post_request)
99
+ @twitter.send(:create_http_post_request, @uri)
100
+ end
101
+
102
+ after(:each) do
103
+ nilize(@twitter, @uri, @expected_post_request, @default_header)
104
+ end
105
+ end
106
+
107
+ describe Twitter::Client, "#create_http_delete_request" do
108
+ before(:each) do
109
+ @uri = '/a/stupid/path/that/is/not/restful/since/twitter.com/cannot/do/consistent/restful/apis'
110
+ @expected_delete_request = mock(Net::HTTP::Delete)
111
+ @twitter = client_context
112
+ @default_header = @twitter.send(:http_header)
113
+ end
114
+
115
+ it "should create new Net::HTTP::Delete object with expected initialization arguments" do
116
+ Net::HTTP::Delete.should_receive(:new).with(@uri, @default_header).and_return(@expected_delete_request)
117
+ @twitter.send(:create_http_delete_request, @uri)
118
+ end
119
+
120
+ after(:each) do
121
+ nilize(@twitter, @uri, @expected_delete_request, @default_header)
122
+ end
123
+ end
124
+
125
+ describe Twitter::Client, "#http_connect" do
126
+ before(:each) do
127
+ @request = mas_net_http_get(:basic_auth => nil)
128
+ @good_response = mas_net_http_response(:success)
129
+ @bad_response = mas_net_http_response(:server_error)
130
+ @http_stubs = {:is_a? => true}
131
+ @block = Proc.new do |conn|
132
+ conn.is_a?(Net::HTTP).should be(true)
133
+ @has_yielded = true
134
+ @request
135
+ end
136
+ @twitter = client_context
137
+ @has_yielded = false
138
+ end
139
+
140
+ def generate_bad_response
141
+ @http = mas_net_http(@bad_response, @http_stubs)
142
+ Net::HTTP.stub!(:new).and_return(@http)
143
+ end
144
+
145
+ def generate_good_response
146
+ @http = mas_net_http(@good_response, @http_stubs)
147
+ Net::HTTP.stub!(:new).and_return(@http)
148
+ end
149
+
150
+ it "should yield HTTP connection when response is good" do
151
+ generate_good_response
152
+ @http.should_receive(:is_a?).with(Net::HTTP).and_return(true)
153
+ lambda do
154
+ @twitter.send(:http_connect, &@block)
155
+ end.should_not raise_error
156
+ @has_yielded.should be(true)
157
+ end
158
+
159
+ it "should yield HTTP connection when response is bad" do
160
+ generate_bad_response
161
+ @http.should_receive(:is_a?).with(Net::HTTP).and_return(true)
162
+ lambda {
163
+ @twitter.send(:http_connect, &@block)
164
+ }.should raise_error(Twitter::RESTError)
165
+ @has_yielded.should be(true)
166
+ end
167
+
168
+ after(:each) do
169
+ nilize(@good_response, @bad_response, @http)
170
+ end
171
+ end
172
+
173
+ describe Twitter::Client, "#bless_model" do
174
+ before(:each) do
175
+ @twitter = client_context
176
+ @model = Twitter::User.new
177
+ end
178
+
179
+ it "should recieve #client= message on given model to self" do
180
+ @model.should_receive(:client=).with(@twitter)
181
+ model = @twitter.send(:bless_model, @model)
182
+ end
183
+
184
+ it "should set client attribute on given model to self" do
185
+ model = @twitter.send(:bless_model, @model)
186
+ model.client.should eql(@twitter)
187
+ end
188
+
189
+ # if model is nil, it doesn't not necessarily signify an exceptional case for this method's usage.
190
+ it "should return nil when receiving nil and not raise any exceptions" do
191
+ model = @twitter.send(:bless_model, nil)
192
+ model.should be_nil
193
+ end
194
+
195
+ # needed to alert developer that the model needs to respond to #client= messages appropriately.
196
+ it "should raise an error if passing in a non-nil object that doesn't not respond to the :client= message" do
197
+ lambda {
198
+ @twitter.send(:bless_model, Object.new)
199
+ }.should raise_error(NoMethodError)
200
+ end
201
+
202
+ after(:each) do
203
+ nilize(@twitter)
204
+ end
205
+ end
206
+
207
+ describe Twitter::Client, "#bless_models" do
208
+ before(:each) do
209
+ @twitter = client_context
210
+ @models = [
211
+ Twitter::Status.new(:text => 'message #1'),
212
+ Twitter::Status.new(:text => 'message #2'),
213
+ ]
214
+ end
215
+
216
+ it "should set client attributes for each model in given Array to self" do
217
+ models = @twitter.send(:bless_models, @models)
218
+ models.each {|model| model.client.should eql(@twitter) }
219
+ end
220
+
221
+ it "should set client attribute for singular model given to self" do
222
+ model = @twitter.send(:bless_models, @models[0])
223
+ model.client.should eql(@twitter)
224
+ end
225
+
226
+ it "should delegate to bless_model for singular model case" do
227
+ model = @models[0]
228
+ @twitter.should_receive(:bless_model).with(model).and_return(model)
229
+ @twitter.send(:bless_models, model)
230
+ end
231
+
232
+ it "should return nil when receiving nil and not raise any exceptions" do
233
+ lambda {
234
+ value = @twitter.send(:bless_models, nil)
235
+ value.should be_nil
236
+ }.should_not raise_error
237
+ end
238
+
239
+ after(:each) do
240
+ nilize(@twitter, @models)
241
+ end
242
+ end
@@ -0,0 +1,76 @@
1
+ require File.join(File.dirname(__FILE__), '..', '..', 'spec_helper')
2
+
3
+ describe Twitter::Client, "#block" do
4
+ before(:each) do
5
+ @twitter = client_context
6
+ @id = 1234567
7
+ @screen_name = 'dummylogin'
8
+ @friend = Twitter::User.new(:id => @id, :screen_name => @screen_name)
9
+ @uris = Twitter::Client.class_eval("@@BLOCK_URIS")
10
+ @request = mas_net_http_get(:basic_auth => nil)
11
+ @response = mas_net_http_response(:success)
12
+ @connection = mas_net_http(@response)
13
+ Net::HTTP.stub!(:new).and_return(@connection)
14
+ Twitter::User.stub!(:unmarshal).and_return(@friend)
15
+ end
16
+
17
+ def create_uri(action, id)
18
+ "#{@uris[action]}/#{id}.json"
19
+ end
20
+
21
+ it "should create expected HTTP GET request for :add case using integer user ID" do
22
+ # the integer user ID scenario...
23
+ @twitter.should_receive(:create_http_get_request).with(create_uri(:add, @id)).and_return(@request)
24
+ @twitter.block(:add, @id)
25
+ end
26
+
27
+ it "should create expected HTTP GET request for :add case using screen name" do
28
+ # the screen name scenario...
29
+ @twitter.should_receive(:create_http_get_request).with(create_uri(:add, @screen_name)).and_return(@request)
30
+ @twitter.block(:add, @screen_name)
31
+ end
32
+
33
+ it "should create expected HTTP GET request for :add case using Twitter::User object" do
34
+ # the Twitter::User object scenario...
35
+ @twitter.should_receive(:create_http_get_request).with(create_uri(:add, @friend.to_i)).and_return(@request)
36
+ @twitter.block(:add, @friend)
37
+ end
38
+
39
+ it "should create expected HTTP GET request for :remove case using integer user ID" do
40
+ # the integer user ID scenario...
41
+ @twitter.should_receive(:create_http_get_request).with(create_uri(:remove, @id)).and_return(@request)
42
+ @twitter.block(:remove, @id)
43
+ end
44
+
45
+ it "should create expected HTTP GET request for :remove case using screen name" do
46
+ # the screen name scenario...
47
+ @twitter.should_receive(:create_http_get_request).with(create_uri(:remove, @screen_name)).and_return(@request)
48
+ @twitter.block(:remove, @screen_name)
49
+ end
50
+
51
+ it "should create expected HTTP GET request for :remove case using Twitter::User object" do
52
+ # the Twitter::User object scenario...
53
+ @twitter.should_receive(:create_http_get_request).with(create_uri(:remove, @friend.to_i)).and_return(@request)
54
+ @twitter.block(:remove, @friend)
55
+ end
56
+
57
+ it "should bless user model returned for :add case" do
58
+ @twitter.should_receive(:bless_model).with(@friend)
59
+ @twitter.block(:add, @friend)
60
+ end
61
+
62
+ it "should bless user model returned for :remove case" do
63
+ @twitter.should_receive(:bless_model).with(@friend)
64
+ @twitter.block(:remove, @friend)
65
+ end
66
+
67
+ it "should raise ArgumentError if action given is not valid" do
68
+ lambda {
69
+ @twitter.block(:crap, @friend)
70
+ }.should raise_error(ArgumentError)
71
+ end
72
+
73
+ after(:each) do
74
+ nilize(@twitter, @id, @uris, @request, @response, @connection)
75
+ end
76
+ end
@@ -0,0 +1,183 @@
1
+ require File.join(File.dirname(__FILE__), '..', '..', 'spec_helper')
2
+
3
+ describe Twitter::Client, "#favorites" do
4
+ before(:each) do
5
+ @uri = '/favorites.json'
6
+ @request = mas_net_http_get(:basic_auth => nil)
7
+ @twitter = client_context
8
+ @default_header = @twitter.send(:http_header)
9
+ @response = mas_net_http_response(:success)
10
+ @connection = mas_net_http(@response)
11
+ @options = { :page => 4 }
12
+ Net::HTTP.stub!(:new).and_return(@connection)
13
+ @favorites = []
14
+ Twitter::Status.stub!(:unmarshal).and_return(@favorites)
15
+ end
16
+
17
+ it "should create expected HTTP GET request when not giving options" do
18
+ @twitter.should_receive(:create_http_get_request).with(@uri).and_return(@request)
19
+ @twitter.favorites
20
+ end
21
+
22
+ it "should create expected HTTP GET request when giving :page options" do
23
+ @twitter.should_receive(:create_http_get_request).with("#{@uri}?#{@options.to_http_str}").and_return(@request)
24
+ @twitter.favorites(@options)
25
+ end
26
+
27
+ it "should raise Twitter::RESTError when 401 HTTP response received without giving options" do
28
+ @connection = mas_net_http(mas_net_http_response(:not_authorized))
29
+ lambda {
30
+ @twitter.favorites
31
+ }.should raise_error(Twitter::RESTError)
32
+ end
33
+
34
+ it "should raise Twitter::RESTError when 401 HTTP response received when giving page options" do
35
+ @connection = mas_net_http(mas_net_http_response(:not_authorized))
36
+ lambda {
37
+ @twitter.favorites(@options)
38
+ }.should raise_error(Twitter::RESTError)
39
+ end
40
+
41
+ it "should raise Twitter::RESTError when 403 HTTP response received without giving options" do
42
+ @connection = mas_net_http(mas_net_http_response(:forbidden))
43
+ lambda {
44
+ @twitter.favorites
45
+ }.should raise_error(Twitter::RESTError)
46
+ end
47
+
48
+ it "should raise Twitter::RESTError when 403 HTTP response received when giving page options" do
49
+ @connection = mas_net_http(mas_net_http_response(:forbidden))
50
+ lambda {
51
+ @twitter.favorites(@options)
52
+ }.should raise_error(Twitter::RESTError)
53
+ end
54
+
55
+ it "should raise Twitter::RESTError when 500 HTTP response received without giving options" do
56
+ @connection = mas_net_http(mas_net_http_response(:server_error))
57
+ lambda {
58
+ @twitter.favorites
59
+ }.should raise_error(Twitter::RESTError)
60
+ end
61
+
62
+ it "should raise Twitter::RESTError when 500 HTTP response received when giving page options" do
63
+ @connection = mas_net_http(mas_net_http_response(:server_error))
64
+ lambda {
65
+ @twitter.favorites(@options)
66
+ }.should raise_error(Twitter::RESTError)
67
+ end
68
+
69
+ after(:each) do
70
+ nilize(@uri, @request, @twitter, @default_header, @response, @error_response, @connection)
71
+ end
72
+ end
73
+
74
+ module FavoriteSpecMixin
75
+ def init
76
+ @base_uri = '/favourings'
77
+ @request = mas_net_http_get(:basic_auth => nil)
78
+ @twitter = client_context
79
+ @default_header = @twitter.send(:http_header)
80
+ @response = mas_net_http_response(:success)
81
+ @connection = mas_net_http(@response)
82
+ Net::HTTP.stub!(:new).and_return(@connection)
83
+ @id = 234923423
84
+ @status = mas_twitter_status(:id => @id, :to_i => @id)
85
+ Twitter::Status.stub!(:unmarshal).and_return(@status)
86
+ end
87
+
88
+ def create_uri(method, id)
89
+ "#{@base_uri}/#{method.to_s}/#{id.to_i.to_s}.json"
90
+ end
91
+
92
+ def connection=(connection)
93
+ @connection = connection
94
+ end
95
+
96
+ def finalize
97
+ nilize(@uri, @request, @twitter, @default_header, @response, @error_response, @connection)
98
+ end
99
+ end
100
+
101
+ describe "Twitter::Client#favorite error handling", :shared => true do
102
+ it "should raise a Twitter::RESTError exception when a 401 HTTP response is received" do
103
+ connection = mas_net_http(mas_net_http_response(:not_authorized))
104
+ lambda {
105
+ execute_method
106
+ }.should raise_error(Twitter::RESTError)
107
+ end
108
+
109
+ it "should raise a Twitter::RESTError exception when a 403 HTTP response is received" do
110
+ connection = mas_net_http(mas_net_http_response(:forbidden))
111
+ lambda {
112
+ execute_method
113
+ }.should raise_error(Twitter::RESTError)
114
+ end
115
+
116
+ it "should raise a Twitter::RESTError exception when a 404 HTTP response is received" do
117
+ connection = mas_net_http(mas_net_http_response(:file_not_found))
118
+ lambda {
119
+ execute_method
120
+ }.should raise_error(Twitter::RESTError)
121
+ end
122
+
123
+ it "should raise a Twitter::RESTError exception when a 500 HTTP response is received" do
124
+ connection = mas_net_http(mas_net_http_response(:server_error))
125
+ lambda {
126
+ execute_method
127
+ }.should raise_error(Twitter::RESTError)
128
+ end
129
+ end
130
+
131
+ describe Twitter::Client, "#favorite(:add, status)" do
132
+ include FavoriteSpecMixin
133
+ it_should_behave_like "Twitter::Client#favorite error handling"
134
+
135
+ before(:each) do
136
+ init
137
+ end
138
+
139
+ def execute_method
140
+ @twitter.favorite(:add, @id)
141
+ end
142
+
143
+ it "should create expected POST request for :add action supplying integer id of status" do
144
+ @twitter.should_receive(:create_http_post_request).with(create_uri(:create, @id)).and_return(@request)
145
+ @twitter.favorite(:add, @id)
146
+ end
147
+
148
+ it "should create expected POST request for :add action supplying status object" do
149
+ @twitter.should_receive(:create_http_post_request).with(create_uri(:create, @id)).and_return(@request)
150
+ @twitter.favorite(:add, @status)
151
+ end
152
+
153
+ after(:each) do
154
+ finalize
155
+ end
156
+ end
157
+
158
+ describe Twitter::Client, "#favorite(:remove, status)" do
159
+ include FavoriteSpecMixin
160
+ it_should_behave_like "Twitter::Client#favorite error handling"
161
+
162
+ before(:each) do
163
+ init
164
+ end
165
+
166
+ def execute_method
167
+ @twitter.favorite(:remove, @id)
168
+ end
169
+
170
+ it "should create expected DELETE request for :remove action supplying integer id of status" do
171
+ @twitter.should_receive(:create_http_delete_request).with(create_uri(:destroy, @id)).and_return(@request)
172
+ @twitter.favorite(:remove, @id)
173
+ end
174
+
175
+ it "should create expected DELETE request for :remove action supplying status object" do
176
+ @twitter.should_receive(:create_http_delete_request).with(create_uri(:destroy, @id)).and_return(@request)
177
+ @twitter.favorite(:remove, @status)
178
+ end
179
+
180
+ after(:each) do
181
+ finalize
182
+ end
183
+ end