merb-core 0.9.7 → 0.9.8

Sign up to get free protection for your applications and to get access to all the features.
Files changed (274) hide show
  1. data/CHANGELOG +136 -2
  2. data/CONTRIBUTORS +6 -0
  3. data/PUBLIC_CHANGELOG +38 -0
  4. data/Rakefile +38 -30
  5. data/lib/merb-core.rb +88 -23
  6. data/lib/merb-core/bootloader.rb +235 -51
  7. data/lib/merb-core/config.rb +121 -36
  8. data/lib/merb-core/controller/abstract_controller.rb +59 -36
  9. data/lib/merb-core/controller/exceptions.rb +2 -15
  10. data/lib/merb-core/controller/merb_controller.rb +44 -1
  11. data/lib/merb-core/controller/mime.rb +4 -0
  12. data/lib/merb-core/controller/mixins/controller.rb +38 -21
  13. data/lib/merb-core/controller/mixins/render.rb +44 -29
  14. data/lib/merb-core/controller/mixins/responder.rb +3 -31
  15. data/lib/merb-core/controller/template.rb +45 -21
  16. data/lib/merb-core/core_ext/kernel.rb +60 -32
  17. data/lib/merb-core/dispatch/default_exception/default_exception.rb +2 -2
  18. data/lib/merb-core/dispatch/default_exception/views/_css.html.erb +3 -1
  19. data/lib/merb-core/dispatch/default_exception/views/_javascript.html.erb +71 -67
  20. data/lib/merb-core/dispatch/default_exception/views/index.html.erb +7 -3
  21. data/lib/merb-core/dispatch/dispatcher.rb +3 -3
  22. data/lib/merb-core/dispatch/request.rb +56 -9
  23. data/lib/merb-core/dispatch/router.rb +159 -133
  24. data/lib/merb-core/dispatch/router/behavior.rb +462 -703
  25. data/lib/merb-core/dispatch/router/cached_proc.rb +3 -3
  26. data/lib/merb-core/dispatch/router/resources.rb +289 -0
  27. data/lib/merb-core/dispatch/router/route.rb +514 -294
  28. data/lib/merb-core/dispatch/session.rb +4 -2
  29. data/lib/merb-core/logger.rb +213 -202
  30. data/lib/merb-core/plugins.rb +9 -1
  31. data/lib/merb-core/rack.rb +3 -1
  32. data/lib/merb-core/rack/adapter.rb +7 -4
  33. data/lib/merb-core/rack/adapter/abstract.rb +188 -0
  34. data/lib/merb-core/rack/adapter/ebb.rb +12 -13
  35. data/lib/merb-core/rack/adapter/evented_mongrel.rb +2 -15
  36. data/lib/merb-core/rack/adapter/irb.rb +3 -2
  37. data/lib/merb-core/rack/adapter/mongrel.rb +22 -15
  38. data/lib/merb-core/rack/adapter/swiftiplied_mongrel.rb +4 -16
  39. data/lib/merb-core/rack/adapter/thin.rb +21 -22
  40. data/lib/merb-core/rack/adapter/thin_turbo.rb +4 -11
  41. data/lib/merb-core/rack/adapter/webrick.rb +54 -18
  42. data/lib/merb-core/rack/application.rb +4 -4
  43. data/lib/merb-core/rack/handler/mongrel.rb +12 -13
  44. data/lib/merb-core/rack/middleware/csrf.rb +1 -1
  45. data/lib/merb-core/rack/stream_wrapper.rb +41 -0
  46. data/lib/merb-core/server.rb +157 -90
  47. data/lib/merb-core/tasks/gem_management.rb +267 -0
  48. data/lib/merb-core/tasks/merb.rb +1 -0
  49. data/lib/merb-core/tasks/merb_rake_helper.rb +48 -34
  50. data/lib/merb-core/tasks/stats.rake +1 -1
  51. data/lib/merb-core/test.rb +9 -3
  52. data/lib/merb-core/test/helpers.rb +1 -0
  53. data/lib/merb-core/test/helpers/mock_request_helper.rb +393 -0
  54. data/lib/merb-core/test/helpers/multipart_request_helper.rb +3 -2
  55. data/lib/merb-core/test/helpers/request_helper.rb +40 -372
  56. data/lib/merb-core/test/helpers/route_helper.rb +16 -2
  57. data/lib/merb-core/test/matchers.rb +1 -0
  58. data/lib/merb-core/test/matchers/controller_matchers.rb +4 -247
  59. data/lib/merb-core/test/matchers/request_matchers.rb +140 -0
  60. data/lib/merb-core/test/matchers/view_matchers.rb +22 -4
  61. data/lib/merb-core/test/run_specs.rb +118 -26
  62. data/lib/merb-core/test/test_ext/rspec.rb +181 -0
  63. data/lib/merb-core/version.rb +1 -9
  64. metadata +10 -342
  65. data/docs/bootloading.dox +0 -58
  66. data/docs/documentation_standards +0 -40
  67. data/docs/merb-core-call-stack-diagram.mmap +0 -0
  68. data/docs/merb-core-call-stack-diagram.pdf +0 -0
  69. data/docs/merb-core-call-stack-diagram.png +0 -0
  70. data/docs/new_render_api +0 -51
  71. data/lib/merb-core/vendor/facets.rb +0 -2
  72. data/lib/merb-core/vendor/facets/dictionary.rb +0 -433
  73. data/lib/merb-core/vendor/facets/inflect.rb +0 -342
  74. data/spec/private/config/adapter_spec.rb +0 -32
  75. data/spec/private/config/config_spec.rb +0 -202
  76. data/spec/private/config/environment_spec.rb +0 -13
  77. data/spec/private/config/merb_spec.rb +0 -34
  78. data/spec/private/config/spec_helper.rb +0 -1
  79. data/spec/private/core_ext/kernel_spec.rb +0 -159
  80. data/spec/private/dispatch/bootloader_spec.rb +0 -24
  81. data/spec/private/dispatch/fixture/app/controllers/application.rb +0 -4
  82. data/spec/private/dispatch/fixture/app/controllers/exceptions.rb +0 -25
  83. data/spec/private/dispatch/fixture/app/controllers/foo.rb +0 -19
  84. data/spec/private/dispatch/fixture/app/helpers/global_helpers.rb +0 -8
  85. data/spec/private/dispatch/fixture/app/views/exeptions/client_error.html.erb +0 -37
  86. data/spec/private/dispatch/fixture/app/views/exeptions/internal_server_error.html.erb +0 -216
  87. data/spec/private/dispatch/fixture/app/views/exeptions/not_acceptable.html.erb +0 -38
  88. data/spec/private/dispatch/fixture/app/views/exeptions/not_found.html.erb +0 -40
  89. data/spec/private/dispatch/fixture/app/views/foo/bar.html.erb +0 -0
  90. data/spec/private/dispatch/fixture/app/views/layout/application.html.erb +0 -11
  91. data/spec/private/dispatch/fixture/config/black_hole.rb +0 -12
  92. data/spec/private/dispatch/fixture/config/environments/development.rb +0 -6
  93. data/spec/private/dispatch/fixture/config/environments/production.rb +0 -5
  94. data/spec/private/dispatch/fixture/config/environments/test.rb +0 -6
  95. data/spec/private/dispatch/fixture/config/init.rb +0 -45
  96. data/spec/private/dispatch/fixture/config/rack.rb +0 -11
  97. data/spec/private/dispatch/fixture/config/router.rb +0 -35
  98. data/spec/private/dispatch/fixture/log/merb_test.log +0 -8839
  99. data/spec/private/dispatch/fixture/public/images/merb.jpg +0 -0
  100. data/spec/private/dispatch/fixture/public/merb.fcgi +0 -4
  101. data/spec/private/dispatch/fixture/public/stylesheets/master.css +0 -119
  102. data/spec/private/dispatch/route_params_spec.rb +0 -23
  103. data/spec/private/dispatch/spec_helper.rb +0 -1
  104. data/spec/private/router/behavior_spec.rb +0 -60
  105. data/spec/private/router/fixture/log/merb_test.log +0 -35
  106. data/spec/private/router/route_spec.rb +0 -418
  107. data/spec/private/router/router_spec.rb +0 -183
  108. data/spec/private/vendor/facets/plural_spec.rb +0 -564
  109. data/spec/private/vendor/facets/singular_spec.rb +0 -489
  110. data/spec/public/DEFINITIONS +0 -11
  111. data/spec/public/abstract_controller/controllers/alt_views/layout/application.erb +0 -1
  112. data/spec/public/abstract_controller/controllers/alt_views/layout/merb/test/fixtures/abstract/render_string_controller_layout.erb +0 -1
  113. data/spec/public/abstract_controller/controllers/alt_views/layout/merb/test/fixtures/abstract/render_template_controller_layout.erb +0 -1
  114. data/spec/public/abstract_controller/controllers/alt_views/merb/test/fixtures/abstract/display_object_with_multiple_roots/index.erb +0 -1
  115. data/spec/public/abstract_controller/controllers/alt_views/merb/test/fixtures/abstract/display_object_with_multiple_roots/show.erb +0 -1
  116. data/spec/public/abstract_controller/controllers/alt_views/merb/test/fixtures/abstract/render_template_multiple_roots/index.erb +0 -1
  117. data/spec/public/abstract_controller/controllers/alt_views/partial/basic_partial_with_multiple_roots/_partial.erb +0 -1
  118. data/spec/public/abstract_controller/controllers/alt_views/render_template_multiple_roots_and_custom_location/index.erb +0 -1
  119. data/spec/public/abstract_controller/controllers/alt_views/render_template_multiple_roots_inherited/index.erb +0 -1
  120. data/spec/public/abstract_controller/controllers/cousins.rb +0 -41
  121. data/spec/public/abstract_controller/controllers/display.rb +0 -60
  122. data/spec/public/abstract_controller/controllers/filters.rb +0 -260
  123. data/spec/public/abstract_controller/controllers/helpers.rb +0 -41
  124. data/spec/public/abstract_controller/controllers/partial.rb +0 -121
  125. data/spec/public/abstract_controller/controllers/render.rb +0 -113
  126. data/spec/public/abstract_controller/controllers/views/helpers/capture/index.erb +0 -1
  127. data/spec/public/abstract_controller/controllers/views/helpers/capture_eq/index.erb +0 -1
  128. data/spec/public/abstract_controller/controllers/views/helpers/capture_with_args/index.erb +0 -1
  129. data/spec/public/abstract_controller/controllers/views/helpers/concat/index.erb +0 -1
  130. data/spec/public/abstract_controller/controllers/views/layout/alt.erb +0 -1
  131. data/spec/public/abstract_controller/controllers/views/layout/custom.erb +0 -1
  132. data/spec/public/abstract_controller/controllers/views/merb/test/fixtures/abstract/display_object/index.erb +0 -1
  133. data/spec/public/abstract_controller/controllers/views/merb/test/fixtures/abstract/display_object_with_action/new.erb +0 -1
  134. data/spec/public/abstract_controller/controllers/views/merb/test/fixtures/abstract/render_template/index.erb +0 -1
  135. data/spec/public/abstract_controller/controllers/views/merb/test/fixtures/abstract/render_template_app_layout/index.erb +0 -0
  136. data/spec/public/abstract_controller/controllers/views/merb/test/fixtures/abstract/render_template_custom_layout/index.erb +0 -1
  137. data/spec/public/abstract_controller/controllers/views/merb/test/fixtures/abstract/render_template_multiple_roots/index.erb +0 -1
  138. data/spec/public/abstract_controller/controllers/views/merb/test/fixtures/abstract/render_template_multiple_roots/show.erb +0 -1
  139. data/spec/public/abstract_controller/controllers/views/merb/test/fixtures/abstract/render_two_throw_contents/index.erb +0 -1
  140. data/spec/public/abstract_controller/controllers/views/partial/another_directory/_partial.erb +0 -1
  141. data/spec/public/abstract_controller/controllers/views/partial/basic_partial/_partial.erb +0 -1
  142. data/spec/public/abstract_controller/controllers/views/partial/basic_partial/index.erb +0 -1
  143. data/spec/public/abstract_controller/controllers/views/partial/basic_partial_with_multiple_roots/index.erb +0 -1
  144. data/spec/public/abstract_controller/controllers/views/partial/nested_partial/_first.erb +0 -1
  145. data/spec/public/abstract_controller/controllers/views/partial/nested_partial/_second.erb +0 -1
  146. data/spec/public/abstract_controller/controllers/views/partial/nested_partial/index.erb +0 -1
  147. data/spec/public/abstract_controller/controllers/views/partial/partial_in_another_directory/index.erb +0 -1
  148. data/spec/public/abstract_controller/controllers/views/partial/partial_with_both/_collection.erb +0 -1
  149. data/spec/public/abstract_controller/controllers/views/partial/partial_with_both/index.erb +0 -1
  150. data/spec/public/abstract_controller/controllers/views/partial/partial_with_collections/_collection.erb +0 -1
  151. data/spec/public/abstract_controller/controllers/views/partial/partial_with_collections/index.erb +0 -1
  152. data/spec/public/abstract_controller/controllers/views/partial/partial_with_collections_and_as/_collection.erb +0 -1
  153. data/spec/public/abstract_controller/controllers/views/partial/partial_with_collections_and_as/index.erb +0 -1
  154. data/spec/public/abstract_controller/controllers/views/partial/partial_with_collections_and_counter/_collection.erb +0 -1
  155. data/spec/public/abstract_controller/controllers/views/partial/partial_with_collections_and_counter/index.erb +0 -1
  156. data/spec/public/abstract_controller/controllers/views/partial/partial_with_locals/_variables.erb +0 -1
  157. data/spec/public/abstract_controller/controllers/views/partial/partial_with_locals/index.erb +0 -1
  158. data/spec/public/abstract_controller/controllers/views/partial/partial_with_with_and_locals/_both.erb +0 -1
  159. data/spec/public/abstract_controller/controllers/views/partial/partial_with_with_and_locals/index.erb +0 -1
  160. data/spec/public/abstract_controller/controllers/views/partial/with_absolute_partial/_partial.erb +0 -1
  161. data/spec/public/abstract_controller/controllers/views/partial/with_absolute_partial/index.erb +0 -1
  162. data/spec/public/abstract_controller/controllers/views/partial/with_as_partial/_with_partial.erb +0 -1
  163. data/spec/public/abstract_controller/controllers/views/partial/with_as_partial/index.erb +0 -1
  164. data/spec/public/abstract_controller/controllers/views/partial/with_nil_partial/_with_partial.erb +0 -1
  165. data/spec/public/abstract_controller/controllers/views/partial/with_nil_partial/index.erb +0 -1
  166. data/spec/public/abstract_controller/controllers/views/partial/with_partial/_with_partial.erb +0 -1
  167. data/spec/public/abstract_controller/controllers/views/partial/with_partial/index.erb +0 -1
  168. data/spec/public/abstract_controller/controllers/views/test_display/foo.html.erb +0 -1
  169. data/spec/public/abstract_controller/controllers/views/test_render/foo.html.erb +0 -0
  170. data/spec/public/abstract_controller/controllers/views/wonderful/index.erb +0 -1
  171. data/spec/public/abstract_controller/display_spec.rb +0 -37
  172. data/spec/public/abstract_controller/filter_spec.rb +0 -136
  173. data/spec/public/abstract_controller/helper_spec.rb +0 -21
  174. data/spec/public/abstract_controller/partial_spec.rb +0 -61
  175. data/spec/public/abstract_controller/render_spec.rb +0 -90
  176. data/spec/public/abstract_controller/spec_helper.rb +0 -31
  177. data/spec/public/boot_loader/boot_loader_spec.rb +0 -33
  178. data/spec/public/boot_loader/spec_helper.rb +0 -1
  179. data/spec/public/controller/authentication_spec.rb +0 -174
  180. data/spec/public/controller/base_spec.rb +0 -88
  181. data/spec/public/controller/conditional_get_spec.rb +0 -100
  182. data/spec/public/controller/config/init.rb +0 -6
  183. data/spec/public/controller/controllers/authentication.rb +0 -74
  184. data/spec/public/controller/controllers/base.rb +0 -65
  185. data/spec/public/controller/controllers/conditional_get.rb +0 -35
  186. data/spec/public/controller/controllers/cookies.rb +0 -36
  187. data/spec/public/controller/controllers/dispatcher.rb +0 -35
  188. data/spec/public/controller/controllers/display.rb +0 -118
  189. data/spec/public/controller/controllers/redirect.rb +0 -36
  190. data/spec/public/controller/controllers/responder.rb +0 -93
  191. data/spec/public/controller/controllers/url.rb +0 -7
  192. data/spec/public/controller/controllers/views/layout/custom.html.erb +0 -1
  193. data/spec/public/controller/controllers/views/layout/custom_arg.html.erb +0 -1
  194. data/spec/public/controller/controllers/views/layout/custom_arg.json.erb +0 -1
  195. data/spec/public/controller/controllers/views/merb/test/fixtures/controllers/class_and_local_provides/index.html.erb +0 -1
  196. data/spec/public/controller/controllers/views/merb/test/fixtures/controllers/class_and_local_provides/index.xml.erb +0 -1
  197. data/spec/public/controller/controllers/views/merb/test/fixtures/controllers/class_provides/index.html.erb +0 -1
  198. data/spec/public/controller/controllers/views/merb/test/fixtures/controllers/class_provides/index.xml.erb +0 -1
  199. data/spec/public/controller/controllers/views/merb/test/fixtures/controllers/display_with_template/index.html.erb +0 -1
  200. data/spec/public/controller/controllers/views/merb/test/fixtures/controllers/display_with_template/no_layout.html.erb +0 -1
  201. data/spec/public/controller/controllers/views/merb/test/fixtures/controllers/display_with_template_argument/index.html.erb +0 -1
  202. data/spec/public/controller/controllers/views/merb/test/fixtures/controllers/html_default/index.html.erb +0 -1
  203. data/spec/public/controller/controllers/views/merb/test/fixtures/controllers/layout/custom.html.erb +0 -1
  204. data/spec/public/controller/controllers/views/merb/test/fixtures/controllers/local_provides/index.html.erb +0 -1
  205. data/spec/public/controller/controllers/views/merb/test/fixtures/controllers/local_provides/index.xml.erb +0 -1
  206. data/spec/public/controller/controllers/views/merb/test/fixtures/controllers/multi_provides/index.html.erb +0 -1
  207. data/spec/public/controller/controllers/views/merb/test/fixtures/controllers/multi_provides/index.js.erb +0 -1
  208. data/spec/public/controller/cookies_spec.rb +0 -95
  209. data/spec/public/controller/dispatcher_spec.rb +0 -410
  210. data/spec/public/controller/display_spec.rb +0 -84
  211. data/spec/public/controller/redirect_spec.rb +0 -33
  212. data/spec/public/controller/responder_spec.rb +0 -169
  213. data/spec/public/controller/spec_helper.rb +0 -13
  214. data/spec/public/controller/url_spec.rb +0 -255
  215. data/spec/public/core/merb_core_spec.rb +0 -45
  216. data/spec/public/core_ext/fixtures/core_ext_dependency.rb +0 -2
  217. data/spec/public/core_ext/kernel_spec.rb +0 -88
  218. data/spec/public/core_ext/spec_helper.rb +0 -1
  219. data/spec/public/directory_structure/directory/app/controllers/application.rb +0 -3
  220. data/spec/public/directory_structure/directory/app/controllers/base.rb +0 -13
  221. data/spec/public/directory_structure/directory/app/controllers/custom.rb +0 -19
  222. data/spec/public/directory_structure/directory/app/views/base/template.html.erb +0 -1
  223. data/spec/public/directory_structure/directory/app/views/wonderful/template.erb +0 -1
  224. data/spec/public/directory_structure/directory/config/router.rb +0 -3
  225. data/spec/public/directory_structure/directory/log/merb_test.log +0 -4588
  226. data/spec/public/directory_structure/directory_spec.rb +0 -43
  227. data/spec/public/logger/logger_spec.rb +0 -181
  228. data/spec/public/logger/spec_helper.rb +0 -1
  229. data/spec/public/rack/conditinal_get_middleware_spec.rb +0 -127
  230. data/spec/public/rack/csrf_middleware_spec.rb +0 -70
  231. data/spec/public/rack/rack_middleware_spec.rb +0 -99
  232. data/spec/public/rack/shared_example_groups.rb +0 -35
  233. data/spec/public/reloading/directory/app/controllers/application.rb +0 -3
  234. data/spec/public/reloading/directory/app/controllers/reload.rb +0 -6
  235. data/spec/public/reloading/directory/config/init.rb +0 -2
  236. data/spec/public/reloading/directory/log/merb_test.log +0 -288231
  237. data/spec/public/reloading/reload_spec.rb +0 -103
  238. data/spec/public/request/multipart_spec.rb +0 -41
  239. data/spec/public/request/request_spec.rb +0 -250
  240. data/spec/public/router/default_spec.rb +0 -21
  241. data/spec/public/router/deferred_spec.rb +0 -22
  242. data/spec/public/router/fixation_spec.rb +0 -49
  243. data/spec/public/router/fixture/log/merb_test.log +0 -524
  244. data/spec/public/router/namespace_spec.rb +0 -113
  245. data/spec/public/router/nested_matches_spec.rb +0 -97
  246. data/spec/public/router/nested_resources_spec.rb +0 -41
  247. data/spec/public/router/resource_spec.rb +0 -37
  248. data/spec/public/router/resources_spec.rb +0 -82
  249. data/spec/public/router/spec_helper.rb +0 -90
  250. data/spec/public/router/special_spec.rb +0 -61
  251. data/spec/public/router/string_spec.rb +0 -61
  252. data/spec/public/session/controllers/sessions.rb +0 -56
  253. data/spec/public/session/cookie_session_spec.rb +0 -73
  254. data/spec/public/session/memcached_session_spec.rb +0 -31
  255. data/spec/public/session/memory_session_spec.rb +0 -28
  256. data/spec/public/session/multiple_sessions_spec.rb +0 -74
  257. data/spec/public/session/no_session_spec.rb +0 -12
  258. data/spec/public/session/session_spec.rb +0 -106
  259. data/spec/public/template/template_spec.rb +0 -104
  260. data/spec/public/template/templates/error.html.erb +0 -2
  261. data/spec/public/template/templates/template.html.erb +0 -1
  262. data/spec/public/template/templates/template.html.myt +0 -1
  263. data/spec/public/test/controller_matchers_spec.rb +0 -412
  264. data/spec/public/test/controllers/controller_assertion_mock.rb +0 -7
  265. data/spec/public/test/controllers/dispatch_controller.rb +0 -11
  266. data/spec/public/test/controllers/spec_helper_controller.rb +0 -39
  267. data/spec/public/test/multipart_request_helper_spec.rb +0 -159
  268. data/spec/public/test/multipart_upload_text_file.txt +0 -1
  269. data/spec/public/test/request_helper_spec.rb +0 -269
  270. data/spec/public/test/route_helper_spec.rb +0 -78
  271. data/spec/public/test/route_matchers_spec.rb +0 -166
  272. data/spec/public/test/view_helper_spec.rb +0 -96
  273. data/spec/public/test/view_matchers_spec.rb +0 -183
  274. data/spec/spec_helper.rb +0 -121
