merb 0.5.3 → 0.9.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (294) hide show
  1. data/LICENSE +0 -20
  2. data/README +0 -277
  3. data/Rakefile +80 -199
  4. data/TODO +0 -3
  5. metadata +19 -438
  6. data/SVN_REVISION +0 -1
  7. data/app_generators/merb/USAGE +0 -5
  8. data/app_generators/merb/merb_generator.rb +0 -108
  9. data/app_generators/merb/templates/Rakefile +0 -124
  10. data/app_generators/merb/templates/app/controllers/application.rb +0 -3
  11. data/app_generators/merb/templates/app/controllers/exceptions.rb +0 -13
  12. data/app_generators/merb/templates/app/helpers/global_helper.rb +0 -5
  13. data/app_generators/merb/templates/app/mailers/views/layout/application.html.erb +0 -1
  14. data/app_generators/merb/templates/app/mailers/views/layout/application.text.erb +0 -1
  15. data/app_generators/merb/templates/app/parts/views/layout/application.html.erb +0 -1
  16. data/app_generators/merb/templates/app/views/exceptions/internal_server_error.html.erb +0 -216
  17. data/app_generators/merb/templates/app/views/exceptions/not_acceptable.html.erb +0 -38
  18. data/app_generators/merb/templates/app/views/exceptions/not_found.html.erb +0 -40
  19. data/app_generators/merb/templates/app/views/layout/application.html.erb +0 -11
  20. data/app_generators/merb/templates/config/boot.rb +0 -11
  21. data/app_generators/merb/templates/config/dependencies.rb +0 -41
  22. data/app_generators/merb/templates/config/environments/development.rb +0 -1
  23. data/app_generators/merb/templates/config/environments/production.rb +0 -1
  24. data/app_generators/merb/templates/config/environments/test.rb +0 -1
  25. data/app_generators/merb/templates/config/merb.yml +0 -82
  26. data/app_generators/merb/templates/config/merb_init.rb +0 -17
  27. data/app_generators/merb/templates/config/plugins.yml +0 -1
  28. data/app_generators/merb/templates/config/router.rb +0 -35
  29. data/app_generators/merb/templates/config/upload.conf +0 -0
  30. data/app_generators/merb/templates/public/images/merb.jpg +0 -0
  31. data/app_generators/merb/templates/public/merb.fcgi +0 -6
  32. data/app_generators/merb/templates/public/stylesheets/master.css +0 -119
  33. data/app_generators/merb/templates/script/destroy +0 -32
  34. data/app_generators/merb/templates/script/generate +0 -32
  35. data/app_generators/merb/templates/script/stop_merb +0 -13
  36. data/app_generators/merb/templates/script/win_script.cmd +0 -1
  37. data/app_generators/merb/templates/spec/spec.opts +0 -6
  38. data/app_generators/merb/templates/spec/spec_helper.rb +0 -15
  39. data/app_generators/merb/templates/test/test_helper.rb +0 -14
  40. data/app_generators/merb_plugin/USAGE +0 -5
  41. data/app_generators/merb_plugin/merb_plugin_generator.rb +0 -68
  42. data/app_generators/merb_plugin/templates/LICENSE +0 -20
  43. data/app_generators/merb_plugin/templates/README +0 -4
  44. data/app_generators/merb_plugin/templates/Rakefile +0 -35
  45. data/app_generators/merb_plugin/templates/TODO +0 -5
  46. data/app_generators/merb_plugin/templates/merbtasks.rb +0 -6
  47. data/app_generators/merb_plugin/templates/sampleplugin.rb +0 -10
  48. data/app_generators/merb_plugin/templates/sampleplugin_spec.rb +0 -7
  49. data/app_generators/merb_plugin/templates/spec_helper.rb +0 -2
  50. data/bin/merb +0 -4
  51. data/lib/autotest/discover.rb +0 -3
  52. data/lib/autotest/merb_rspec.rb +0 -80
  53. data/lib/merb.rb +0 -188
  54. data/lib/merb/abstract_controller.rb +0 -399
  55. data/lib/merb/assets.rb +0 -160
  56. data/lib/merb/assets.rb.orig +0 -119
  57. data/lib/merb/boot_loader.rb +0 -286
  58. data/lib/merb/boot_loader.rb.orig +0 -235
  59. data/lib/merb/caching.rb +0 -5
  60. data/lib/merb/caching/action_cache.rb +0 -92
  61. data/lib/merb/caching/fragment_cache.rb +0 -39
  62. data/lib/merb/caching/store/file_cache.rb +0 -90
  63. data/lib/merb/caching/store/memory_cache.rb +0 -85
  64. data/lib/merb/config.rb +0 -290
  65. data/lib/merb/constants.rb +0 -50
  66. data/lib/merb/controller.rb +0 -220
  67. data/lib/merb/cookies.rb +0 -95
  68. data/lib/merb/core_ext.rb +0 -15
  69. data/lib/merb/core_ext/array.rb +0 -0
  70. data/lib/merb/core_ext/class.rb +0 -180
  71. data/lib/merb/core_ext/enumerable.rb +0 -49
  72. data/lib/merb/core_ext/get_args.rb +0 -76
  73. data/lib/merb/core_ext/hash.rb +0 -306
  74. data/lib/merb/core_ext/inflections.rb +0 -112
  75. data/lib/merb/core_ext/inflector.rb +0 -275
  76. data/lib/merb/core_ext/kernel.rb +0 -242
  77. data/lib/merb/core_ext/mash.rb +0 -88
  78. data/lib/merb/core_ext/module.rb +0 -67
  79. data/lib/merb/core_ext/numeric.rb +0 -72
  80. data/lib/merb/core_ext/object.rb +0 -183
  81. data/lib/merb/core_ext/string.rb +0 -53
  82. data/lib/merb/core_ext/symbol.rb +0 -6
  83. data/lib/merb/dispatcher.rb +0 -109
  84. data/lib/merb/drb_server.rb +0 -19
  85. data/lib/merb/erubis_ext.rb +0 -10
  86. data/lib/merb/exceptions.rb +0 -192
  87. data/lib/merb/generators/merb_app/merb_app.rb +0 -22
  88. data/lib/merb/generators/merb_generator_helpers.rb +0 -318
  89. data/lib/merb/generators/merb_plugin.rb +0 -22
  90. data/lib/merb/logger.rb +0 -78
  91. data/lib/merb/mail_controller.rb +0 -268
  92. data/lib/merb/mailer.rb +0 -87
  93. data/lib/merb/mixins/basic_authentication.rb +0 -35
  94. data/lib/merb/mixins/controller.rb +0 -160
  95. data/lib/merb/mixins/erubis_capture.rb +0 -68
  96. data/lib/merb/mixins/general_controller.rb +0 -253
  97. data/lib/merb/mixins/inline_partial.rb +0 -32
  98. data/lib/merb/mixins/render.rb +0 -465
  99. data/lib/merb/mixins/responder.rb +0 -449
  100. data/lib/merb/mixins/view_context.rb +0 -558
  101. data/lib/merb/mixins/web_controller.rb +0 -36
  102. data/lib/merb/mongrel_handler.rb +0 -168
  103. data/lib/merb/part_controller.rb +0 -29
  104. data/lib/merb/plugins.rb +0 -16
  105. data/lib/merb/rack_adapter.rb +0 -37
  106. data/lib/merb/request.rb +0 -465
  107. data/lib/merb/router.rb +0 -646
  108. data/lib/merb/server.rb +0 -169
  109. data/lib/merb/session.rb +0 -23
  110. data/lib/merb/session/cookie_store.rb +0 -118
  111. data/lib/merb/session/mem_cache_session.rb +0 -131
  112. data/lib/merb/session/memory_session.rb +0 -176
  113. data/lib/merb/template.rb +0 -37
  114. data/lib/merb/template/erubis.rb +0 -68
  115. data/lib/merb/template/haml.rb +0 -87
  116. data/lib/merb/template/markaby.rb +0 -59
  117. data/lib/merb/template/xml_builder.rb +0 -50
  118. data/lib/merb/test/fake_request.rb +0 -74
  119. data/lib/merb/test/helper.rb +0 -260
  120. data/lib/merb/test/hpricot.rb +0 -136
  121. data/lib/merb/test/multipart.rb +0 -66
  122. data/lib/merb/test/rspec.rb +0 -18
  123. data/lib/merb/test/rspec_matchers/controller_matchers.rb +0 -117
  124. data/lib/merb/test/rspec_matchers/markup_matchers.rb +0 -98
  125. data/lib/merb/upload_handler.rb +0 -80
  126. data/lib/merb/upload_progress.rb +0 -48
  127. data/lib/merb/version.rb +0 -49
  128. data/lib/merb/view_context.rb +0 -79
  129. data/lib/tasks.rb +0 -7
  130. data/lib/tasks/merb.rake +0 -54
  131. data/merb_default_generators/model/USAGE +0 -0
  132. data/merb_default_generators/model/model_generator.rb +0 -16
  133. data/merb_default_generators/model/templates/new_model_template.erb +0 -5
  134. data/merb_default_generators/resource_controller/USAGE +0 -0
  135. data/merb_default_generators/resource_controller/resource_controller_generator.rb +0 -26
  136. data/merb_default_generators/resource_controller/templates/controller.rb +0 -30
  137. data/merb_default_generators/resource_controller/templates/edit.html.erb +0 -1
  138. data/merb_default_generators/resource_controller/templates/helper.rb +0 -5
  139. data/merb_default_generators/resource_controller/templates/index.html.erb +0 -1
  140. data/merb_default_generators/resource_controller/templates/new.html.erb +0 -1
  141. data/merb_default_generators/resource_controller/templates/show.html.erb +0 -1
  142. data/merb_generators/controller/USAGE +0 -5
  143. data/merb_generators/controller/controller_generator.rb +0 -16
  144. data/merb_generators/controller/templates/controller.rb +0 -8
  145. data/merb_generators/controller/templates/helper.rb +0 -5
  146. data/merb_generators/controller/templates/index.html.erb +0 -3
  147. data/merb_generators/part_controller/USAGE +0 -5
  148. data/merb_generators/part_controller/part_controller_generator.rb +0 -27
  149. data/merb_generators/part_controller/templates/controller.rb +0 -8
  150. data/merb_generators/part_controller/templates/helper.rb +0 -5
  151. data/merb_generators/part_controller/templates/index.html.erb +0 -3
  152. data/merb_generators/resource/USAGE +0 -0
  153. data/merb_generators/resource/resource_generator.rb +0 -67
  154. data/rspec_generators/merb_controller_test/merb_controller_test_generator.rb +0 -67
  155. data/rspec_generators/merb_controller_test/templates/controller_spec.rb +0 -8
  156. data/rspec_generators/merb_controller_test/templates/edit_spec.rb +0 -12
  157. data/rspec_generators/merb_controller_test/templates/helper_spec.rb +0 -5
  158. data/rspec_generators/merb_controller_test/templates/index_spec.rb +0 -12
  159. data/rspec_generators/merb_controller_test/templates/new_spec.rb +0 -12
  160. data/rspec_generators/merb_controller_test/templates/show_spec.rb +0 -5
  161. data/rspec_generators/merb_model_test/merb_model_test_generator.rb +0 -26
  162. data/rspec_generators/merb_model_test/templates/model_spec_template.erb +0 -7
  163. data/script/destroy +0 -14
  164. data/script/generate +0 -14
  165. data/spec/fixtures/config/environments/environment_config_test.yml +0 -1
  166. data/spec/fixtures/config/merb.yml +0 -18
  167. data/spec/fixtures/controllers/dispatch_spec_controllers.rb +0 -235
  168. data/spec/fixtures/controllers/render_spec_controllers.rb +0 -184
  169. data/spec/fixtures/foo.rb +0 -3
  170. data/spec/fixtures/mailers/views/layout/application.html.erb +0 -3
  171. data/spec/fixtures/mailers/views/layout/application.text.erb +0 -3
  172. data/spec/fixtures/mailers/views/test_mail_controller/eighth.html.erb +0 -1
  173. data/spec/fixtures/mailers/views/test_mail_controller/eighth.text.erb +0 -1
  174. data/spec/fixtures/mailers/views/test_mail_controller/first.html.erb +0 -1
  175. data/spec/fixtures/mailers/views/test_mail_controller/first.text.erb +0 -1
  176. data/spec/fixtures/mailers/views/test_mail_controller/ninth.html.erb +0 -1
  177. data/spec/fixtures/mailers/views/test_mail_controller/ninth.text.erb +0 -1
  178. data/spec/fixtures/mailers/views/test_mail_controller/second.text.erb +0 -1
  179. data/spec/fixtures/mailers/views/test_mail_controller/third.html.erb +0 -1
  180. data/spec/fixtures/models/router_spec_models.rb +0 -30
  181. data/spec/fixtures/parts/views/layout/todo_part.html.erb +0 -3
  182. data/spec/fixtures/parts/views/layout/todo_part.xml.erb +0 -3
  183. data/spec/fixtures/parts/views/todo_part/formatted_output.html.erb +0 -1
  184. data/spec/fixtures/parts/views/todo_part/formatted_output.js.erb +0 -1
  185. data/spec/fixtures/parts/views/todo_part/formatted_output.xml.erb +0 -1
  186. data/spec/fixtures/parts/views/todo_part/list.html.erb +0 -3
  187. data/spec/fixtures/sample.txt +0 -1
  188. data/spec/fixtures/views/erubis.html.erb +0 -1
  189. data/spec/fixtures/views/examples/_erubis.html.erb +0 -1
  190. data/spec/fixtures/views/examples/_haml.html.haml +0 -1
  191. data/spec/fixtures/views/examples/_markaby.html.mab +0 -1
  192. data/spec/fixtures/views/examples/_throw_content.html.erb +0 -6
  193. data/spec/fixtures/views/examples/hello.xml.builder +0 -1
  194. data/spec/fixtures/views/examples/js.js.erb +0 -1
  195. data/spec/fixtures/views/examples/template_catch_content.html.erb +0 -15
  196. data/spec/fixtures/views/examples/template_catch_content_from_partial.html.erb +0 -6
  197. data/spec/fixtures/views/examples/template_throw_content.html.erb +0 -10
  198. data/spec/fixtures/views/examples/template_throw_content_without_block.html.erb +0 -3
  199. data/spec/fixtures/views/exceptions/admin_access_required.html.erb +0 -1
  200. data/spec/fixtures/views/extension_template_controller/_nested_js.js.erb +0 -1
  201. data/spec/fixtures/views/extension_template_controller/_nested_xml.xml.erb +0 -1
  202. data/spec/fixtures/views/extension_template_controller/_render_partial_multiple_times.html.erb +0 -1
  203. data/spec/fixtures/views/extension_template_controller/erubis_templates.html.erb +0 -1
  204. data/spec/fixtures/views/extension_template_controller/erubis_templates.js.erb +0 -1
  205. data/spec/fixtures/views/extension_template_controller/erubis_templates.rhtml +0 -1
  206. data/spec/fixtures/views/extension_template_controller/erubis_templates.xml.erb +0 -1
  207. data/spec/fixtures/views/extension_template_controller/haml_index.html.haml +0 -0
  208. data/spec/fixtures/views/extension_template_controller/haml_templates.html.haml +0 -1
  209. data/spec/fixtures/views/extension_template_controller/haml_templates.js.haml +0 -1
  210. data/spec/fixtures/views/extension_template_controller/haml_templates.xml.haml +0 -1
  211. data/spec/fixtures/views/extension_template_controller/index.html.erb +0 -0
  212. data/spec/fixtures/views/extension_template_controller/markaby_index.html.mab +0 -0
  213. data/spec/fixtures/views/extension_template_controller/markaby_templates.html.mab +0 -1
  214. data/spec/fixtures/views/extension_template_controller/markaby_templates.js.mab +0 -1
  215. data/spec/fixtures/views/extension_template_controller/markaby_templates.xml.mab +0 -1
  216. data/spec/fixtures/views/extension_template_controller/render_multiple_partials.html.erb +0 -4
  217. data/spec/fixtures/views/extension_template_controller/render_nested_js.js.erb +0 -1
  218. data/spec/fixtures/views/extension_template_controller/render_nested_xml.xml.erb +0 -1
  219. data/spec/fixtures/views/haml.html.haml +0 -1
  220. data/spec/fixtures/views/haml.xml.haml +0 -2
  221. data/spec/fixtures/views/layout/application.html.erb +0 -1
  222. data/spec/fixtures/views/layout/application.xml.erb +0 -1
  223. data/spec/fixtures/views/layout/nested/example.html.erb +0 -1
  224. data/spec/fixtures/views/markaby.html.mab +0 -1
  225. data/spec/fixtures/views/nested/example/test.html.erb +0 -1
  226. data/spec/fixtures/views/partials/_erubis.html.erb +0 -1
  227. data/spec/fixtures/views/partials/_erubis_collection.html.erb +0 -1
  228. data/spec/fixtures/views/partials/_erubis_collection_with_locals.html.erb +0 -1
  229. data/spec/fixtures/views/partials/_erubis_new.html.erb +0 -1
  230. data/spec/fixtures/views/partials/_haml.html.haml +0 -1
  231. data/spec/fixtures/views/partials/_haml_collection.html.haml +0 -1
  232. data/spec/fixtures/views/partials/_haml_collection_with_locals.html.haml +0 -1
  233. data/spec/fixtures/views/partials/_haml_new.html.haml +0 -1
  234. data/spec/fixtures/views/partials/_markaby.html.mab +0 -1
  235. data/spec/fixtures/views/partials/_markaby_collection.html.mab +0 -1
  236. data/spec/fixtures/views/partials/_markaby_collection_with_locals.html.mab +0 -1
  237. data/spec/fixtures/views/partials/_markaby_new.html.mab +0 -1
  238. data/spec/fixtures/views/render_object_controller/render_object_with_template.html.erb +0 -1
  239. data/spec/fixtures/views/render_object_controller/render_object_with_template.js.erb +0 -1
  240. data/spec/fixtures/views/render_object_controller/render_object_with_template.xml.erb +0 -1
  241. data/spec/fixtures/views/template_views/interface__buffer_erubis.html.erb +0 -4
  242. data/spec/fixtures/views/template_views/interface__buffer_haml.html.haml +0 -7
  243. data/spec/fixtures/views/template_views/interface__buffer_markaby.html.mab +0 -7
  244. data/spec/fixtures/views/template_views/interface_capture_erubis.html.erb +0 -15
  245. data/spec/fixtures/views/template_views/interface_capture_haml.html.haml +0 -15
  246. data/spec/fixtures/views/template_views/interface_capture_markaby.html.mab +0 -4
  247. data/spec/fixtures/views/template_views/interface_concat_erubis.html.erb +0 -12
  248. data/spec/fixtures/views/template_views/interface_concat_haml.html.haml +0 -11
  249. data/spec/fixtures/views/template_views/interface_concat_markaby.html.mab +0 -14
  250. data/spec/fixtures/views/test.dir/the_template.html.erb +0 -1
  251. data/spec/merb/abstract_controller_spec.rb +0 -38
  252. data/spec/merb/assets_spec.rb +0 -207
  253. data/spec/merb/caching_spec.rb +0 -102
  254. data/spec/merb/config_spec.rb +0 -29
  255. data/spec/merb/controller_filters_spec.rb +0 -253
  256. data/spec/merb/controller_spec.rb +0 -126
  257. data/spec/merb/cookie_store_spec.rb +0 -72
  258. data/spec/merb/cookies_spec.rb +0 -96
  259. data/spec/merb/core_ext/class_spec.rb +0 -97
  260. data/spec/merb/core_ext/enumerable_spec.rb +0 -27
  261. data/spec/merb/core_ext/hash_spec.rb +0 -251
  262. data/spec/merb/core_ext/inflector_spec.rb +0 -34
  263. data/spec/merb/core_ext/kernel_spec.rb +0 -25
  264. data/spec/merb/core_ext/numeric_spec.rb +0 -26
  265. data/spec/merb/core_ext/object_spec.rb +0 -47
  266. data/spec/merb/core_ext/string_spec.rb +0 -22
  267. data/spec/merb/core_ext/symbol_spec.rb +0 -7
  268. data/spec/merb/dependency_spec.rb +0 -22
  269. data/spec/merb/dispatch_spec.rb +0 -528
  270. data/spec/merb/fake_request_spec.rb +0 -80
  271. data/spec/merb/generator_spec.rb +0 -248
  272. data/spec/merb/handler_spec.rb +0 -169
  273. data/spec/merb/mail_controller_spec.rb +0 -177
  274. data/spec/merb/mailer_spec.rb +0 -87
  275. data/spec/merb/multipart_spec.rb +0 -50
  276. data/spec/merb/part_controller_spec.rb +0 -124
  277. data/spec/merb/plugins_spec.rb +0 -80
  278. data/spec/merb/render_spec.rb +0 -469
  279. data/spec/merb/request_spec.rb +0 -287
  280. data/spec/merb/responder_spec.rb +0 -562
  281. data/spec/merb/router_spec.rb +0 -900
  282. data/spec/merb/server_spec.rb +0 -19
  283. data/spec/merb/template_spec.rb +0 -41
  284. data/spec/merb/upload_handler_spec.rb +0 -108
  285. data/spec/merb/version_spec.rb +0 -33
  286. data/spec/merb/view_context_spec.rb +0 -366
  287. data/spec/spec_generator_helper.rb +0 -34
  288. data/spec/spec_helper.rb +0 -101
  289. data/spec/spec_helpers/url_shared_behaviour.rb +0 -112
  290. data/test_unit_generators/merb_controller_test/merb_controller_test_generator.rb +0 -53
  291. data/test_unit_generators/merb_controller_test/templates/functional_test.rb +0 -17
  292. data/test_unit_generators/merb_controller_test/templates/helper_test.rb +0 -9
  293. data/test_unit_generators/merb_model_test/merb_model_test_generator.rb +0 -29
  294. data/test_unit_generators/merb_model_test/templates/model_test_unit_template.erb +0 -9
