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,34 +0,0 @@
1
- require File.dirname(__FILE__) + '/../../spec_helper'
2
-
3
- describe Inflector do
4
- it "should transform words from singular to plural" do
5
- "post".pluralize.should == "posts"
6
- "octopus".pluralize.should =="octopi"
7
- "the blue mailman".pluralize.should == "the blue mailmen"
8
- "CamelOctopus".pluralize.should == "CamelOctopi"
9
- end
10
-
11
- it "should transform words from plural to singular" do
12
- "posts".singularize.should == "post"
13
- "octopi".singularize.should == "octopus"
14
- "the blue mailmen".singularize.should == "the blue mailman"
15
- "CamelOctopi".singularize.should == "CamelOctopus"
16
- end
17
-
18
- it "should transform class names to table names" do
19
- "RawScaledScorer".tableize.should == "raw_scaled_scorers"
20
- "egg_and_ham".tableize.should == "egg_and_hams"
21
- "fancyCategory".tableize.should == "fancy_categories"
22
- end
23
-
24
- it "should tranform table names to class names" do
25
- "egg_and_hams".classify.should == "EggAndHam"
26
- "post".classify.should == "Post"
27
- end
28
-
29
- it "should create a foreign key name from a class name" do
30
- "Message".foreign_key.should == "message_id"
31
- "Message".foreign_key(false).should == "messageid"
32
- "Admin::Post".foreign_key.should == "post_id"
33
- end
34
- end
@@ -1,25 +0,0 @@
1
- require File.dirname(__FILE__) + '/../../spec_helper'
2
-
3
- describe "extracting options from arguments" do
4
- def the_method(*args)
5
- [extract_options_from_args!(args), args]
6
- end
7
-
8
- it "should extract the hash if the last item is a hash" do
9
- opts,args = the_method(:one, :two, :key => :value)
10
- opts.should == { :key => :value }
11
- args.should == [:one, :two]
12
- end
13
-
14
- it "should return nil for the opts if no hash is provided" do
15
- opts,args = the_method(:one, :two)
16
- opts.should be_nil
17
- args.should == [:one, :two]
18
- end
19
-
20
- it "should return two hashes" do
21
- opts,args = the_method({ :one => :two }, { :key => :value })
22
- opts.should == {:key => :value}
23
- args.should == [{:one => :two}]
24
- end
25
- end
@@ -1,26 +0,0 @@
1
- require File.dirname(__FILE__) + '/../../spec_helper'
2
-
3
- describe "A Numeric object" do
4
- it "should be able to convert to US currency" do
5
- 1.5.to_currency.should == "$1.50"
6
- end
7
-
8
- it "should be able to convert to Danish currency" do
9
- 15_000_000.5.to_currency(nil, ".", ",", "DM").should == "15.000.000,50DM"
10
- end
11
-
12
- {
13
- :microsecond => Float(10 ** -6), :millisecond => Float(10 ** -3), :second => 1,
14
- :minute => 60, :hour => 3600, :day => 86400, :week => 604800,
15
- :month => 2592000, :year => 31536000, :decade => 315360000
16
- }.each do |method,seconds|
17
-
18
- it "should be able to convert to #{method}s (singular version)" do
19
- 1.send(method).should == seconds
20
- end
21
-
22
- it "should be able to convert to #{method}s (plural version)" do
23
- 2.send("#{method}s").should == seconds * 2
24
- end
25
- end
26
- end
@@ -1,47 +0,0 @@
1
- require File.dirname(__FILE__) + '/../../spec_helper'
2
-
3
- class String
4
- def self.define_meta(meth, val)
5
- meta_def(meth) { val }
6
- end
7
- end
8
- class MyString < String; end
9
-
10
- describe "An object" do
11
- it "should be able to return a passed in object that is modified by a block" do
12
- (returning({}) {|x| x.merge!(:foo => :bar)}).should == {:foo => :bar}
13
- end
14
-
15
- it "should be able to get a meta class" do
16
- MyString.meta_class.to_s.should == "#<Class:MyString>"
17
- end
18
-
19
- it "should be able to execute code in the meta-class' context" do
20
- (MyString.meta_eval { self }).should == MyString.meta_class
21
- end
22
-
23
- it "should be able to define a method on the meta-class" do
24
- MyString.define_meta :foo, :bar
25
- MyString.foo.should == :bar
26
- end
27
-
28
- it "should be able to define methods on its instances" do
29
- MyString.class_def(:foo) { :bar }
30
- MyString.new.foo.should == :bar
31
- end
32
-
33
- {[] => true,
34
- [1] => false,
35
- [nil] => false,
36
- nil => true,
37
- true => false,
38
- false => true,
39
- "" => true,
40
- " " => true,
41
- " hey " => false
42
- }.each do |obj, expected|
43
- it "should be able to determine whether the #{obj.class} #{obj.inspect} is blank" do
44
- obj.blank?.should == expected
45
- end
46
- end
47
- end
@@ -1,22 +0,0 @@
1
- require File.dirname(__FILE__) + '/../../spec_helper'
2
-
3
- describe "A String" do
4
- it "should convert a path/like/this to a Constant::String::Like::This" do
5
- "path/like/this".to_const_string.should == "Path::Like::This"
6
- "path".to_const_string.should == "Path"
7
- "snake_case/path/with_several_parts".to_const_string.should == "SnakeCase::Path::WithSeveralParts"
8
- end
9
-
10
- it "should raise an error rather than freeze when trying to convert bad Paths/12Like/-this" do
11
- Timeout::timeout(1) do
12
- lambda do
13
- "Paths/12Like/-this".to_const_string
14
- end.should raise_error(String::InvalidPathConversion)
15
- end.should_not raise_error(Timeout::Error)
16
- end
17
-
18
- it "should remove any indentation and add +indentation+ number of spaces" do
19
- "foo\n bar\n".indent(3).should == " foo\n bar\n"
20
- " foo\n bar\n".indent(3).should == " foo\n bar\n"
21
- end
22
- end
@@ -1,7 +0,0 @@
1
- require File.dirname(__FILE__) + '/../../spec_helper'
2
-
3
- describe Symbol do
4
- it "should be able to call Symbol#to_proc" do
5
- ['foo', 'bar'].map(&:reverse).should == ['oof', 'rab']
6
- end
7
- end
@@ -1,22 +0,0 @@
1
- require File.dirname(__FILE__) + '/../spec_helper'
2
-
3
- describe "Kernel#dependency" do
4
-
5
- before do
6
- File.stub!(:directory?).with(Merb.root / "gems").and_return(true)
7
- Gem.stub!(:use_paths)
8
- Gem.stub!(:clear_paths)
9
- end
10
-
11
- it "loads in files from the local gem-cache first" do
12
- Gem.should_receive(:activate).with("json_pure", true).and_return(true)
13
- Kernel.dependency "json_pure"
14
- end
15
-
16
- it "does a require if it can't find it in either gem cache" do
17
- Gem.stub!(:activate).twice.with("RedCloth", true).and_raise(LoadError)
18
- Kernel.should_receive(:require).with("RedCloth")
19
- Kernel.dependency "RedCloth"
20
- end
21
-
22
- end
@@ -1,528 +0,0 @@
1
- require File.dirname(__FILE__) + '/../spec_helper'
2
- require_fixtures '/controllers/dispatch_spec_controllers'
3
-
4
- describe Merb::Dispatcher do
5
- before :all do
6
- Merb::Config[:allow_reloading] = false
7
- Merb::Router.prepare do |r|
8
- r.resource :icon
9
- r.resources :posts,
10
- :member => { :stats => [:get, :put] },
11
- :collection => { :filter => [:get] } do |post|
12
- post.resources :comments, :member => { :stats => [:get, :put] }
13
- post.resource :profile
14
- end
15
- r.resources :as do |a|
16
- a.resources :bs do |b|
17
- b.resources :cs
18
- end
19
- end
20
-
21
- r.match('/admin') do |admin|
22
- admin.resources :tags
23
- end
24
-
25
- r.default_routes
26
- end
27
- end
28
-
29
- it "should not overwrite url params with query string params" do
30
- controller, action = request(:get, '/foo/bar/42?id=24')
31
- controller.class.should == Foo
32
- action.should == "bar"
33
- controller.params[:id].should == '42'
34
- end
35
-
36
- it "should not allow private and protected methods to be called" do
37
- controller, action = request(:get, '/foo/call_filters')
38
- controller.status.should == Merb::ControllerExceptions::ActionNotFound::STATUS
39
- end
40
-
41
- it "should handle request: GET /foo/bar and return Foo#bar" do
42
- controller, action = request(:get, '/foo/bar')
43
- e = controller.params[:exception]
44
- controller.class.should == Foo
45
- action.should == "bar"
46
- controller.body.should == "bar"
47
- end
48
-
49
- it "should handle request: GET /foo/bar/1.xml and return Foo#bar format xml" do
50
- controller, action = request(:get, '/foo/bar/1.xml')
51
- controller.class.should == Foo
52
- controller.params[:format].should == 'xml'
53
- action.should == "bar"
54
- controller.body.should == "bar"
55
- end
56
-
57
- it "should handle request: GET /foo/bar.xml and return Foo#bar format xml" do
58
- controller, action = request(:get, '/foo/bar.xml')
59
- controller.class.should == Foo
60
- controller.params[:format].should == 'xml'
61
- action.should == "bar"
62
- controller.body.should == "bar"
63
- end
64
-
65
- it "should handle request: GET /foo.xml and return Foo#index format xml" do
66
- controller, action = request(:get, '/foo.xml')
67
- controller.class.should == Foo
68
- controller.params[:format].should == 'xml'
69
- action.should == "index"
70
- controller.body.should == "index"
71
- end
72
-
73
- it "should handle request: GET /foo and return Foo#index" do
74
- controller, action = request(:get, '/foo')
75
- controller.class.should == Foo
76
- action.should == "index"
77
- controller.body.should == "index"
78
- end
79
-
80
- it "should handle request: GET /icon and return Icon#show" do
81
- controller, action = request(:get, '/icon')
82
- controller.class.should == Icon
83
- action.should == "show"
84
- controller.body.should == :show
85
- end
86
-
87
- it "should handle request: GET /icon.xml and return Icon#show format xml" do
88
- controller, action = request(:get, '/icon.xml')
89
- controller.class.should == Icon
90
- action.should == "show"
91
- controller.params[:format].should == 'xml'
92
- controller.body.should == :show
93
- end
94
-
95
- it "should handle request: GET /icon/new and return Icon#new" do
96
- controller, action = request(:get, '/icon/new')
97
- controller.class.should == Icon
98
- action.should == "new"
99
- controller.body.should == :new
100
- end
101
-
102
- it "should handle request: GET /icon;edit and return Icon#edit" do
103
- controller, action = request(:get, '/icon;edit')
104
- controller.class.should == Icon
105
- action.should == "edit"
106
- controller.body.should == :edit
107
- end
108
-
109
- it "should handle request: GET /icon/edit and return Icon#edit" do
110
- controller, action = request(:get, '/icon/edit')
111
- controller.class.should == Icon
112
- action.should == "edit"
113
- controller.body.should == :edit
114
- end
115
-
116
- it "should handle request: POST /icon and return Icon#create" do
117
- controller, action = request(:post, '/icon')
118
- controller.class.should == Icon
119
- action.should == "create"
120
- controller.body.should == :create
121
- end
122
-
123
- it "should handle request: PUT /icon and return Icon#update" do
124
- controller, action = request(:put, '/icon')
125
- controller.class.should == Icon
126
- action.should == "update"
127
- controller.body.should == :update
128
- end
129
-
130
- it "should handle request: DELETE /icon and return Icon#destroy" do
131
- controller, action = request(:delete, '/icon')
132
- controller.class.should == Icon
133
- action.should == "destroy"
134
- controller.body.should == :destroy
135
- end
136
-
137
- it "should handle request: GET /admin/tags and return Tags#index" do
138
- controller, action = request(:get, '/admin/tags')
139
- controller.class.should == Tags
140
- action.should == "index"
141
- controller.body.should == :index
142
- end
143
-
144
- it "should handle request: GET /admin/tags.xml and return Tags#index format xml" do
145
- controller, action = request(:get, '/admin/tags.xml')
146
- controller.class.should == Tags
147
- action.should == "index"
148
- controller.params[:format].should == 'xml'
149
- controller.body.should == :index
150
- end
151
-
152
- it "should handle request: GET /posts and return Posts#index" do
153
- controller, action = request(:get, '/posts')
154
- controller.class.should == Posts
155
- action.should == "index"
156
- controller.body.should == :index
157
- end
158
-
159
- it "should handle request: GET /posts;filter and return Posts#filter" do
160
- controller, action = request(:get, '/posts;filter')
161
- controller.class.should == Posts
162
- action.should == "filter"
163
- controller.body.should == :filter
164
- end
165
-
166
- it "should handle request: GET /posts/filter and return Posts#filter" do
167
- controller, action = request(:get, '/posts/filter')
168
- controller.class.should == Posts
169
- action.should == "filter"
170
- controller.body.should == :filter
171
- end
172
-
173
- it "should handle request: GET /posts/1/comments and return Comments#index with post_id == 1" do
174
- controller, action = request(:get, '/posts/1/comments')
175
- controller.class.should == Comments
176
- action.should == "index"
177
- controller.body.should == :index
178
- end
179
-
180
- it "should handle request: GET /posts/1/profile and return Profile#show with post_id == 1" do
181
- controller, action = request(:get, '/posts/1/profile')
182
- controller.class.should == Profile
183
- action.should == "show"
184
- controller.body.should == :show
185
- end
186
-
187
- it "should handle request: GET /posts/1/profile.xml and return Profile#show with post_id == 1" do
188
- controller, action = request(:get, '/posts/1/profile.xml')
189
- controller.class.should == Profile
190
- controller.params[:format].should == 'xml'
191
- action.should == "show"
192
- controller.body.should == :show
193
- end
194
-
195
- it "should handle request: GET /posts.xml and return Posts#index format xml" do
196
- controller, action = request(:get, '/posts.xml')
197
- controller.class.should == Posts
198
- controller.params[:format].should == 'xml'
199
- action.should == "index"
200
- controller.body.should == :index
201
- end
202
-
203
- it "should handle request: GET /posts/1 and return Posts#show" do
204
- controller, action = request(:get, '/posts/1')
205
- controller.class.should == Posts
206
- action.should == "show"
207
- controller.params[:id].should == '1'
208
- controller.body.should == :show
209
- end
210
-
211
- it "should handle request: GET /posts/1/comments/1 and return Comments#show with post_id == 1" do
212
- controller, action = request(:get, '/posts/1/comments/1')
213
- controller.class.should == Comments
214
- controller.params[:id].should == '1'
215
- controller.params[:post_id].should == '1'
216
- action.should == "show"
217
- controller.body.should == :show
218
- end
219
-
220
- it "should handle request: GET /as/1/bs/1 and return Bs#show with as_id == 1 & id == 1" do
221
- controller, action = request(:get, '/as/1/bs/1')
222
- controller.class.should == Bs
223
- controller.params[:id].should == '1'
224
- controller.params[:a_id].should == '1'
225
- action.should == "show"
226
- controller.body.should == :show
227
- end
228
-
229
- it "should handle request: GET /as/1/bs/1/cs and return Cs#show with a_id == 1 & b_id == 1" do
230
- controller, action = request(:get, '/as/1/bs/1/cs')
231
- controller.class.should == Cs
232
- controller.params[:b_id].should == '1'
233
- controller.params[:a_id].should == '1'
234
- action.should == "index"
235
- controller.body.should == :index
236
- end
237
-
238
- it "should handle request: GET /as/1/bs/1/cs/1 and return Bs#show with as_id == 1 & b_id == 1 & id == 1" do
239
- controller, action = request(:get, '/as/1/bs/1/cs/1')
240
- controller.class.should == Cs
241
- controller.params[:id].should == '1'
242
- controller.params[:a_id].should == '1'
243
- controller.params[:b_id].should == '1'
244
- action.should == "show"
245
- controller.body.should == :show
246
- end
247
-
248
- it "should handle request: GET /posts/1.xml and return Posts#show format xml" do
249
- controller, action = request(:get, '/posts/1.xml')
250
- controller.class.should == Posts
251
- controller.params[:format].should == 'xml'
252
- action.should == "show"
253
- controller.params[:id].should == '1'
254
- controller.body.should == :show
255
- end
256
-
257
- it "should handle request: GET /posts/1/comments/1.xml and return Comments#show with post_id == 1 and format xml" do
258
- controller, action = request(:get, '/posts/1/comments/1.xml')
259
- controller.class.should == Comments
260
- controller.params[:id].should == '1'
261
- controller.params[:format].should == 'xml'
262
- controller.params[:post_id].should == '1'
263
- action.should == "show"
264
- controller.body.should == :show
265
- end
266
-
267
- it "should handle request: GET /posts/new and return Posts#new" do
268
- controller, action = request(:get, '/posts/new')
269
- controller.class.should == Posts
270
- action.should == "new"
271
- controller.body.should == :new
272
- end
273
-
274
- it "should handle request: GET /posts/1/comments/new and return Comments#new with post_id == 1" do
275
- controller, action = request(:get, '/posts/1/comments/new')
276
- controller.class.should == Comments
277
- action.should == "new"
278
- controller.body.should == :new
279
- end
280
-
281
- it "should handle request: GET /posts/1;edit and return Posts#edit" do
282
- controller, action = request(:get, '/posts/1;edit')
283
- controller.class.should == Posts
284
- action.should == "edit"
285
- controller.params[:id].should == '1'
286
- controller.body.should == :edit
287
- end
288
-
289
- it "should handle request: GET /posts/1/edit and return Posts#edit" do
290
- controller, action = request(:get, '/posts/1/edit')
291
- controller.class.should == Posts
292
- action.should == "edit"
293
- controller.params[:id].should == '1'
294
- controller.body.should == :edit
295
- end
296
-
297
- it "should handle request: GET /posts/1/comments/1;edit and return Comments#edit with post_id == 1" do
298
- controller, action = request(:get, '/posts/1/comments/1;edit')
299
- controller.class.should == Comments
300
- controller.params[:id].should == '1'
301
- controller.params[:post_id].should == '1'
302
- action.should == "edit"
303
- controller.body.should == :edit
304
- end
305
-
306
- it "should handle request: GET /posts/1/comments/1/edit and return Comments#edit with post_id == 1" do
307
- controller, action = request(:get, '/posts/1/comments/1/edit')
308
- controller.class.should == Comments
309
- controller.params[:id].should == '1'
310
- controller.params[:post_id].should == '1'
311
- action.should == "edit"
312
- controller.body.should == :edit
313
- end
314
-
315
- it "should handle request: POST /posts and return Posts#create" do
316
- controller, action = request(:post, '/posts')
317
- controller.class.should == Posts
318
- action.should == "create"
319
- controller.body.should == :create
320
- end
321
-
322
- it "should handle request: POST /posts/1/comments and return Comments#create with post_id == 1" do
323
- controller, action = request(:post, '/posts/1/comments')
324
- controller.class.should == Comments
325
- action.should == "create"
326
- controller.body.should == :create
327
- end
328
-
329
- it "should handle request: POST /posts/1/comments.xml and return Comments#create with post_id == 1 and format xml" do
330
- controller, action = request(:post, '/posts/1/comments.xml')
331
- controller.class.should == Comments
332
- controller.params[:format].should == 'xml'
333
- action.should == "create"
334
- controller.body.should == :create
335
- end
336
-
337
- it "should handle request: POST /posts.xml and return Posts#create format xml" do
338
- controller, action = request(:post, '/posts.xml')
339
- controller.class.should == Posts
340
- controller.params[:format].should == 'xml'
341
- action.should == "create"
342
- controller.body.should == :create
343
- end
344
-
345
- it "should handle request: PUT /posts/1 and return Posts#update" do
346
- controller, action = request(:put, '/posts/1')
347
- controller.class.should == Posts
348
- action.should == "update"
349
- controller.params[:id].should == '1'
350
- controller.body.should == :update
351
- end
352
-
353
- it "should handle request: PUT /posts/1/comments/1 and return Comments#update with post_id == 1" do
354
- controller, action = request(:put, '/posts/1/comments/1')
355
- controller.class.should == Comments
356
- action.should == "update"
357
- controller.params[:post_id].should == '1'
358
- controller.params[:id].should == '1'
359
- controller.body.should == :update
360
- end
361
-
362
- it "should handle request: PUT /posts/1.xml and return Posts#update format xml" do
363
- controller, action = request(:put, '/posts/1.xml')
364
- controller.class.should == Posts
365
- controller.params[:format].should == 'xml'
366
- controller.params[:id].should == '1'
367
- action.should == "update"
368
- controller.body.should == :update
369
- end
370
-
371
- it "should handle request: PUT /posts/1/comments/1.xml and return Comments#update with post_id == 1 and format xml" do
372
- controller, action = request(:put, '/posts/1/comments/1.xml')
373
- controller.class.should == Comments
374
- action.should == "update"
375
- controller.params[:post_id].should == '1'
376
- controller.params[:format].should == 'xml'
377
- controller.params[:id].should == '1'
378
- controller.body.should == :update
379
- end
380
-
381
- it "should handle request: DELETE /posts/1 and return Posts#destroy" do
382
- controller, action = request(:delete, '/posts/1')
383
- controller.class.should == Posts
384
- controller.params[:id].should == '1'
385
- action.should == "destroy"
386
- controller.body.should == :destroy
387
- end
388
-
389
- it "should handle request: DELETE /posts/1/comments/1 and return Comments#destroy with post_id == 1" do
390
- controller, action = request(:delete, '/posts/1/comments/1')
391
- controller.class.should == Comments
392
- controller.params[:id].should == '1'
393
- controller.params[:post_id].should == '1'
394
- action.should == "destroy"
395
- controller.body.should == :destroy
396
- end
397
-
398
- it "should handle request: DELETE /posts/1.xml and return Posts#destroy format xml" do
399
- controller, action = request(:delete, '/posts/1.xml')
400
- controller.class.should == Posts
401
- controller.params[:format].should == 'xml'
402
- controller.params[:id].should == '1'
403
- action.should == "destroy"
404
- controller.body.should == :destroy
405
- end
406
-
407
- it "should handle request: DELETE /posts/1/comments/1.xml and return Comments#destroy with post_id == 1" do
408
- controller, action = request(:delete, '/posts/1/comments/1.xml')
409
- controller.class.should == Comments
410
- controller.params[:id].should == '1'
411
- controller.params[:format].should == 'xml'
412
- controller.params[:post_id].should == '1'
413
- action.should == "destroy"
414
- controller.body.should == :destroy
415
- end
416
-
417
- it "should handle request: GET /posts/1;stats and return Posts#stats" do
418
- controller, action = request(:get, '/posts/1;stats')
419
- controller.class.should == Posts
420
- action.should == 'stats'
421
- controller.params[:id].should == '1'
422
- controller.body.should == :stats
423
- end
424
-
425
- it "should handle request: GET /posts/1/stats and return Posts#stats" do
426
- controller, action = request(:get, '/posts/1/stats')
427
- controller.class.should == Posts
428
- action.should == 'stats'
429
- controller.params[:id].should == '1'
430
- controller.body.should == :stats
431
- end
432
-
433
- it "should handle request: GET /posts/1/comments/1;stats and return Comments#stats with post_id == 1" do
434
- controller, action = request(:get, '/posts/1/comments/1;stats')
435
- controller.class.should == Comments
436
- action.should == 'stats'
437
- controller.params[:id].should == '1'
438
- controller.params[:post_id].should == '1'
439
- controller.body.should == :stats
440
- end
441
-
442
- it "should handle request: GET /posts/1/comments/1/stats and return Comments#stats with post_id == 1" do
443
- controller, action = request(:get, '/posts/1/comments/1/stats')
444
- controller.class.should == Comments
445
- action.should == 'stats'
446
- controller.params[:id].should == '1'
447
- controller.params[:post_id].should == '1'
448
- controller.body.should == :stats
449
- end
450
-
451
- it "should handle request: PUT /posts/1;stats and return Posts#stats" do
452
- controller, action = request(:put, '/posts/1;stats')
453
- controller.class.should == Posts
454
- action.should == 'stats'
455
- controller.params[:id].should == '1'
456
- controller.body.should == :stats
457
- end
458
-
459
- it "should handle request: PUT /posts/1/comments/1;stats and return Comments#stats with post_id == 1" do
460
- controller, action = request(:get, '/posts/1/comments/1;stats')
461
- controller.class.should == Comments
462
- action.should == 'stats'
463
- controller.params[:id].should == '1'
464
- controller.params[:post_id].should == '1'
465
- controller.body.should == :stats
466
- end
467
-
468
- it "should handle request: PUT /posts/1/comments/1/stats and return Comments#stats with post_id == 1" do
469
- controller, action = request(:get, '/posts/1/comments/1/stats')
470
- controller.class.should == Comments
471
- action.should == 'stats'
472
- controller.params[:id].should == '1'
473
- controller.params[:post_id].should == '1'
474
- controller.body.should == :stats
475
- end
476
-
477
- it "should show the custom error page" do
478
- controller, action = request(:get, '/foo/error')
479
- controller.body.should == "oh no!"
480
- end
481
-
482
- it "should show the a 404 error page" do
483
- controller, action = request(:get, '/foo/raise404')
484
- controller.status.should == Merb::ControllerExceptions::NotFound::STATUS
485
- end
486
-
487
- it "should not show the a 404 error page if you call with upcase url" do
488
- controller, action = request(:get, '/Posts/1')
489
- controller.status.should == Merb::ControllerExceptions::NotFound::STATUS
490
- end
491
-
492
- it "should not show the a 404 error page if you call with - in the controller name with no explicit route" do
493
- controller, action = request(:get, '/pos-ts/1')
494
- controller.status.should == Merb::ControllerExceptions::NotFound::STATUS
495
- end
496
-
497
- if defined?(ParseTreeArray)
498
- it "should support parameterized actions with required arguments" do
499
- controller, action = request(:get, '/bar/foo/1')
500
- controller.body.should == "1"
501
- end
502
-
503
- it "should support parameterized actions with required and optional arguments" do
504
- controller, action = request(:get, '/bar/bar?a=1&b=3')
505
- controller.body.should == "1 3"
506
- end
507
-
508
- it "should use optional arguments in parameters if they exist" do
509
- controller, action = request(:get, '/bar/bar?a=1')
510
- controller.body.should == "1 2"
511
- end
512
-
513
- it "should use optional arguments even if a later argument is provided" do
514
- controller, action = request(:get, '/bar/baz?a=1&c=5')
515
- controller.body.should == "1 2 5"
516
- end
517
-
518
- it "should support actionargs with false as defaults" do
519
- controller, action = request(:get, '/bar/bat?a=1')
520
- controller.body.should == "1 false"
521
- end
522
-
523
- it "should support actionargs with nil as defaults" do
524
- controller, action = request(:get, '/bar/bam?a=1')
525
- controller.body.should == "1 nil"
526
- end
527
- end
528
- end