@@ -1,84 +0,0 @@
1
- require File.join(File.dirname(__FILE__), "spec_helper")
2
-
3
- describe Merb::Controller, " displaying objects based on mime type" do
4
-
5
- before do
6
- Merb::Router.prepare do |r|
7
- r.default_routes
8
- end
9
- end
10
-
11
- it "should default the mime-type to HTML (and raise since there's no to_html)" do
12
- running { dispatch_to(Merb::Test::Fixtures::Controllers::DisplayHtmlDefault, :index) }.should raise_error(Merb::ControllerExceptions::NotAcceptable)
13
- end
14
-
15
- it "should set headers['Location'] to string provided by :location" do
16
- dispatch_to(Merb::Test::Fixtures::Controllers::DisplayWithStringLocation, :index, {}, :http_accept => "application/json").headers['Location'].should =~ /some_resources/
17
- end
18
-
19
- it "should set the status to a code provided by :status" do
20
- dispatch_to(Merb::Test::Fixtures::Controllers::DisplayWithStatus, :index, {}, :http_accept => "application/json").status.should == 500
21
- end
22
-
23
- it "should use a template if specified" do
24
- dispatch_to(Merb::Test::Fixtures::Controllers::DisplayWithTemplate, :index).body.should match(/Custom: Template/)
25
- end
26
-
27
- it "overrides layout settings with render :layout => false" do
28
- dispatch_to(Merb::Test::Fixtures::Controllers::DisplayWithTemplate, :no_layout).body.should_not match(/Custom: Template/)
29
- end
30
-
31
- it "should accept an absolute template path argument - with the mimetype extension" do
32
- dispatch_to(Merb::Test::Fixtures::Controllers::DisplayWithTemplate, :absolute_with_mime).body.should == "Custom: HTML: Default"
33
- end
34
-
35
- it "should accept an absolute template path argument - without the mimetype extension" do
36
- dispatch_to(Merb::Test::Fixtures::Controllers::DisplayWithTemplate, :absolute_without_mime).body.should == "Custom: HTML: Default"
37
- end
38
-
39
- it "should accept a relative template path argument - with the mimetype extension" do
40
- dispatch_to(Merb::Test::Fixtures::Controllers::DisplayWithTemplate, :relative_with_mime).body.should == "Custom: HTML: Default"
41
- end
42
-
43
- it "should accept a relative template path argument - without the mimetype extension" do
44
- dispatch_to(Merb::Test::Fixtures::Controllers::DisplayWithTemplate, :relative_without_mime).body.should == "Custom: HTML: Default"
45
- end
46
-
47
- it "should accept a layout argument when calling to_*" do
48
- dispatch_to(Merb::Test::Fixtures::Controllers::DisplayWithLayout, :index, {},
49
- :http_accept => "application/json").body.should == "{custom_arg: { 'include': '', 'exclude': '' }}"
50
- end
51
-
52
- it "should accept a layout argument with a template" do
53
- dispatch_to(Merb::Test::Fixtures::Controllers::DisplayWithTemplateArgument, :index).body.should == "Custom Arg: Template"
54
- end
55
-
56
- it "should accept a template path argument" do
57
- dispatch_to(Merb::Test::Fixtures::Controllers::DisplayWithTemplateArgument, :index_by_arg).body.should == "Template"
58
- end
59
-
60
- it "should use other mime-types if they are provided on the class level" do
61
- controller = dispatch_to(Merb::Test::Fixtures::Controllers::DisplayClassProvides, :index, {}, :http_accept => "application/xml")
62
- controller.body.should == "<XML:Model />"
63
- end
64
-
65
- it "should fail if none of the acceptable mime-types are available" do
66
- calling { dispatch_to(Merb::Test::Fixtures::Controllers::DisplayClassProvides, :index, {}, :http_accept => "application/json") }.
67
- should raise_error(Merb::ControllerExceptions::NotAcceptable)
68
- end
69
-
70
- it "should use mime-types that are provided at the local level" do
71
- controller = dispatch_to(Merb::Test::Fixtures::Controllers::DisplayLocalProvides, :index, {}, :http_accept => "application/xml")
72
- controller.body.should == "<XML:Model />"
73
- end
74
-
75
- it "passes all options to serialization method like :to_json" do
76
- controller = dispatch_to(Merb::Test::Fixtures::Controllers::DisplayWithSerializationOptions, :index, {}, :http_accept => "application/json")
77
- controller.body.should == "{ 'include': 'beer, jazz', 'exclude': 'idiots' }"
78
- end
79
-
80
- it "passes single argument to serialization method like :to_json" do
81
- controller = dispatch_to(Merb::Test::Fixtures::Controllers::DisplayWithSerializationOptions, :index_that_passes_empty_hash, {}, :http_accept => "application/json")
82
- controller.body.should == "{ 'include': '', 'exclude': '' }"
83
- end
84
- end
@@ -1,33 +0,0 @@
1
- require File.join(File.dirname(__FILE__), "spec_helper")
2
-
3
- describe Merb::Controller, " redirects" do
4
- it "redirects with simple URLs" do
5
- @controller = dispatch_to(Merb::Test::Fixtures::Controllers::SimpleRedirect, :index)
6
- @controller.status.should == 302
7
- @controller.headers["Location"].should == "/"
8
- end
9
-
10
- it "permanently redirects" do
11
- @controller = dispatch_to(Merb::Test::Fixtures::Controllers::PermanentRedirect, :index)
12
- @controller.status.should == 301
13
- @controller.headers["Location"].should == "/"
14
- end
15
-
16
- it "redirects with messages" do
17
- @controller = dispatch_to(Merb::Test::Fixtures::Controllers::RedirectWithMessage, :index)
18
- @controller.status.should == 302
19
- expected_url = Merb::Request.escape([Marshal.dump(:notice => "what?")].pack("m"))
20
- @controller.headers["Location"].should == "/?_message=#{expected_url}"
21
- end
22
-
23
- it "consumes redirects with messages" do
24
- message = Merb::Request.escape([Marshal.dump(:notice => "what?")].pack("m"))
25
- @controller = dispatch_to(Merb::Test::Fixtures::Controllers::ConsumesMessage, :index, {:_message => message})
26
- @controller.body.should == "\"what?\""
27
- end
28
-
29
- it "supports setting the message for use immediately" do
30
- @controller = dispatch_to(Merb::Test::Fixtures::Controllers::SetsMessage, :index)
31
- @controller.body.should == "Hello"
32
- end
33
- end
@@ -1,169 +0,0 @@
1
- require File.join(File.dirname(__FILE__), "spec_helper")
2
-
3
- describe Merb::Controller, " responds" do
4
-
5
- before do
6
- Merb.push_path(:layout, File.dirname(__FILE__) / "controllers" / "views" / "layouts")
7
- Merb::Router.prepare do |r|
8
- r.default_routes
9
- end
10
- end
11
-
12
- it "should default the mime-type to HTML" do
13
- dispatch_to(Merb::Test::Fixtures::Controllers::HtmlDefault, :index).body.should == "HTML: Default"
14
- end
15
-
16
- it "should use other mime-types if they are provided on the controller-level" do
17
- controller = dispatch_to(Merb::Test::Fixtures::Controllers::ClassProvides, :index, {}, :http_accept => "application/xml")
18
- controller.body.should == "<XML:Class provides='true' />"
19
- end
20
-
21
- it "should fail if none of the acceptable mime-types are available" do
22
- calling { dispatch_to(Merb::Test::Fixtures::Controllers::ClassProvides, :index, {}, :http_accept => "application/json") }.
23
- should raise_error(Merb::ControllerExceptions::NotAcceptable)
24
- end
25
-
26
- it "should use mime-types that are provided at the action-level" do
27
- controller = dispatch_to(Merb::Test::Fixtures::Controllers::LocalProvides, :index, {}, :http_accept => "application/xml")
28
- controller.body.should == "<XML:Local provides='true' />"
29
- end
30
-
31
- it "should use mime-types that are provided at the controller-level as well as the action-level (controller)" do
32
- controller = dispatch_to(Merb::Test::Fixtures::Controllers::ClassAndLocalProvides, :index, {}, :http_accept => "text/html")
33
- controller.class_provided_formats.should == [:html]
34
- controller._provided_formats.should == [:html, :xml]
35
- controller.body.should == "HTML: Class and Local"
36
- end
37
-
38
- it "should use mime-types that are provided at the controller-level as well as the action-level (action)" do
39
- controller = dispatch_to(Merb::Test::Fixtures::Controllers::ClassAndLocalProvides, :index, {}, :http_accept => "application/xml")
40
- controller.class_provided_formats.should == [:html]
41
- controller._provided_formats.should == [:html, :xml]
42
- controller.body.should == "<XML:ClassAndLocalProvides provides='true' />"
43
- end
44
-
45
- it "should use the first mime-type when accepting anything */*" do
46
- controller = dispatch_to(Merb::Test::Fixtures::Controllers::MultiProvides, :index, {}, :http_accept => "*/*")
47
- controller.body.should == "HTML: Multi"
48
- end
49
-
50
- it "should pick application/xhtml+xml when both application/xml and application/xhtml+xml are available" do
51
- controller = dispatch_to(Merb::Test::Fixtures::Controllers::ClassProvides,
52
- :index, {}, :http_accept => "application/xml,application/xhtml+xml")
53
- controller.body.should == "HTML: Wins Over XML If Both Are Specified"
54
- end
55
-
56
- it "should use the first mime-type when accepting anything */*, even if something unprovidable comes first" do
57
- controller = dispatch_to(Merb::Test::Fixtures::Controllers::HtmlDefault, :index, {}, :http_accept => "application/json, */*")
58
- controller.body.should == "HTML: Default"
59
- end
60
-
61
- it "should use the pick the first mime-type from the list not the */*" do
62
- controller = dispatch_to(Merb::Test::Fixtures::Controllers::MultiProvides, :index, {}, :http_accept => "text/javascript, */*")
63
- controller.body.should == "JS: Multi"
64
- end
65
-
66
- it "should pick the first mime-type if no specific supported content-type matches are *available*" do
67
- controller = dispatch_to(Merb::Test::Fixtures::Controllers::MultiProvides, :index, {}, :http_accept => "image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, application/x-shockwave-flash, */*")
68
- controller.body.should == "HTML: Multi"
69
- end
70
-
71
- it "should pick the first mime-type if no specific supported content-type matches are actually *provided*" do
72
- controller = dispatch_to(Merb::Test::Fixtures::Controllers::MultiProvides, :index, {}, :http_accept => "application/json, */*")
73
- controller.body.should == "HTML: Multi"
74
- end
75
-
76
- it "should select the format based on params supplied to it with controller-level provides" do
77
- controller = dispatch_to(Merb::Test::Fixtures::Controllers::ClassProvides, :index, :format => "xml")
78
- controller.content_type.should == :xml
79
- end
80
-
81
- it "should select the format based on params supplied to it with action-level provides" do
82
- controller = dispatch_to(Merb::Test::Fixtures::Controllers::LocalProvides, :index, :format => "xml")
83
- controller.content_type.should == :xml
84
- end
85
-
86
- it "should select the format based on params supplied to it with controller and action provides (controller)" do
87
- controller = dispatch_to(Merb::Test::Fixtures::Controllers::ClassAndLocalProvides, :index, :format => "html")
88
- controller.content_type.should == :html
89
- end
90
-
91
- it "should select the format based on params supplied to it with controller and action provides (action)" do
92
- controller = dispatch_to(Merb::Test::Fixtures::Controllers::ClassAndLocalProvides, :index, :format => "xml")
93
- controller.content_type.should == :xml
94
- end
95
-
96
- it "should properly add formats when only_provides is called in action" do
97
- controller = dispatch_to(Merb::Test::Fixtures::Controllers::OnlyProvides, :index, {}, :http_accept => "application/xml")
98
- controller._provided_formats.should == [:text, :xml]
99
- controller.content_type.should == :xml
100
- end
101
-
102
- it "should properly remove formats when only_provides is called in action" do
103
- controller = dispatch_to(Merb::Test::Fixtures::Controllers::OnlyProvides, :index, {}, :http_accept => "text/html")
104
- lambda { controller.content_type }.should raise_error(Merb::ControllerExceptions::NotAcceptable)
105
- end
106
-
107
- it "should properly add formats when only_provides is called in controller" do
108
- controller = dispatch_to(Merb::Test::Fixtures::Controllers::ClassOnlyProvides, :index, {}, :http_accept => "application/xml")
109
- controller._provided_formats.should == [:text, :xml]
110
- controller.content_type.should == :xml
111
- end
112
-
113
- it "should properly remove formats when only_provides is called in controller" do
114
- controller = dispatch_to(Merb::Test::Fixtures::Controllers::ClassOnlyProvides, :index, {}, :http_accept => "text/html")
115
- lambda { controller.content_type }.should raise_error(Merb::ControllerExceptions::NotAcceptable)
116
- end
117
-
118
- it "should properly remove formats when does_not_provide is called in controller" do
119
- controller = dispatch_to(Merb::Test::Fixtures::Controllers::ClassDoesntProvides, :index, {}, :http_accept => "text/html")
120
- controller._provided_formats.should == [:xml]
121
- lambda { controller.content_type }.should raise_error(Merb::ControllerExceptions::NotAcceptable)
122
- end
123
-
124
- it "should properly remove formats when does_not_provide is called in action" do
125
- controller = dispatch_to(Merb::Test::Fixtures::Controllers::DoesntProvide, :index, {}, :http_accept => "text/html")
126
- controller._provided_formats.should == [:xml]
127
- lambda { controller.content_type }.should raise_error(Merb::ControllerExceptions::NotAcceptable)
128
- end
129
-
130
- it "should return the correct default HTTP headers for a format" do
131
- controller = dispatch_to(Merb::Test::Fixtures::Controllers::ClassProvides, :index, :format => "xml")
132
- controller.headers.keys.sort.should == ["Content-Type"]
133
- controller.headers["Content-Type"].should == "application/xml; charset=utf-8"
134
- end
135
-
136
- it "should append the correct charset which was set when the format was added" do
137
- Merb.add_mime_type(:foo, nil, %w[application/foo], :charset => "iso-8859-1")
138
- controller = dispatch_to(Merb::Test::Fixtures::Controllers::FooFormatProvides, :index, :format => "foo")
139
- controller.headers["Content-Type"].should == "application/foo; charset=iso-8859-1"
140
- end
141
-
142
- it "should return the correct HTTP headers which were set when the format was added" do
143
- Merb.add_mime_type(:foo, nil, %w[application/foo], "Foo" => 'bar', "Content-Language" => "en", :charset => "utf-8")
144
- controller = dispatch_to(Merb::Test::Fixtures::Controllers::FooFormatProvides, :index, :format => "foo")
145
- controller.headers.keys.should_not include(:charset)
146
- controller.headers["Content-Type"].should == "application/foo; charset=utf-8"
147
- controller.headers["Content-Language"].should == "en"
148
- controller.headers["Foo"] = "bar"
149
- end
150
-
151
- it "should return the correct HTTP headers using the block given when the format was added" do
152
- Merb.add_mime_type(:foo, nil, %w[application/foo], "Foo" => "bar") do |controller|
153
- controller.headers["Action-Name"] = controller.action_name
154
- end
155
- controller = dispatch_to(Merb::Test::Fixtures::Controllers::FooFormatProvides, :index, :format => "foo")
156
- controller.headers["Content-Type"].should == "application/foo"
157
- controller.headers["Action-Name"].should == "index"
158
- controller.headers["Foo"] = "bar"
159
- end
160
-
161
- it "should not overwrite runtime-set headers with default format response headers" do
162
- Merb.add_mime_type(:foo, nil, %w[application/foo], "Foo" => "bar", "Content-Language" => "en")
163
- controller = dispatch_to(Merb::Test::Fixtures::Controllers::FooFormatProvides, :show, :format => "foo")
164
- controller.headers["Content-Language"].should == "nl"
165
- controller.headers["Biz"] = "buzz"
166
- controller.headers["Foo"] = "bar"
167
- end
168
-
169
- end
@@ -1,13 +0,0 @@
1
- __DIR__ = File.dirname(__FILE__)
2
-
3
- require File.join(__DIR__, "..", "..", "spec_helper")
4
-
5
- require File.join(__DIR__, "controllers", "base")
6
- require File.join(__DIR__, "controllers", "responder")
7
- require File.join(__DIR__, "controllers", "display")
8
- require File.join(__DIR__, "controllers", "authentication")
9
- require File.join(__DIR__, "controllers", "redirect")
10
- require File.join(__DIR__, "controllers", "cookies")
11
- require File.join(__DIR__, "controllers", "conditional_get")
12
-
13
- Merb.start :environment => 'test', :init_file => File.join(__DIR__, 'config', 'init')
@@ -1,255 +0,0 @@
1
- require File.join(File.dirname(__FILE__), "spec_helper")
2
- require File.join(File.dirname(__FILE__), "controllers", "url")
3
-
4
- class Monkey ; def to_param ; 45 ; end ; end
5
- class Donkey ; def to_param ; 19 ; end ; end
6
- class Blue
7
- def to_param ; 13 ; end
8
- def monkey_id ; Monkey.new ; end
9
- def donkey_id ; Donkey.new ; end
10
- end
11
- class Pink
12
- def to_param ; 22 ; end
13
- def blue_id ; Blue.new ; end
14
- def monkey_id ; blue_id.monkey_id ; end
15
- end
16
-
17
- Merb::Router.prepare do |r|
18
- r.default_routes
19
- r.resources :monkeys do |m|
20
- m.resources :blues do |b|
21
- b.resources :pinks
22
- end
23
- end
24
- r.resources :donkeys do |d|
25
- d.resources :blues
26
- end
27
- r.resource :red do |red|
28
- red.resources :blues
29
- end
30
- r.match(%r{/foo/(\d+)/}).to(:controller => 'asdf').name(:regexp)
31
- r.match('/people/:name').
32
- to(:controller => 'people', :action => 'show').name(:person)
33
- r.match('/argstrs').to(:controller => "args").name(:args)
34
- end
35
-
36
- describe Merb::Controller, " url" do
37
-
38
- before do
39
- @controller = dispatch_to(Merb::Test::Fixtures::Controllers::Url, :index)
40
- end
41
-
42
- it "should match the :controller to the default route" do
43
- @controller.url(:controller => "monkeys").should eql("/monkeys")
44
- end
45
-
46
- it "should match the :controller,:action to the default route" do
47
- @controller.url(:controller => "monkeys", :action => "list").
48
- should eql("/monkeys/list")
49
- end
50
-
51
- it "should match the :controller,:action,:id to the default route" do
52
- @controller.url(:controller => "monkeys", :action => "list", :id => 4).
53
- should eql("/monkeys/list/4")
54
- end
55
-
56
- it "should match the :controller,:action,:id,:format to the default route" do
57
- @controller.url(:controller => "monkeys", :action => "list", :id => 4, :format => "xml").
58
- should eql("/monkeys/list/4.xml")
59
- end
60
-
61
- it "should match the :controller,:action,:id,:format,:fragment to the default route" do
62
- @controller.url(:controller => "monkeys", :action => "list", :id => 4, :format => "xml", :fragment => :half_way).
63
- should eql("/monkeys/list/4.xml#half_way")
64
- end
65
-
66
- it "should raise an error" do
67
- lambda { @controller.url(:regexp) }.should raise_error
68
- end
69
-
70
- it "should match with a route param" do
71
- @controller.url(:person, :name => "david").should eql("/people/david")
72
- end
73
-
74
- it "should match without a route param" do
75
- @controller.url(:person).should eql("/people/")
76
- end
77
-
78
- it "should match with an additional param" do
79
- @controller.url(:person, :name => 'david', :color => 'blue').should eql("/people/david?color=blue")
80
- end
81
-
82
- it "should match with a :format" do
83
- @controller.url(:person, :name => 'david', :format => :xml).should eql("/people/david.xml")
84
- end
85
-
86
- it "should match with a :fragment" do
87
- @controller.url(:person, :name => 'david', :fragment => :half_way).should eql("/people/david#half_way")
88
- end
89
-
90
- it "should match with an additional param and :format" do
91
- @controller.url(:person, :name => 'david', :color => 'blue', :format => :xml).should eql("/people/david.xml?color=blue")
92
- end
93
-
94
- it "should match with an additional param, :format, and :fragment" do
95
- @controller.url(:person, :name => 'david', :color => 'blue', :format => :xml, :fragment => :half_way).
96
- should eql("/people/david.xml?color=blue#half_way")
97
- end
98
-
99
- it "should match with additional params" do
100
- url = @controller.url(:person, :name => 'david', :smell => 'funky', :color => 'blue')
101
- url.should match(%r{/people/david?.*color=blue})
102
- url.should match(%r{/people/david?.*smell=funky})
103
- end
104
-
105
- it "should match with extra params and an array" do
106
- @controller.url(:args, :monkey => [1,2]).should == "/argstrs?monkey[]=1&monkey[]=2"
107
- end
108
-
109
- it "should match with no second arg" do
110
- @controller.url(:monkeys).should == "/monkeys"
111
- end
112
-
113
- it "should match with an object as second arg" do
114
- @monkey = Monkey.new
115
- @controller.url(:monkey, @monkey).should == "/monkeys/45"
116
- end
117
-
118
- it "should match with a fixnum as second arg" do
119
- @controller.url(:monkey, 3).should == "/monkeys/3"
120
- end
121
-
122
- it "should match with an object and :format" do
123
- @monkey = Monkey.new
124
- @controller.url(:monkey, :id => @monkey, :format => :xml).should == "/monkeys/45.xml"
125
- end
126
-
127
- it "should match with an object, :format and additional options" do
128
- @monkey = Monkey.new
129
- @controller.url(:monkey, :id => @monkey, :format => :xml, :color => "blue").should == "/monkeys/45.xml?color=blue"
130
- end
131
-
132
- it "should match with an object, :format, :fragment, and additional options" do
133
- @monkey = Monkey.new
134
- @controller.url(:monkey, :id => @monkey, :format => :xml, :color => "blue", :fragment => :half_way).should == "/monkeys/45.xml?color=blue#half_way"
135
- end
136
-
137
- it "should match the delete_monkey route" do
138
- @monkey = Monkey.new
139
- @controller.url(:delete_monkey, @monkey).should == "/monkeys/45/delete"
140
- end
141
-
142
- it "should match the delete_red route" do
143
- @controller.url(:delete_red).should == "/red/delete"
144
- end
145
-
146
- it "should add a path_prefix to the url if :path_prefix is set" do
147
- Merb::Config[:path_prefix] = "/jungle"
148
- @controller.url(:monkeys).should == "/jungle/monkeys"
149
- Merb::Config[:path_prefix] = nil
150
- end
151
-
152
- it "should match a nested resources show action" do
153
- @blue = Blue.new
154
- @controller.url(:monkey_blue, @blue).should == "/monkeys/45/blues/13"
155
- end
156
-
157
- it "should match the index action of nested resource with parent object" do
158
- @blue = Blue.new
159
- @monkey = Monkey.new
160
- @controller.url(:monkey_blues, :monkey_id => @monkey).should == "/monkeys/45/blues"
161
- end
162
-
163
- it "should match the index action of nested resource with parent id as string" do
164
- @blue = Blue.new
165
- @controller.url(:monkey_blues, :monkey_id => '1').should == "/monkeys/1/blues"
166
- end
167
-
168
- it "should match the edit action of nested resource" do
169
- @blue = Blue.new
170
- @controller.url(:edit_monkey_blue, @blue).should == "/monkeys/45/blues/13/edit"
171
- end
172
-
173
- it "should match the index action of resources nested under a resource" do
174
- @blue = Blue.new
175
- @controller.url(:red_blues).should == "/red/blues"
176
- end
177
-
178
- it "should match resource that has been nested multiple times" do
179
- @blue = Blue.new
180
- @controller.url(:donkey_blue, @blue).should == "/donkeys/19/blues/13"
181
- @controller.url(:monkey_blue, @blue).should == "/monkeys/45/blues/13"
182
- end
183
-
184
- it "should match resources nested more than one level deep" do
185
- @pink = Pink.new
186
- @controller.url(:monkey_blue_pink, @pink).should == "/monkeys/45/blues/13/pinks/22"
187
- end
188
-
189
- it "should match resource with additional params" do
190
- @monkey = Monkey.new
191
- @controller.url(:monkey, @monkey, :foo => "bar").should == "/monkeys/45?foo=bar"
192
- end
193
- it "should match resource with fragment" do
194
- @monkey = Monkey.new
195
- @controller.url(:monkey, @monkey, :fragment => :half_way).should == "/monkeys/45#half_way"
196
- end
197
-
198
- it "should match a nested resource with additional params" do
199
- @blue = Blue.new
200
- @controller.url(:monkey_blue, @blue, :foo => "bar").should == "/monkeys/45/blues/13?foo=bar"
201
- end
202
-
203
- it "should match a nested resource with additional params and fragment" do
204
- @blue = Blue.new
205
- @controller.url(:monkey_blue, @blue, :foo => "bar", :fragment => :half_way).should == "/monkeys/45/blues/13?foo=bar#half_way"
206
- end
207
-
208
- end
209
-
210
-
211
-
212
-
213
- describe Merb::Controller, "absolute_url" do
214
- before do
215
- @controller = dispatch_to(Merb::Test::Fixtures::Controllers::Url, :index)
216
- end
217
-
218
- it 'takes :protocol option' do
219
- @monkey = Monkey.new
220
- @controller.absolute_url(:monkey,
221
- :id => @monkey,
222
- :format => :xml,
223
- :protocol => "https").should == "https://localhost/monkeys/45.xml"
224
- end
225
-
226
- it 'takes :host option' do
227
- @monkey = Monkey.new
228
- @controller.absolute_url(:monkey,
229
- :id => @monkey,
230
- :format => :xml,
231
- :protocol => "https",
232
- :host => "rubyisnotrails.org").should == "https://rubyisnotrails.org/monkeys/45.xml"
233
- end
234
-
235
- it 'falls back to request protocol' do
236
- @monkey = Monkey.new
237
- @controller.absolute_url(:monkey,
238
- :id => @monkey,
239
- :format => :xml).should == "http://localhost/monkeys/45.xml"
240
- end
241
-
242
- it 'falls back to request host' do
243
- @monkey = Monkey.new
244
- @controller.absolute_url(:monkey,
245
- :id => @monkey,
246
- :format => :xml,
247
- :protocol => "https").should == "https://localhost/monkeys/45.xml"
248
- end
249
-
250
- it "allows passing an object instead of a hash" do
251
- @monkey = Monkey.new
252
- @controller.absolute_url(:monkey, @monkey).should == "http://localhost/monkeys/45"
253
- end
254
-
255
- end