@@ -1,177 +0,0 @@
1
- require File.dirname(__FILE__) + '/../spec_helper'
2
-
3
- module Merb
4
- class MailController
5
- self._template_root = File.expand_path(File.join(File.dirname(__FILE__), '..', "fixtures/mailers/views"))
6
- end
7
- end
8
- Merb::BootLoader.load_controller_template_path_cache
9
- Merb::BootLoader.load_inline_helpers
10
-
11
- class Merb::Mailer
12
- self.delivery_method = :test_send
13
- end
14
-
15
- class TestMailController < Merb::MailController
16
-
17
- def first
18
- render_mail
19
- end
20
-
21
- def second
22
- render_mail
23
- end
24
-
25
- def third
26
- render_mail :text => :first, :html => :third
27
- end
28
-
29
- def fourth
30
- render_mail :text => "FOURTH_TEXT", :html => "FOURTH_HTML"
31
- end
32
-
33
- def fifth
34
- render_mail :action => {:text => :first, :html => :third}
35
- end
36
-
37
- def sixth
38
- render_mail :action => {:text => :first}, :html => "SIXTH_HTML"
39
- end
40
-
41
- def seventh
42
- render_mail :text => :first, :html => "SEVENTH_HTML"
43
- end
44
-
45
- def eighth
46
- @testing = "TEST"
47
- render_mail
48
- end
49
-
50
- def ninth
51
- render_mail
52
- end
53
-
54
- def tenth
55
- render_mail
56
- end
57
-
58
- end
59
-
60
- class TestController < Merb::Controller
61
-
62
- def one
63
- send_mail TestMailController, :ninth, {:from => "foo@bar.com", :to => "foo@bar.com"}, {:x => "ONE_CONTROLLER"}
64
- end
65
-
66
- end
67
-
68
- describe "A Merb Mail controller" do
69
-
70
- def deliver(action)
71
- TestMailController.dispatch_and_deliver action, :from => "foo@bar.com", :to => "foo@bar.com"
72
- @delivery = Merb::Mailer.deliveries.last
73
- end
74
-
75
- undef :call_action if defined?(call_action)
76
- def call_action(action)
77
- @c = new_controller(action, TestController)
78
- @c.dispatch(action)
79
- @delivery = Merb::Mailer.deliveries.last
80
- end
81
-
82
- it "should render files in its directory by default" do
83
- deliver :first
84
- @delivery.text.should == "TEXT\nFIRST\nENDTEXT"
85
- end
86
-
87
- it "should render files in its directory without a mimetype extension by default" do
88
- deliver :second
89
- @delivery.text.should == "TEXT\nSECOND\nENDTEXT"
90
- end
91
-
92
- it "should be able to accept a :text => :sym, :html => :sym render_mail" do
93
- deliver :third
94
- @delivery.text.should == "TEXT\nFIRST\nENDTEXT"
95
- @delivery.html.should == "BASIC\nTHIRDHTML\nLAYOUT"
96
- end
97
-
98
- it "should be able to accept a :text => STRING, :html => STRING render_mail" do
99
- deliver :fourth
100
- @delivery.text.should == "FOURTH_TEXT"
101
- @delivery.html.should == "FOURTH_HTML"
102
- end
103
-
104
- it "should be able to accept an :action => {:text => :sym, :html => :sym}" do
105
- deliver :fifth
106
- @delivery.text.should == "TEXT\nFIRST\nENDTEXT"
107
- @delivery.html.should == "BASIC\nTHIRDHTML\nLAYOUT"
108
- end
109
-
110
- it "should be able to accept a mix of action and :html => STRING" do
111
- deliver :sixth
112
- @delivery.text.should == "TEXT\nFIRST\nENDTEXT"
113
- @delivery.html.should == "SIXTH_HTML"
114
- end
115
-
116
- it "should be able to accept a mix of :text => :sym and :html => STRING" do
117
- deliver :seventh
118
- @delivery.text.should == "TEXT\nFIRST\nENDTEXT"
119
- @delivery.html.should == "SEVENTH_HTML"
120
- end
121
-
122
- it "should hold onto instance variables" do
123
- deliver :eighth
124
- @delivery.html.should == "BASIC\nTEST\nLAYOUT"
125
- end
126
-
127
- it "should have access to the params sent by the calling controller" do
128
- @in = Merb::Test::FakeRequest.new
129
- @res = StringIO.new
130
- call_action :one
131
- @delivery.html.should == "BASIC\nONE_CONTROLLER\nLAYOUT"
132
- end
133
-
134
- it "should not raise an error if there are no templates" do
135
- lambda do
136
- deliver :tenth
137
- end.should_not raise_error
138
- end
139
-
140
- it "should log an error if there are no templates available" do
141
- Merb.logger.should_receive(:error).once
142
- deliver :tenth
143
- end
144
-
145
- end
146
-
147
- describe "Merb::MailController with url generation" do
148
-
149
- it_should_behave_like "class with general url generation"
150
- it_should_behave_like "non routeable controller with url mixin"
151
-
152
- def new_url_controller(route, params = {:action => 'show', :controller => 'Test'})
153
- request = OpenStruct.new
154
- request.route = route
155
- request.params = params
156
- response = OpenStruct.new
157
- response.read = ""
158
-
159
- @controller = Merb::Controller.build(request, response)
160
- TestMailController.new(params, @controller)
161
- end
162
-
163
- it "should raise an error if no controller is specified and the base controller is not set" do
164
- c = new_url_controller(@default_route, {})
165
- lambda do
166
- the_url = c.url(:action => "bar")
167
- end.should raise_error
168
- end
169
-
170
- it "should use the base controller when it is set to generate a url when no :controller option is specified" do
171
- c = new_url_controller(@defualt_route, :controller => "foo")
172
- lambda do
173
- the_url = c.url(:action => "bar")
174
- the_url.should == "/foo/bar"
175
- end.should_not raise_error
176
- end
177
- end
@@ -1,87 +0,0 @@
1
- require File.dirname(__FILE__) + '/../spec_helper'
2
-
3
- class TestMailer < Merb::Mailer
4
- self.delivery_method = :test_send
5
- end
6
-
7
- class TestSMTPMailer < Merb::Mailer
8
- self.delivery_method = :net_smtp
9
- self.config = { :host => 'smtp.yourserver.com',
10
- :port => '25',
11
- :user => 'user',
12
- :pass => 'pass',
13
- :auth => :plain }
14
-
15
- end
16
-
17
- class TestSendmailMailer < Merb::Mailer
18
- self.delivery_method = :sendmail
19
- end
20
-
21
- def setup_test_mailer klass = TestMailer
22
- @m = klass.new :to => "test@test.com",
23
- :from => "foo@bar.com",
24
- :subject => "Test Subject",
25
- :body => "Test"
26
- end
27
-
28
- describe "a merb mailer" do
29
-
30
- it "should be able to send test emails" do
31
- setup_test_mailer
32
- @m.deliver!
33
- TestMailer.deliveries.size.should == 1
34
- delivery = TestMailer.deliveries.last
35
- delivery.to.should include("test@test.com")
36
- delivery.from.should include("foo@bar.com")
37
- delivery.subject.should include("Test Subject")
38
- delivery.body.should include("Test")
39
- end
40
-
41
- it "should be able to accept attachments" do
42
- setup_test_mailer
43
- @m.attach File.open("README")
44
- @m.deliver!
45
- delivery = TestMailer.deliveries.last
46
- delivery.instance_variable_get("@attachments").size.should == 1
47
- end
48
-
49
- it "should be able to accept multiple attachments" do
50
- setup_test_mailer
51
- @m.attach [[File.open("README")], [File.open("LICENSE")]]
52
- @m.deliver!
53
- delivery = TestMailer.deliveries.last
54
- delivery.instance_variable_get("@attachments").size.should == 2
55
- end
56
-
57
- it "should be able to send mails via SMTP" do
58
- setup_test_mailer TestSMTPMailer
59
- Net::SMTP.stub!(:start).and_return(true)
60
- Net::SMTP.should_receive(:start).with("smtp.yourserver.com", 25, nil, "user", "pass", :plain)
61
- @m.deliver!
62
- end
63
-
64
- it "should send mails via SMTP with no auth" do
65
- setup_test_mailer TestSMTPMailer
66
- @m.config[:auth] = nil
67
- Net::SMTP.stub!(:start).and_return(true)
68
- Net::SMTP.should_receive(:start).with("smtp.yourserver.com", 25, nil, "user", "pass", nil)
69
- @m.deliver!
70
- end
71
-
72
- it "should be able to send mails via sendmail" do
73
- sendmail = mock("/usr/sbin/sendmail", :null_object => true)
74
- setup_test_mailer TestSendmailMailer
75
- IO.should_receive(:popen).with("/usr/sbin/sendmail #{@m.mail.to}", "w+").and_return(sendmail)
76
- @m.deliver!
77
- end
78
-
79
- it "should be able to use a different sendmail path" do
80
- sendmail = mock("/somewhere/sendmail", :null_object => true)
81
- setup_test_mailer TestSendmailMailer
82
- @m.config[:sendmail_path] = '/somewhere/sendmail'
83
- IO.should_receive(:popen).with("/somewhere/sendmail #{@m.mail.to}", "w+").and_return(sendmail)
84
- @m.deliver!
85
- end
86
-
87
- end
@@ -1,50 +0,0 @@
1
- require File.dirname(__FILE__) + '/../spec_helper'
2
-
3
- describe Merb::Test::Multipart::Param, '.to_multipart' do
4
- it "should represent the key and value correctly" do
5
- param = Merb::Test::Multipart::Param.new('foo', 'bar')
6
- param.to_multipart.should == %(Content-Disposition: form-data; name="foo"\r\n\r\nbar\r\n)
7
- end
8
- end
9
-
10
- describe Merb::Test::Multipart::FileParam, '.to_multipart' do
11
- it "should represent the key, filename and content correctly" do
12
- param = Merb::Test::Multipart::FileParam.new('foo', '/bar.txt', 'baz')
13
- param.to_multipart.should == %(Content-Disposition: form-data; name="foo"; filename="/bar.txt"\r\nContent-Type: text/plain\r\n\r\nbaz\r\n)
14
- end
15
- end
16
-
17
- describe Merb::Test::Multipart::Post, '.push_params(params) param parsing' do
18
- before(:each) do
19
- @fake_return_param = mock('fake return_param')
20
- end
21
-
22
- it "should create Param from params when param doesn't respond to read" do
23
- params = { 'normal' => 'normal_param' }
24
- Merb::Test::Multipart::Param.should_receive(:new).with('normal', 'normal_param').and_return(@fake_return_param)
25
- Merb::Test::Multipart::Post.new.push_params(params)
26
- end
27
-
28
- it "should create FileParam from params when param does response to read" do
29
- file_param = mock('file param')
30
- file_param.should_receive(:read).and_return('file contents')
31
- file_param.should_receive(:path).and_return('file.txt')
32
- params = { 'file' => file_param }
33
- Merb::Test::Multipart::FileParam.should_receive(:new).with('file', 'file.txt', 'file contents').and_return(@fake_return_param)
34
- Merb::Test::Multipart::Post.new.push_params(params)
35
- end
36
- end
37
-
38
- describe Merb::Test::Multipart::Post, '.to_multipart' do
39
- it "should create a multipart request from the params" do
40
- file_param = mock('file param')
41
- file_param.should_receive(:read).and_return('file contents')
42
- file_param.should_receive(:path).and_return('file.txt')
43
- params = { 'file' => file_param, 'normal' => 'normal_param' }
44
- multipart = Merb::Test::Multipart::Post.new(params)
45
- query, content_type = multipart.to_multipart
46
- content_type.should == "multipart/form-data, boundary=----------0xKhTmLbOuNdArY"
47
- query.should == "------------0xKhTmLbOuNdArY\r\nContent-Disposition: form-data; name=\"file\"; filename=\"file.txt\"\r\nContent-Type: text/plain\r\n\r\nfile contents\r\n------------0xKhTmLbOuNdArY\r\nContent-Disposition: form-data; name=\"normal\"\r\n\r\nnormal_param\r\n------------0xKhTmLbOuNdArY--"
48
- end
49
- end
50
-
@@ -1,124 +0,0 @@
1
- require File.dirname(__FILE__) + '/../spec_helper'
2
- Merb::Template::Erubis # Need to initialise the Erubis template
3
-
4
- class Main < Merb::Controller
5
-
6
- def index
7
- part TodoPart => :list
8
- end
9
-
10
- def index2
11
- part TodoPart => :one
12
- end
13
-
14
- def index3
15
- part(TodoPart => :one) + part(TodoPart => :list)
16
- end
17
-
18
- def index4
19
- provides [:xml, :js]
20
- part(TodoPart => :formatted_output)
21
- end
22
-
23
- end
24
-
25
-
26
- class TodoPart < Merb::PartController
27
- self._template_root = File.expand_path(File.join(File.dirname(__FILE__), '..', "fixtures/parts/views"))
28
-
29
- before :load_todos
30
-
31
- def list
32
- render
33
- end
34
-
35
- def one
36
- render :layout => :none, :action => :list
37
- end
38
-
39
- def load_todos
40
- @todos = ["Do this", "Do that", 'Do the other thing']
41
- end
42
-
43
- def formatted_output
44
- render
45
- end
46
-
47
- end
48
-
49
- describe "A Merb PartController" do
50
-
51
- before(:each) do
52
- Merb::Router.prepare do |r|
53
- r.default_routes
54
- end
55
- end
56
-
57
- it "should render a part template with no layout" do
58
- controller,action = request(:get, '/main/index2')
59
- controller.body.should ==
60
- "TODOPART\nDo this|Do that|Do the other thing\nTODOPART"
61
- end
62
-
63
- it "should render a part template with it's own layout" do
64
- controller,_ = request(:get, '/main/index')
65
- controller.body.should ==
66
- "TODOLAYOUT\nTODOPART\nDo this|Do that|Do the other thing\nTODOPART\nTODOLAYOUT"
67
- end
68
-
69
- it "should render multiple parts if more then one part is passed in" do
70
- controller,_ = request(:get, '/main/index3')
71
- controller.body.should ==
72
- "TODOPART\nDo this|Do that|Do the other thing\nTODOPART" +
73
- "TODOLAYOUT\nTODOPART\nDo this|Do that|Do the other thing\nTODOPART\nTODOLAYOUT"
74
- end
75
-
76
- it "should render the html format by default to the controller that set it" do
77
- controller,_ = request(:get, '/main/index4')
78
- controller.body.should match(/part_html_format/m)
79
-
80
- end
81
-
82
- it "should render the xml format according to the controller" do
83
- controller,_ = request(:get, '/main/index4.xml')
84
- controller.body.should match(/part_xml_format/m)
85
- end
86
-
87
- it "should render the xml format according to the controller" do
88
- controller,_ = request(:get, '/main/index4.js')
89
- controller.body.should match(/part_js_format/m)
90
- end
91
-
92
- end
93
-
94
- describe "A Merb Part Controller with urls" do
95
-
96
- it_should_behave_like "class with general url generation"
97
- it_should_behave_like "non routeable controller with url mixin"
98
-
99
- def new_url_controller(route, params = {:action => 'show', :controller => 'Test'})
100
- request = OpenStruct.new
101
- request.route = route
102
- request.params = params
103
- response = OpenStruct.new
104
- response.read = ""
105
-
106
- @controller = Merb::Controller.build(request, response)
107
- TodoPart.new(@controller)
108
- end
109
-
110
- it "should use the web_controllers type if no controller is specified" do
111
- c = new_url_controller(@default_route, :controller => "my_controller")
112
- the_url = c.url(:action => "bar")
113
- the_url.should == "/my_controller/bar"
114
- end
115
-
116
- it "should raise an error if the web_controller's params[:controller] is not set" do
117
- c = new_url_controller(@default_route, {})
118
- lambda do
119
- the_url = c.url(:action => "bar")
120
- the_url.should == "/my_controller/bar"
121
- end.should raise_error
122
- end
123
-
124
- end
@@ -1,80 +0,0 @@
1
- require File.dirname(__FILE__) + '/../spec_helper'
2
-
3
- describe "Plugins", "default GENERATOR_SCOPE" do
4
- it "should have :merb_default first" do
5
- Merb::GENERATOR_SCOPE.first.should == :merb_default
6
- end
7
-
8
- it "should have :merb" do
9
- Merb::GENERATOR_SCOPE.should include(:merb)
10
- end
11
-
12
- it "should have :rspec last" do
13
- Merb::GENERATOR_SCOPE.last.should == :rspec
14
- end
15
- end
16
-
17
- describe "Plugins","use_orm" do
18
- before(:each) do
19
- Merb::GENERATOR_SCOPE.replace [:merb_default, :merb, :rspec]
20
- Kernel.stub!(:dependency)
21
- end
22
-
23
- it "should raise an error if use_orm is called twice" do
24
- use_orm(:activerecord)
25
- lambda { use_orm(:datamapper) }.should raise_error
26
- end
27
-
28
- it "should not have :merb_default in GENERATOR_SCOPE with use_orm(:activerecord)" do
29
- use_orm(:activerecord)
30
- Merb::GENERATOR_SCOPE.should_not include(:merb_default)
31
- end
32
-
33
- it "should have :activerecord in GENERATOR_SCOPE with use_orm(:activerecord)" do
34
- use_orm(:activerecord)
35
- Merb::GENERATOR_SCOPE.should include(:activerecord)
36
- end
37
-
38
- it "should have :activerecord first in GENERATOR_SCOPE with use_orm(:activerecord)" do
39
- use_orm(:activerecord)
40
- Merb::GENERATOR_SCOPE.first.should == :activerecord
41
- end
42
-
43
- it "should call dependency :merb_activerecord with use_orm(:activerecord)" do
44
- Kernel.should_receive(:dependency).with("merb_activerecord").once.
45
- and_return(true)
46
- use_orm(:activerecord)
47
- end
48
-
49
- end
50
-
51
- describe "Plugins","use_test" do
52
- before(:each) do
53
- Merb::GENERATOR_SCOPE.replace [:merb_default, :merb, :rspec]
54
- end
55
-
56
- it "should have :rspec in GENERATOR_SCOPE by default" do
57
- Merb::GENERATOR_SCOPE.should include(:rspec)
58
- end
59
-
60
- it "should not have :rspec in GENERATOR_SCOPE with use_test(:test_unit)" do
61
- use_test(:test_unit)
62
- Merb::GENERATOR_SCOPE.should_not include(:rspec)
63
- end
64
-
65
- it "should have :test_unit in GENERATOR_SCOPE with use_test(:test_unit)" do
66
- use_test(:test_unit)
67
- Merb::GENERATOR_SCOPE.should include(:test_unit)
68
- end
69
-
70
- it "should have :test_unit last in GENERATOR_SCOPE with use_test(:test_unit)" do
71
- use_test(:test_unit)
72
- Merb::GENERATOR_SCOPE.last.should == :test_unit
73
- end
74
-
75
- it "should raise an error if called with an unsupported test framework" do
76
- lambda { use_test(:fiddlefaddle) }.should raise_error
77
- end
78
-
79
- it "should allow adding more than test_unit or rspec via plugins"
80
- end