merb 0.5.3 → 0.9.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (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,19 +0,0 @@
1
- require File.dirname(__FILE__) + '/../spec_helper'
2
-
3
- describe Merb::Config do
4
- it "should apply environment from the command line option --environment" do
5
- options = Merb::Config.parse_args(["--environment", "performance_testing"])
6
- options[:environment].should == "performance_testing"
7
- end
8
-
9
- it "should apply environment from the command line option -e" do
10
- options = Merb::Config.parse_args(["-e", "selenium"])
11
- options[:environment].should == "selenium"
12
- end
13
-
14
- it "should load the yaml file for the environment if it exists" do
15
- options = Merb::Config.parse_args(["-e", "environment_config_test"])
16
- options[:loaded_config_for_environment_config_test].should == true
17
- end
18
-
19
- end
@@ -1,41 +0,0 @@
1
- require File.dirname(__FILE__) + '/../spec_helper'
2
-
3
- describe Merb::Template do
4
-
5
- it "should register the extensions for a given engine" do
6
- Merb::Template::EXTENSIONS["tester_ext"].should be_nil
7
- Merb::Template::EXTENSIONS["ext"].should be_nil
8
- Merb::Template.register_extensions(:tester, %w[tester_ext ext])
9
- Merb::Template::EXTENSIONS["tester_ext"].should == :tester
10
- Merb::Template::EXTENSIONS["ext"].should == :tester
11
- end
12
-
13
- it "should raise an error when registering extensions if the engine is not a symbol" do
14
- lambda do
15
- Merb::Template.register_extensions("tester", %w(thing))
16
- end.should raise_error(ArgumentError)
17
- end
18
-
19
- it "should raise an error when registering extensions if the extensions are not an array" do
20
- lambda do
21
- Merb::Template.register_extensions(:tester, "tester")
22
- end.should raise_error(ArgumentError)
23
- end
24
-
25
- it "should select the engine for an erubis file" do
26
- Merb::Template.engine_for("test.html.erb").should == Merb::Template::Erubis
27
- end
28
-
29
- it "should select the engine for an haml file" do
30
- Merb::Template.engine_for("test.html.haml").should == Merb::Template::Haml
31
- end
32
-
33
- it "should select the engine for a markaby file" do
34
- Merb::Template.engine_for("test.html.mab").should == Merb::Template::Markaby
35
- end
36
-
37
- it "should select the builder engine" do
38
- Merb::Template.engine_for("test.xml.builder").should == Merb::Template::XMLBuilder
39
- end
40
-
41
- end
@@ -1,108 +0,0 @@
1
- require File.dirname(__FILE__) + '/../spec_helper'
2
-
3
- describe MerbUploadHandler do
4
- before(:each) do
5
- @progress = mock(:upload_progress)
6
- @progress.stub!(:debug)
7
- @progress.stub!(:update_checked_time)
8
- @progress.stub!(:add)
9
- @progress.stub!(:mark)
10
- @progress.stub!(:finish)
11
- @progress.stub!(:last_checked).and_return Time.now - 10
12
- Merb::UploadProgress.stub!(:new).and_return(@progress)
13
- @handler = MerbUploadHandler.new(:upload_frequency => 3, :upload_path_match => '^/files/\d+')
14
- @upload_id = '880b7835-8a67-400e-a8f1-dec18691d604'
15
- @params = {
16
- 'CONTENT_LENGTH' => "10",
17
- 'PATH_INFO' => '/files/23',
18
- 'REQUEST_METHOD' => 'POST',
19
- 'QUERY_STRING' => "upload_id=#{@upload_id}"
20
- }
21
- @request = mock(:request)
22
- @request.stub!(:params).and_return(@params)
23
- @response = mock(:response)
24
- end
25
-
26
- after(:each) do
27
- Mongrel.class_eval do
28
- remove_const :Uploads
29
- end
30
- end
31
-
32
- it "should consider requests as invalid if the path regex does not match" do
33
- @handler.send(:valid_upload?, {
34
- 'CONTENT_LENGTH' => "10",
35
- 'PATH_INFO' => '/spoons/',
36
- 'REQUEST_METHOD' => 'POST',
37
- 'QUERY_STRING' => "upload_id=#{@upload_id}"
38
- }).should == nil
39
- end
40
-
41
- it "should send a message to Mongrel::Uploads when calling upload_notify" do
42
- Mongrel::Uploads.should_receive(:add)
43
- @handler.send(:upload_notify, :add, @params)
44
- end
45
-
46
- it "should receive upload_notify with :add when the request begins" do
47
- @handler.should_receive(:upload_notify).with(:add, @params, 10)
48
- @handler.request_begins(@params)
49
- end
50
-
51
- it "should receive upload_notify with :mark when progress is checked" do
52
- @handler.should_receive(:upload_notify).with(:mark, @params, 7)
53
- @handler.request_progress(@params, 7, 10)
54
- end
55
-
56
- it "should receive upload_notify with :finish when ready to process the request" do
57
- @handler.should_receive(:upload_notify).with(:finish, @params)
58
- @handler.process(@request,@response)
59
- end
60
-
61
- it "should send Mongrel::Uploads :finish if the request is a valid upload" do
62
- Mongrel::Uploads.should_receive(:finish).with(@upload_id)
63
- @handler.stub!(:valid_upload?).and_return(@upload_id)
64
- @handler.request_aborted(@params)
65
- end
66
-
67
- it 'should log info about aborted requests' do
68
- @handler.stub!(:valid_upload?).and_return(@upload_id)
69
- Mongrel::Uploads.should_receive(:finish).with(@upload_id)
70
- Merb.logger.should_receive :info
71
- @handler.request_aborted(@params)
72
- end
73
-
74
- it "should not send Mongrel::Uploads :finish unless the request is a valid upload" do
75
- Mongrel::Uploads.should_not_receive(:finish)
76
- @handler.stub!(:valid_upload?).and_return(false)
77
- @handler.request_aborted(@params)
78
- end
79
-
80
- it "should return an upload_id for a valid upload" do
81
- @handler.send(:valid_upload?, @params).should == @upload_id
82
- end
83
-
84
- it "should not consider a GET a valid upload" do
85
- @params['REQUEST_METHOD'] = 'GET'
86
- @handler.send(:valid_upload?, @params).should be_false
87
- end
88
-
89
- it "should consider a PUT a valid upload" do
90
- @params['REQUEST_METHOD'] = 'PUT'
91
- @handler.send(:valid_upload?, @params).should == @upload_id
92
- end
93
-
94
- it "should update Mongrel::Uploads' last checked time when calling upload_notify" do
95
- Mongrel::Uploads.should_receive(:update_checked_time).with(@upload_id)
96
- @handler.send(:upload_notify, :add, @params)
97
- end
98
-
99
- it "should not update Mongrel::Uploads' last checked time when calling upload_notify if the action is :finish" do
100
- Mongrel::Uploads.should_not_receive(:update_checked_time)
101
- @handler.send(:upload_notify, :finish, @params)
102
- end
103
-
104
- it "should not allow progress checks more frequently than the specified frequency" do
105
- Mongrel::Uploads.update_checked_time(@upload_id)
106
- @handler.request_progress(@params,7,10).should be_nil
107
- end
108
- end
@@ -1,33 +0,0 @@
1
- require File.dirname(__FILE__) + '/../spec_helper'
2
-
3
- describe 'Merb version.rb svn revision methods' do
4
- it 'should give a path to a file containing the svn revision' do
5
- Merb.svn_revision_file_path.should ==
6
- File.expand_path(File.join(Dir.pwd, Merb.svn_revision_filename))
7
- end
8
-
9
- it "should create the #{Merb.svn_revision_filename} file if it does not exist" do
10
- File.delete Merb.svn_revision_file_path
11
- Merb.svn_revision_from_file
12
- File.file?(Merb.svn_revision_file_path).should == true
13
- end
14
-
15
- it 'should not raise permissions error' do
16
- File.should_receive(:open).and_raise(Errno::EACCES)
17
- Merb.svn_revision_from_file.should_not raise_error(Errno::EACCES)
18
- end
19
-
20
- it 'should get the svn revision' do
21
- Merb.svn_revision.should > 0
22
- end
23
-
24
- it "should get the svn revision from the #{Merb.svn_revision_filename} file" do
25
- Merb.svn_revision_from_file.should > 0
26
- end
27
-
28
- it 'should get the same number from the helper and the file' do
29
- Merb.svn_revision.should == Merb.svn_revision_from_file
30
- end
31
-
32
- it 'should get the svn revision via git'
33
- end
@@ -1,366 +0,0 @@
1
- require File.dirname(__FILE__) + '/../spec_helper'
2
- require_fixtures '/controllers/render_spec_controllers'
3
-
4
- describe "View Context", "image tag" do
5
-
6
- include Merb::ViewContextMixin
7
- it "should render a link" do
8
- tag = link_to("NAME", "http://example.com", :title => "TITLE", :target => "TARGET")
9
- tag.should match_tag(:a, :href => "http://example.com",
10
- :title => "TITLE",
11
- :target => "TARGET",
12
- :content => "NAME")
13
- end
14
-
15
- it "should render local image" do
16
- tag = image_tag('foo.gif')
17
- tag.should match_tag(:img, :src => "/images/foo.gif")
18
- end
19
-
20
- it "should render a local image with a path_prefix" do
21
- Merb::Config[:path_prefix] = '/inky'
22
-
23
- tag = image_tag('foo.gif')
24
- tag.should match_tag(:img, :src => "/inky/images/foo.gif")
25
-
26
- Merb::Config.delete(:path_prefix)
27
- end
28
-
29
- it "should render local image with class" do
30
- tag = image_tag('foo.gif', :class => 'bar')
31
- tag.should match_tag(:img, :src => "/images/foo.gif", :class => "bar")
32
- end
33
-
34
- it "should render local image with class and explicit path" do
35
- tag = image_tag('foo.gif', :class => 'bar', :path => '/files/')
36
- tag.should match_tag(:img, :src => "/files/foo.gif", :class => "bar")
37
- end
38
-
39
- it "should render remote image" do
40
- tag = image_tag('http://test.com/foo.gif')
41
- tag.should match_tag(:img, :src => "http://test.com/foo.gif")
42
- end
43
-
44
- it "should render remote SSL image" do
45
- tag = image_tag('https://test.com/foo.gif')
46
- tag.should match_tag(:img, :src => "https://test.com/foo.gif")
47
- end
48
-
49
- end
50
-
51
- describe "View Context", "css tag" do
52
-
53
- include Merb::ViewContextMixin
54
-
55
- it "should render a link tag with the css_include_tag method" do
56
- tag = css_include_tag('foo.css')
57
- tag.should match_tag(:link, :href => "/stylesheets/foo.css",
58
- :media => "all",
59
- :rel => "Stylesheet",
60
- :type => "text/css",
61
- :content => nil)
62
-
63
- css_include_tag('foo').should == css_include_tag('foo.css')
64
- css_include_tag('foo', 'bar').should ==
65
- css_include_tag('foo') + css_include_tag('bar')
66
- end
67
-
68
- it "should alter the 'media' attribute based on the provided options" do
69
- tag = css_include_tag('foo.css', :media => :screen)
70
- tag.should match_tag(:link, :href => "/stylesheets/foo.css",
71
- :media => "screen",
72
- :rel => "Stylesheet",
73
- :type => "text/css",
74
- :content => nil)
75
- end
76
-
77
- it "should render a link tag with a path_prefix" do
78
- Merb::Config[:path_prefix] = '/inky'
79
-
80
- tag = css_include_tag('foo.css')
81
- tag.should match_tag(:link, :href => "/inky/stylesheets/foo.css",
82
- :media => "all",
83
- :rel => "Stylesheet",
84
- :type => "text/css",
85
- :content => nil)
86
-
87
- Merb::Config.delete(:path_prefix)
88
- end
89
-
90
- it "should not generate a script tag with the include_required_css" do
91
- include_required_css.clean.should == ''
92
- end
93
-
94
- it "should generate script tags with the include_required_css" do
95
- require_css('foo')
96
- require_css('bar')
97
- include_required_css.should == css_include_tag('foo') + css_include_tag('bar')
98
- end
99
- end
100
-
101
- describe "View Context", "css tag with bundles" do
102
-
103
- include Merb::ViewContextMixin
104
-
105
- before(:each) do
106
- @bundler = mock(:bundler)
107
- Merb::Assets.stub!(:bundle?).and_return(true)
108
- Merb::Assets::StylesheetAssetBundler.stub!(:new).and_return(@bundler)
109
- @bundler.stub!(:bundle!).and_return(:all)
110
- end
111
-
112
- it "should not bundle stylesheets if asset bundling is disabled" do
113
- Merb::Assets.should_receive(:bundle?).and_return(false)
114
-
115
- tag = css_include_tag(:fonts, :colors, :bundle => true)
116
- tag.should == css_include_tag(:fonts) + css_include_tag(:colors)
117
- end
118
-
119
- it "should not bundle stylesheets if only a single stylesheet was provided" do
120
- css_include_tag(:fonts, :bundle => true).should == css_include_tag(:fonts)
121
- end
122
-
123
- it "should bundle all stylesheets as 'all.css' if no bundle name is provided" do
124
- Merb::Assets.should_receive(:bundle?).and_return(true)
125
- Merb::Assets::StylesheetAssetBundler.should_receive(:new).with(true, :fonts, :colors).and_return(@bundler)
126
- @bundler.should_receive(:bundle!).and_return(:all)
127
-
128
- tag = css_include_tag(:fonts, :colors, :bundle => true)
129
- tag.should match_tag(:link, :href => "/stylesheets/all.css",
130
- :media => "all",
131
- :rel => "Stylesheet",
132
- :type => "text/css",
133
- :content => nil)
134
- end
135
-
136
- it "should bundle all stylesheets whatever bundle name is provided" do
137
- Merb::Assets.should_receive(:bundle?).and_return(true)
138
- Merb::Assets::StylesheetAssetBundler.should_receive(:new).with(:base, :fonts, :colors).and_return(@bundler)
139
- @bundler.should_receive(:bundle!).and_return(:base)
140
-
141
- tag = css_include_tag(:fonts, :colors, :bundle => :base)
142
- tag.should match_tag(:link, :href => "/stylesheets/base.css",
143
- :media => "all",
144
- :rel => "Stylesheet",
145
- :type => "text/css",
146
- :content => nil)
147
- end
148
-
149
- it "should not generate a stylesheet tag with the include_required_css" do
150
- include_required_css(:bundle => true).clean.should == ''
151
- end
152
-
153
- it "should generate stylesheet tags with the include_required_css" do
154
- Merb::Assets.should_receive(:bundle?).and_return(true)
155
- Merb::Assets::StylesheetAssetBundler.should_receive(:new).with(true, :fonts, :colors).and_return(@bundler)
156
- @bundler.should_receive(:bundle!).and_return(:all)
157
-
158
- require_css(:fonts)
159
- require_css(:colors)
160
- tag = include_required_css(:bundle => true)
161
-
162
- tag.should match_tag(:link, :href => "/stylesheets/all.css",
163
- :media => "all",
164
- :rel => "Stylesheet",
165
- :type => "text/css",
166
- :content => nil)
167
- end
168
- end
169
-
170
- describe "View Context", "script tag" do
171
-
172
- include Merb::ViewContextMixin
173
-
174
- it "should render a script tag with the js_include_tag method" do
175
- tag = js_include_tag('foo.js')
176
- tag.should match_tag(:script, :src => "/javascripts/foo.js",
177
- :type => "text/javascript",
178
- :content => "//")
179
-
180
- js_include_tag('foo').should == js_include_tag('foo.js')
181
- js_include_tag('foo', 'bar').should ==
182
- js_include_tag('foo') + js_include_tag('bar')
183
- end
184
-
185
- it "should render a script tag with a path_prefix" do
186
- Merb::Config[:path_prefix] = '/inky'
187
-
188
- tag = js_include_tag('foo.js')
189
- tag.should match_tag(:script, :src => "/inky/javascripts/foo.js",
190
- :type => "text/javascript",
191
- :content => "//")
192
-
193
- Merb::Config.delete(:path_prefix)
194
- end
195
-
196
- it "should not generate a script tag with the include_required_js" do
197
- include_required_js.clean.should == ''
198
- end
199
-
200
- it "should generate script tags with the include_required_js" do
201
- require_js('foo')
202
- require_js('bar')
203
- include_required_js.should == js_include_tag('foo') + js_include_tag('bar')
204
- end
205
- end
206
-
207
- describe "View Context", "script tag with bundles" do
208
-
209
- include Merb::ViewContextMixin
210
-
211
- before(:each) do
212
- @bundler = mock(:bundler)
213
- Merb::Assets.stub!(:bundle?).and_return(true)
214
- Merb::Assets::JavascriptAssetBundler.stub!(:new).and_return(@bundler)
215
- @bundler.stub!(:bundle!).and_return(:all)
216
- end
217
-
218
- it "should not bundle scripts if asset bundling is disabled" do
219
- Merb::Assets.should_receive(:bundle?).and_return(false)
220
-
221
- tag = js_include_tag(:prototype, :lowpro, :bundle => true)
222
- tag.should == js_include_tag(:prototype) + js_include_tag(:lowpro)
223
- end
224
-
225
- it "should not bundle scripts if only a single script was provided" do
226
- css_include_tag(:prototype, :bundle => true).should == css_include_tag(:prototype)
227
- end
228
-
229
- it "should bundle all scripts as 'all.js' if no bundle name is provided" do
230
- Merb::Assets.should_receive(:bundle?).and_return(true)
231
- Merb::Assets::JavascriptAssetBundler.should_receive(:new).with(true, :prototype, :lowpro).and_return(@bundler)
232
- @bundler.should_receive(:bundle!).and_return(:all)
233
-
234
- tag = js_include_tag(:prototype, :lowpro, :bundle => true)
235
- tag.should match_tag(:script, :src => "/javascripts/all.js",
236
- :type => "text/javascript",
237
- :content => "//")
238
- end
239
-
240
- it "should bundle all stylesheets whatever bundle name is provided" do
241
- Merb::Assets.should_receive(:bundle?).and_return(true)
242
- Merb::Assets::JavascriptAssetBundler.should_receive(:new).with(:base, :prototype, :lowpro).and_return(@bundler)
243
- @bundler.should_receive(:bundle!).and_return(:base)
244
-
245
- tag = js_include_tag(:prototype, :lowpro, :bundle => :base)
246
- tag.should match_tag(:script, :src => "/javascripts/base.js",
247
- :type => "text/javascript",
248
- :content => "//")
249
- end
250
-
251
- it "should not generate a script tag with the include_required_js" do
252
- include_required_js(:bundle => true).clean.should == ''
253
- end
254
-
255
- it "should generate script tags with the include_required_js" do
256
- Merb::Assets.should_receive(:bundle?).and_return(true)
257
- Merb::Assets::JavascriptAssetBundler.should_receive(:new).with(true, :prototype, :lowpro).and_return(@bundler)
258
- @bundler.should_receive(:bundle!).and_return(:all)
259
-
260
- require_js(:prototype)
261
- require_js(:lowpro)
262
-
263
- tag = include_required_js(:bundle => true)
264
- tag.should match_tag(:script, :src => "/javascripts/all.js",
265
- :type => "text/javascript",
266
- :content => "//")
267
- end
268
- end
269
-
270
- describe "View Context", "throw_content, catch_content" do
271
-
272
- include Merb::ViewContextMixin
273
-
274
- it "should throw content" do
275
- c = new_controller
276
- content = c.render :template => "examples/template_throw_content", :layout => :none
277
- content.should match( /THROWN CONTENT/m )
278
- end
279
-
280
- it "should throw content including a partial" do
281
- c = new_controller
282
- content = c.render :template => "examples/template_catch_content_from_partial", :layout => :none
283
- content.should match( /CONTENT THROWN FROM PARTIAL/m )
284
- end
285
-
286
- it "should catch content" do
287
- c = new_controller
288
- content = c.render :template => "examples/template_catch_content", :layout => :none
289
- content.should match( /CAUGHT CONTENT/m)
290
- end
291
-
292
- it "should catch content with multiple throws" do
293
- c = new_controller
294
- content = c.render :template => "examples/template_catch_content", :layout => :none
295
- content.should match( /CAUGHT FOOTER/m )
296
- content.should match( /START FOOTER\s+CAUGHT FOOTER\s+END FOOTER/m )
297
- end
298
-
299
- it "should not render the block inline" do
300
- c = new_controller
301
- content = c.render :template => "examples/template_catch_content", :layout => :none
302
- content.should match( /\A\s*START HEADER\s*CAUGHT CONTENT\s*END HEADER\s*START FOOTER\s*CAUGHT FOOTER\s*END FOOTER\s*\Z/m)
303
- end
304
-
305
- it "should throw content as an argument without a block" do
306
- c = new_controller
307
- content = c.render :template => "examples/template_throw_content_without_block", :layout => :none
308
- content.should match(/Content Without Block/)
309
- end
310
- end
311
-
312
- describe Merb::ViewContextMixin do
313
- # The use of this here is to avoid conflict with the tag()
314
- # Hpricot test helper invoked via match_tag() when testing the
315
- # tag() view context helper.
316
- class FakeViewContext
317
- include Merb::ErubisCaptureMixin, Merb::ViewContextMixin
318
- end
319
-
320
- before :each do
321
- @view = FakeViewContext.new
322
- end
323
-
324
- it "should render the start of a tag" do
325
- @view.open_tag(:div).should match_tag(:div)
326
- end
327
-
328
- it "should render the start of a tag with attributes" do
329
- @view.open_tag(:div, :id => 1, :class => "CLASS").
330
- should match_tag(:div, :id => "1", :class => "CLASS")
331
- end
332
-
333
- it "should render a self closing tag" do
334
- @view.self_closing_tag(:br).should match_tag(:br)
335
- end
336
-
337
- it "should render a self closing tag with attributes" do
338
- @view.self_closing_tag(:img, :src => "SOURCE").
339
- should match_tag(:img, :src => "SOURCE")
340
- end
341
-
342
- it "should render a closing tag" do
343
- @view.close_tag(:div).should == "</div>"
344
- end
345
-
346
- it 'should render a tag with content' do
347
- @view.tag(:div, 'divs rool').should match_tag(:div, :content => 'divs rool')
348
- end
349
-
350
- it 'should render a tag with content and attributes' do
351
- @view.tag(:div, 'divs rool', :class => 'classy').
352
- should match_tag(:div, :content => 'divs rool', :class => 'classy')
353
- end
354
-
355
- it 'should render a tag using a block for its contents' do
356
- @view.tag(:div) do
357
- 'divs rool'
358
- end.should match_tag(:div, :content => 'divs rool')
359
- end
360
-
361
- it 'should render a tag with attributes using a block for its contents' do
362
- @view.tag(:div, :class => 'classy') do
363
- 'divs rool'
364
- end.should match_tag(:div, :content => 'divs rool', :class => 'classy')
365
- end
366
- end