actionpack 1.13.6 → 2.0.0
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of actionpack might be problematic. Click here for more details.
- data/CHANGELOG +1400 -20
- data/MIT-LICENSE +1 -1
- data/README +5 -5
- data/RUNNING_UNIT_TESTS +4 -5
- data/Rakefile +5 -6
- data/install.rb +2 -2
- data/lib/action_controller.rb +11 -15
- data/lib/action_controller/assertions.rb +12 -25
- data/lib/action_controller/assertions/dom_assertions.rb +18 -4
- data/lib/action_controller/assertions/model_assertions.rb +8 -1
- data/lib/action_controller/assertions/response_assertions.rb +35 -12
- data/lib/action_controller/assertions/routing_assertions.rb +56 -12
- data/lib/action_controller/assertions/selector_assertions.rb +105 -38
- data/lib/action_controller/assertions/tag_assertions.rb +28 -15
- data/lib/action_controller/base.rb +318 -250
- data/lib/action_controller/benchmarking.rb +33 -29
- data/lib/action_controller/caching.rb +130 -64
- data/lib/action_controller/cgi_ext.rb +16 -0
- data/lib/action_controller/cgi_ext/{cookie_performance_fix.rb → cookie.rb} +25 -40
- data/lib/action_controller/cgi_ext/query_extension.rb +22 -0
- data/lib/action_controller/cgi_ext/session.rb +73 -0
- data/lib/action_controller/cgi_ext/stdinput.rb +23 -0
- data/lib/action_controller/cgi_process.rb +34 -57
- data/lib/action_controller/components.rb +19 -36
- data/lib/action_controller/cookies.rb +10 -9
- data/lib/action_controller/dispatcher.rb +195 -0
- data/lib/action_controller/filters.rb +35 -34
- data/lib/action_controller/flash.rb +30 -35
- data/lib/action_controller/helpers.rb +121 -47
- data/lib/action_controller/http_authentication.rb +126 -0
- data/lib/action_controller/integration.rb +105 -101
- data/lib/action_controller/layout.rb +59 -47
- data/lib/action_controller/mime_responds.rb +57 -68
- data/lib/action_controller/mime_type.rb +43 -80
- data/lib/action_controller/mime_types.rb +20 -0
- data/lib/action_controller/polymorphic_routes.rb +88 -0
- data/lib/action_controller/record_identifier.rb +91 -0
- data/lib/action_controller/request.rb +553 -88
- data/lib/action_controller/request_forgery_protection.rb +126 -0
- data/lib/action_controller/request_profiler.rb +138 -0
- data/lib/action_controller/rescue.rb +185 -69
- data/lib/action_controller/resources.rb +211 -172
- data/lib/action_controller/response.rb +49 -8
- data/lib/action_controller/routing.rb +359 -236
- data/lib/action_controller/routing_optimisation.rb +119 -0
- data/lib/action_controller/session/active_record_store.rb +3 -2
- data/lib/action_controller/session/cookie_store.rb +161 -0
- data/lib/action_controller/session/mem_cache_store.rb +9 -16
- data/lib/action_controller/session_management.rb +17 -8
- data/lib/action_controller/streaming.rb +6 -3
- data/lib/action_controller/templates/rescues/_request_and_response.erb +24 -0
- data/lib/action_controller/templates/rescues/{_trace.rhtml → _trace.erb} +0 -0
- data/lib/action_controller/templates/rescues/{diagnostics.rhtml → diagnostics.erb} +2 -2
- data/lib/action_controller/templates/rescues/{layout.rhtml → layout.erb} +0 -0
- data/lib/action_controller/templates/rescues/{missing_template.rhtml → missing_template.erb} +0 -0
- data/lib/action_controller/templates/rescues/{routing_error.rhtml → routing_error.erb} +0 -0
- data/lib/action_controller/templates/rescues/{template_error.rhtml → template_error.erb} +2 -2
- data/lib/action_controller/templates/rescues/{unknown_action.rhtml → unknown_action.erb} +0 -0
- data/lib/action_controller/test_case.rb +53 -0
- data/lib/action_controller/test_process.rb +59 -46
- data/lib/action_controller/url_rewriter.rb +48 -24
- data/lib/action_controller/vendor/html-scanner/html/document.rb +7 -4
- data/lib/action_controller/vendor/html-scanner/html/sanitizer.rb +173 -0
- data/lib/action_controller/vendor/html-scanner/html/selector.rb +11 -6
- data/lib/action_controller/verification.rb +27 -21
- data/lib/action_pack.rb +1 -1
- data/lib/action_pack/version.rb +4 -4
- data/lib/action_view.rb +2 -3
- data/lib/action_view/base.rb +218 -63
- data/lib/action_view/compiled_templates.rb +1 -2
- data/lib/action_view/helpers/active_record_helper.rb +35 -17
- data/lib/action_view/helpers/asset_tag_helper.rb +395 -87
- data/lib/action_view/helpers/atom_feed_helper.rb +111 -0
- data/lib/action_view/helpers/benchmark_helper.rb +12 -5
- data/lib/action_view/helpers/cache_helper.rb +29 -0
- data/lib/action_view/helpers/capture_helper.rb +97 -63
- data/lib/action_view/helpers/date_helper.rb +295 -35
- data/lib/action_view/helpers/debug_helper.rb +6 -2
- data/lib/action_view/helpers/form_helper.rb +354 -111
- data/lib/action_view/helpers/form_options_helper.rb +171 -109
- data/lib/action_view/helpers/form_tag_helper.rb +332 -76
- data/lib/action_view/helpers/javascript_helper.rb +35 -11
- data/lib/action_view/helpers/javascripts/controls.js +484 -354
- data/lib/action_view/helpers/javascripts/dragdrop.js +88 -58
- data/lib/action_view/helpers/javascripts/effects.js +396 -364
- data/lib/action_view/helpers/javascripts/prototype.js +2817 -1107
- data/lib/action_view/helpers/number_helper.rb +84 -60
- data/lib/action_view/helpers/prototype_helper.rb +419 -43
- data/lib/action_view/helpers/record_identification_helper.rb +20 -0
- data/lib/action_view/helpers/record_tag_helper.rb +59 -0
- data/lib/action_view/helpers/sanitize_helper.rb +223 -0
- data/lib/action_view/helpers/scriptaculous_helper.rb +63 -4
- data/lib/action_view/helpers/tag_helper.rb +69 -39
- data/lib/action_view/helpers/text_helper.rb +221 -148
- data/lib/action_view/helpers/url_helper.rb +283 -165
- data/lib/action_view/partials.rb +134 -62
- data/lib/action_view/template_error.rb +4 -12
- data/lib/actionpack.rb +1 -0
- data/test/abstract_unit.rb +21 -1
- data/test/action_view_test.rb +26 -0
- data/test/active_record_unit.rb +12 -20
- data/test/activerecord/active_record_store_test.rb +2 -2
- data/test/activerecord/render_partial_with_record_identification_test.rb +74 -0
- data/test/controller/action_pack_assertions_test.rb +21 -152
- data/test/controller/addresses_render_test.rb +2 -7
- data/test/controller/assert_select_test.rb +120 -14
- data/test/controller/base_test.rb +11 -13
- data/test/controller/caching_test.rb +125 -5
- data/test/controller/capture_test.rb +23 -16
- data/test/controller/cgi_test.rb +66 -391
- data/test/controller/components_test.rb +31 -42
- data/test/controller/content_type_test.rb +1 -1
- data/test/controller/cookie_test.rb +42 -14
- data/test/controller/deprecation/deprecated_base_methods_test.rb +1 -42
- data/test/controller/dispatcher_test.rb +123 -0
- data/test/controller/fake_models.rb +5 -0
- data/test/controller/filters_test.rb +44 -7
- data/test/controller/flash_test.rb +46 -2
- data/test/controller/fragment_store_setting_test.rb +10 -8
- data/test/controller/helper_test.rb +19 -2
- data/test/controller/html-scanner/document_test.rb +124 -0
- data/test/controller/html-scanner/node_test.rb +69 -0
- data/test/controller/html-scanner/sanitizer_test.rb +250 -0
- data/test/controller/html-scanner/tag_node_test.rb +239 -0
- data/test/controller/html-scanner/text_node_test.rb +51 -0
- data/test/controller/html-scanner/tokenizer_test.rb +125 -0
- data/test/controller/http_authentication_test.rb +54 -0
- data/test/controller/integration_test.rb +12 -26
- data/test/controller/layout_test.rb +64 -12
- data/test/controller/mime_responds_test.rb +193 -38
- data/test/controller/mime_type_test.rb +30 -8
- data/test/controller/new_render_test.rb +104 -22
- data/test/controller/polymorphic_routes_test.rb +98 -0
- data/test/controller/record_identifier_test.rb +103 -0
- data/test/controller/redirect_test.rb +120 -18
- data/test/controller/render_test.rb +195 -45
- data/test/controller/request_forgery_protection_test.rb +217 -0
- data/test/controller/request_test.rb +545 -27
- data/test/controller/rescue_test.rb +501 -0
- data/test/controller/resources_test.rb +258 -132
- data/test/controller/routing_test.rb +502 -106
- data/test/controller/selector_test.rb +5 -5
- data/test/controller/send_file_test.rb +17 -7
- data/test/controller/session/cookie_store_test.rb +246 -0
- data/test/controller/session/mem_cache_store_test.rb +182 -0
- data/test/controller/session_fixation_test.rb +8 -11
- data/test/controller/session_management_test.rb +7 -7
- data/test/controller/test_test.rb +150 -38
- data/test/controller/url_rewriter_test.rb +87 -12
- data/test/controller/verification_test.rb +11 -0
- data/test/controller/view_paths_test.rb +137 -0
- data/test/controller/webservice_test.rb +11 -75
- data/test/fixtures/addresses/{list.rhtml → list.erb} +0 -0
- data/test/fixtures/db_definitions/sqlite.sql +2 -1
- data/test/fixtures/developer.rb +2 -0
- data/test/fixtures/fun/games/{hello_world.rhtml → hello_world.erb} +0 -0
- data/test/fixtures/helpers/fun/pdf_helper.rb +1 -1
- data/test/fixtures/layout_tests/alt/hello.rhtml +1 -0
- data/test/fixtures/layout_tests/layouts/multiple_extensions.html.erb +1 -0
- data/test/fixtures/layouts/{builder.rxml → builder.builder} +0 -0
- data/test/fixtures/layouts/{standard.rhtml → standard.erb} +0 -0
- data/test/fixtures/layouts/{talk_from_action.rhtml → talk_from_action.erb} +0 -0
- data/test/fixtures/layouts/{yield.rhtml → yield.erb} +0 -0
- data/test/fixtures/multipart/binary_file +0 -0
- data/test/fixtures/multipart/bracketed_param +5 -0
- data/test/fixtures/override/test/hello_world.erb +1 -0
- data/test/fixtures/override2/layouts/test/sub.erb +1 -0
- data/test/fixtures/post_test/layouts/post.html.erb +1 -0
- data/test/fixtures/post_test/layouts/super_post.iphone.erb +1 -0
- data/test/fixtures/post_test/post/index.html.erb +1 -0
- data/test/fixtures/post_test/post/index.iphone.erb +1 -0
- data/test/fixtures/post_test/super_post/index.html.erb +1 -0
- data/test/fixtures/post_test/super_post/index.iphone.erb +1 -0
- data/test/fixtures/public/404.html +1 -0
- data/test/fixtures/public/500.html +1 -0
- data/test/fixtures/public/javascripts/application.js +0 -1
- data/test/fixtures/public/javascripts/bank.js +1 -0
- data/test/fixtures/public/javascripts/robber.js +1 -0
- data/test/fixtures/public/stylesheets/bank.css +1 -0
- data/test/fixtures/public/stylesheets/robber.css +1 -0
- data/test/fixtures/replies.yml +2 -0
- data/test/fixtures/reply.rb +2 -1
- data/test/fixtures/respond_to/{all_types_with_layout.rhtml → all_types_with_layout.html.erb} +0 -0
- data/test/fixtures/respond_to/{all_types_with_layout.rjs → all_types_with_layout.js.rjs} +0 -0
- data/test/fixtures/respond_to/custom_constant_handling_without_block.mobile.erb +1 -0
- data/test/fixtures/respond_to/iphone_with_html_response_type.html.erb +1 -0
- data/test/fixtures/respond_to/iphone_with_html_response_type.iphone.erb +1 -0
- data/test/fixtures/respond_to/layouts/missing.html.erb +1 -0
- data/test/fixtures/respond_to/layouts/standard.html.erb +1 -0
- data/test/fixtures/respond_to/layouts/standard.iphone.erb +1 -0
- data/test/fixtures/respond_to/{using_defaults.rhtml → using_defaults.html.erb} +0 -0
- data/test/fixtures/respond_to/{using_defaults.rjs → using_defaults.js.rjs} +0 -0
- data/test/fixtures/respond_to/{using_defaults.rxml → using_defaults.xml.builder} +0 -0
- data/test/fixtures/respond_to/{using_defaults_with_type_list.rhtml → using_defaults_with_type_list.html.erb} +0 -0
- data/test/fixtures/respond_to/{using_defaults_with_type_list.rjs → using_defaults_with_type_list.js.rjs} +0 -0
- data/test/fixtures/respond_to/{using_defaults_with_type_list.rxml → using_defaults_with_type_list.xml.builder} +0 -0
- data/test/fixtures/scope/test/{modgreet.rhtml → modgreet.erb} +0 -0
- data/test/fixtures/test/{_customer.rhtml → _customer.erb} +0 -0
- data/test/fixtures/test/{_customer_greeting.rhtml → _customer_greeting.erb} +0 -0
- data/test/fixtures/test/_hash_greeting.erb +1 -0
- data/test/fixtures/test/_hash_object.erb +2 -0
- data/test/fixtures/test/{_hello.rxml → _hello.builder} +0 -0
- data/test/fixtures/test/_layout_for_partial.html.erb +3 -0
- data/test/fixtures/test/_partial.erb +1 -0
- data/test/fixtures/test/_partial.html.erb +1 -0
- data/test/fixtures/test/_partial.js.erb +1 -0
- data/test/fixtures/test/_partial_for_use_in_layout.html.erb +1 -0
- data/test/fixtures/test/{_partial_only.rhtml → _partial_only.erb} +0 -0
- data/test/fixtures/test/{_person.rhtml → _person.erb} +0 -0
- data/test/fixtures/test/{action_talk_to_layout.rhtml → action_talk_to_layout.erb} +0 -0
- data/test/fixtures/test/{block_content_for.rhtml → block_content_for.erb} +0 -0
- data/test/fixtures/test/calling_partial_with_layout.html.erb +1 -0
- data/test/fixtures/test/{capturing.rhtml → capturing.erb} +0 -0
- data/test/fixtures/test/{content_for.rhtml → content_for.erb} +0 -0
- data/test/fixtures/test/content_for_concatenated.erb +3 -0
- data/test/fixtures/test/content_for_with_parameter.erb +2 -0
- data/test/fixtures/test/dot.directory/{render_file_with_ivar.rhtml → render_file_with_ivar.erb} +0 -0
- data/test/fixtures/test/{erb_content_for.rhtml → erb_content_for.erb} +0 -0
- data/test/fixtures/test/formatted_html_erb.html.erb +1 -0
- data/test/fixtures/test/formatted_xml_erb.builder +1 -0
- data/test/fixtures/test/formatted_xml_erb.html.erb +1 -0
- data/test/fixtures/test/formatted_xml_erb.xml.erb +1 -0
- data/test/fixtures/test/{greeting.rhtml → greeting.erb} +0 -0
- data/test/fixtures/test/{hello.rxml → hello.builder} +0 -0
- data/test/fixtures/test/{hello_world.rxml → hello_world.builder} +0 -0
- data/test/fixtures/test/{hello_world.rhtml → hello_world.erb} +0 -0
- data/test/fixtures/test/{hello_world_container.rxml → hello_world_container.builder} +0 -0
- data/test/fixtures/test/{hello_world_with_layout_false.rhtml → hello_world_with_layout_false.erb} +0 -0
- data/test/fixtures/test/{hello_xml_world.rxml → hello_xml_world.builder} +0 -0
- data/test/fixtures/test/list.erb +1 -0
- data/test/fixtures/test/{non_erb_block_content_for.rxml → non_erb_block_content_for.builder} +0 -0
- data/test/fixtures/test/{potential_conflicts.rhtml → potential_conflicts.erb} +0 -0
- data/test/fixtures/test/{render_file_with_ivar.rhtml → render_file_with_ivar.erb} +0 -0
- data/test/fixtures/test/{render_file_with_locals.rhtml → render_file_with_locals.erb} +0 -0
- data/test/fixtures/test/{render_to_string_test.rhtml → render_to_string_test.erb} +0 -0
- data/test/fixtures/test/{update_element_with_capture.rhtml → update_element_with_capture.erb} +0 -0
- data/test/fixtures/test/using_layout_around_block.html.erb +1 -0
- data/test/fixtures/topic.rb +1 -1
- data/test/template/active_record_helper_test.rb +67 -20
- data/test/template/asset_tag_helper_test.rb +222 -54
- data/test/template/atom_feed_helper_test.rb +101 -0
- data/test/template/benchmark_helper_test.rb +2 -2
- data/test/template/compiled_templates_test.rb +76 -32
- data/test/template/date_helper_test.rb +125 -9
- data/test/template/form_helper_test.rb +326 -33
- data/test/template/form_options_helper_test.rb +822 -15
- data/test/template/form_tag_helper_test.rb +96 -30
- data/test/template/javascript_helper_test.rb +61 -13
- data/test/template/number_helper_test.rb +12 -11
- data/test/template/prototype_helper_test.rb +185 -24
- data/test/template/sanitize_helper_test.rb +49 -0
- data/test/template/scriptaculous_helper_test.rb +9 -3
- data/test/template/tag_helper_test.rb +13 -2
- data/test/template/text_helper_test.rb +38 -52
- data/test/template/url_helper_test.rb +216 -46
- metadata +144 -116
- data/examples/.htaccess +0 -24
- data/examples/address_book/index.rhtml +0 -33
- data/examples/address_book/layout.rhtml +0 -8
- data/examples/address_book_controller.cgi +0 -9
- data/examples/address_book_controller.fcgi +0 -6
- data/examples/address_book_controller.rb +0 -52
- data/examples/address_book_controller.rbx +0 -4
- data/examples/benchmark.rb +0 -52
- data/examples/benchmark_with_ar.fcgi +0 -89
- data/examples/blog_controller.cgi +0 -53
- data/examples/debate/index.rhtml +0 -14
- data/examples/debate/new_topic.rhtml +0 -22
- data/examples/debate/topic.rhtml +0 -32
- data/examples/debate_controller.cgi +0 -57
- data/lib/action_controller/assertions/deprecated_assertions.rb +0 -228
- data/lib/action_controller/cgi_ext/cgi_ext.rb +0 -36
- data/lib/action_controller/cgi_ext/cgi_methods.rb +0 -211
- data/lib/action_controller/cgi_ext/pstore_performance_fix.rb +0 -30
- data/lib/action_controller/cgi_ext/raw_post_data_fix.rb +0 -95
- data/lib/action_controller/cgi_ext/session_performance_fix.rb +0 -30
- data/lib/action_controller/deprecated_dependencies.rb +0 -65
- data/lib/action_controller/deprecated_redirects.rb +0 -17
- data/lib/action_controller/deprecated_request_methods.rb +0 -34
- data/lib/action_controller/macros/auto_complete.rb +0 -53
- data/lib/action_controller/macros/in_place_editing.rb +0 -33
- data/lib/action_controller/pagination.rb +0 -408
- data/lib/action_controller/scaffolding.rb +0 -189
- data/lib/action_controller/templates/rescues/_request_and_response.rhtml +0 -44
- data/lib/action_controller/templates/scaffolds/edit.rhtml +0 -7
- data/lib/action_controller/templates/scaffolds/layout.rhtml +0 -69
- data/lib/action_controller/templates/scaffolds/list.rhtml +0 -27
- data/lib/action_controller/templates/scaffolds/new.rhtml +0 -6
- data/lib/action_controller/templates/scaffolds/show.rhtml +0 -9
- data/lib/action_controller/vendor/xml_node.rb +0 -97
- data/lib/action_view/helpers/deprecated_helper.rb +0 -37
- data/lib/action_view/helpers/java_script_macros_helper.rb +0 -233
- data/lib/action_view/helpers/pagination_helper.rb +0 -86
- data/test/activerecord/active_record_assertions_test.rb +0 -92
- data/test/activerecord/pagination_test.rb +0 -165
- data/test/controller/deprecated_instance_variables_test.rb +0 -48
- data/test/controller/raw_post_test.rb +0 -68
- data/test/fixtures/deprecated_instance_variables/_cookies_ivar.rhtml +0 -1
- data/test/fixtures/deprecated_instance_variables/_cookies_method.rhtml +0 -1
- data/test/fixtures/deprecated_instance_variables/_flash_ivar.rhtml +0 -1
- data/test/fixtures/deprecated_instance_variables/_flash_method.rhtml +0 -1
- data/test/fixtures/deprecated_instance_variables/_headers_ivar.rhtml +0 -1
- data/test/fixtures/deprecated_instance_variables/_headers_method.rhtml +0 -1
- data/test/fixtures/deprecated_instance_variables/_params_ivar.rhtml +0 -1
- data/test/fixtures/deprecated_instance_variables/_params_method.rhtml +0 -1
- data/test/fixtures/deprecated_instance_variables/_request_ivar.rhtml +0 -1
- data/test/fixtures/deprecated_instance_variables/_request_method.rhtml +0 -1
- data/test/fixtures/deprecated_instance_variables/_response_ivar.rhtml +0 -1
- data/test/fixtures/deprecated_instance_variables/_response_method.rhtml +0 -1
- data/test/fixtures/deprecated_instance_variables/_session_ivar.rhtml +0 -1
- data/test/fixtures/deprecated_instance_variables/_session_method.rhtml +0 -1
- data/test/fixtures/respond_to/layouts/standard.rhtml +0 -1
- data/test/fixtures/test/_hash_object.rhtml +0 -1
- data/test/fixtures/test/list.rhtml +0 -1
- data/test/template/deprecated_helper_test.rb +0 -36
- data/test/template/deprecated_instance_variables_test.rb +0 -43
- data/test/template/java_script_macros_helper_test.rb +0 -109
data/MIT-LICENSE
CHANGED
data/README
CHANGED
@@ -382,7 +382,7 @@ methods:
|
|
382
382
|
end
|
383
383
|
end
|
384
384
|
|
385
|
-
WeblogController::Base.
|
385
|
+
WeblogController::Base.view_paths = [ File.dirname(__FILE__) ]
|
386
386
|
WeblogController.process_cgi if $0 == __FILE__
|
387
387
|
|
388
388
|
The last two lines are responsible for telling ActionController where the
|
@@ -391,23 +391,23 @@ request from the web-server (like to be Apache).
|
|
391
391
|
|
392
392
|
And the templates look like this:
|
393
393
|
|
394
|
-
weblog/layout.
|
394
|
+
weblog/layout.erb:
|
395
395
|
<html><body>
|
396
396
|
<%= yield %>
|
397
397
|
</body></html>
|
398
398
|
|
399
|
-
weblog/index.
|
399
|
+
weblog/index.erb:
|
400
400
|
<% for post in @posts %>
|
401
401
|
<p><%= link_to(post.title, :action => "display", :id => post.id %></p>
|
402
402
|
<% end %>
|
403
403
|
|
404
|
-
weblog/display.
|
404
|
+
weblog/display.erb:
|
405
405
|
<p>
|
406
406
|
<b><%= post.title %></b><br/>
|
407
407
|
<b><%= post.content %></b>
|
408
408
|
</p>
|
409
409
|
|
410
|
-
weblog/new.
|
410
|
+
weblog/new.erb:
|
411
411
|
<%= form "post" %>
|
412
412
|
|
413
413
|
This simple setup will list all the posts in the system on the index page,
|
data/RUNNING_UNIT_TESTS
CHANGED
@@ -15,11 +15,10 @@ you can do so with something like:
|
|
15
15
|
|
16
16
|
== Dependency on ActiveRecord and database setup
|
17
17
|
|
18
|
-
Test cases in test/controller/
|
19
|
-
activerecord
|
20
|
-
|
21
|
-
|
22
|
-
is installed, but not configured as expected, the tests will fail.
|
18
|
+
Test cases in the test/controller/active_record/ directory depend on having
|
19
|
+
activerecord and sqlite installed. If ActiveRecord is not in
|
20
|
+
actionpack/../activerecord directory, or the sqlite rubygem is not installed,
|
21
|
+
these tests are skipped.
|
23
22
|
|
24
23
|
Other tests are runnable from a fresh copy of actionpack without any configuration.
|
25
24
|
|
data/Rakefile
CHANGED
@@ -48,6 +48,7 @@ Rake::RDocTask.new { |rdoc|
|
|
48
48
|
rdoc.rdoc_dir = 'doc'
|
49
49
|
rdoc.title = "Action Pack -- On rails from request to response"
|
50
50
|
rdoc.options << '--line-numbers' << '--inline-source'
|
51
|
+
rdoc.options << '--charset' << 'utf-8'
|
51
52
|
rdoc.template = "#{ENV['template']}.rb" if ENV['template']
|
52
53
|
if ENV['DOC_FILES']
|
53
54
|
rdoc.rdoc_files.include(ENV['DOC_FILES'].split(/,\s*/))
|
@@ -58,7 +59,7 @@ Rake::RDocTask.new { |rdoc|
|
|
58
59
|
}
|
59
60
|
|
60
61
|
# Create compressed packages
|
61
|
-
dist_dirs = [ "lib", "test"
|
62
|
+
dist_dirs = [ "lib", "test" ]
|
62
63
|
|
63
64
|
spec = Gem::Specification.new do |s|
|
64
65
|
s.platform = Gem::Platform::RUBY
|
@@ -75,17 +76,15 @@ spec = Gem::Specification.new do |s|
|
|
75
76
|
s.has_rdoc = true
|
76
77
|
s.requirements << 'none'
|
77
78
|
|
78
|
-
s.add_dependency('activesupport', '=
|
79
|
+
s.add_dependency('activesupport', '= 2.0.0' + PKG_BUILD)
|
79
80
|
|
80
81
|
s.require_path = 'lib'
|
81
82
|
s.autorequire = 'action_controller'
|
82
83
|
|
83
|
-
s.files = [ "Rakefile", "install.rb", "README", "RUNNING_UNIT_TESTS", "CHANGELOG", "MIT-LICENSE"
|
84
|
+
s.files = [ "Rakefile", "install.rb", "README", "RUNNING_UNIT_TESTS", "CHANGELOG", "MIT-LICENSE" ]
|
84
85
|
dist_dirs.each do |dir|
|
85
86
|
s.files = s.files + Dir.glob( "#{dir}/**/*" ).delete_if { |item| item.include?( "\.svn" ) }
|
86
87
|
end
|
87
|
-
s.files.delete "examples/benchmark.rb"
|
88
|
-
s.files.delete "examples/benchmark_with_ar.fcgi"
|
89
88
|
end
|
90
89
|
|
91
90
|
Rake::GemPackageTask.new(spec) do |p|
|
@@ -151,4 +150,4 @@ task :release => [ :package ] do
|
|
151
150
|
rubyforge = RubyForge.new
|
152
151
|
rubyforge.login
|
153
152
|
rubyforge.add_release(PKG_NAME, PKG_NAME, "REL #{PKG_VERSION}", *packages)
|
154
|
-
end
|
153
|
+
end
|
data/install.rb
CHANGED
@@ -4,7 +4,7 @@ require 'ftools'
|
|
4
4
|
|
5
5
|
include Config
|
6
6
|
|
7
|
-
# this was adapted from rdoc's install.rb by
|
7
|
+
# this was adapted from rdoc's install.rb by way of Log4r
|
8
8
|
|
9
9
|
$sitedir = CONFIG["sitelibdir"]
|
10
10
|
unless $sitedir
|
@@ -18,7 +18,7 @@ unless $sitedir
|
|
18
18
|
end
|
19
19
|
end
|
20
20
|
|
21
|
-
# the
|
21
|
+
# the actual gruntwork
|
22
22
|
Dir.chdir("lib")
|
23
23
|
|
24
24
|
Find.find("action_controller", "action_controller.rb", "action_view", "action_view.rb") { |f|
|
data/lib/action_controller.rb
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
#--
|
2
|
-
# Copyright (c) 2004-
|
2
|
+
# Copyright (c) 2004-2007 David Heinemeier Hansson
|
3
3
|
#
|
4
4
|
# Permission is hereby granted, free of charge, to any person obtaining
|
5
5
|
# a copy of this software and associated documentation files (the
|
@@ -26,27 +26,24 @@ $:.unshift(File.dirname(__FILE__)) unless
|
|
26
26
|
|
27
27
|
unless defined?(ActiveSupport)
|
28
28
|
begin
|
29
|
-
$:.unshift
|
30
|
-
require 'active_support'
|
29
|
+
$:.unshift "#{File.dirname(__FILE__)}/../../activesupport/lib"
|
30
|
+
require 'active_support'
|
31
31
|
rescue LoadError
|
32
32
|
require 'rubygems'
|
33
33
|
gem 'activesupport'
|
34
34
|
end
|
35
35
|
end
|
36
36
|
|
37
|
+
$:.unshift "#{File.dirname(__FILE__)}/action_controller/vendor/html-scanner"
|
38
|
+
|
37
39
|
require 'action_controller/base'
|
38
|
-
require 'action_controller/deprecated_redirects'
|
39
40
|
require 'action_controller/request'
|
40
|
-
require 'action_controller/deprecated_request_methods'
|
41
41
|
require 'action_controller/rescue'
|
42
42
|
require 'action_controller/benchmarking'
|
43
43
|
require 'action_controller/flash'
|
44
44
|
require 'action_controller/filters'
|
45
45
|
require 'action_controller/layout'
|
46
|
-
require 'action_controller/deprecated_dependencies'
|
47
46
|
require 'action_controller/mime_responds'
|
48
|
-
require 'action_controller/pagination'
|
49
|
-
require 'action_controller/scaffolding'
|
50
47
|
require 'action_controller/helpers'
|
51
48
|
require 'action_controller/cookies'
|
52
49
|
require 'action_controller/cgi_process'
|
@@ -54,9 +51,10 @@ require 'action_controller/caching'
|
|
54
51
|
require 'action_controller/verification'
|
55
52
|
require 'action_controller/streaming'
|
56
53
|
require 'action_controller/session_management'
|
54
|
+
require 'action_controller/http_authentication'
|
57
55
|
require 'action_controller/components'
|
58
|
-
require 'action_controller/
|
59
|
-
require 'action_controller/
|
56
|
+
require 'action_controller/record_identifier'
|
57
|
+
require 'action_controller/request_forgery_protection'
|
60
58
|
|
61
59
|
require 'action_view'
|
62
60
|
ActionController::Base.template_class = ActionView::Base
|
@@ -67,17 +65,15 @@ ActionController::Base.class_eval do
|
|
67
65
|
include ActionController::Layout
|
68
66
|
include ActionController::Benchmarking
|
69
67
|
include ActionController::Rescue
|
70
|
-
include ActionController::Dependencies
|
71
68
|
include ActionController::MimeResponds
|
72
|
-
include ActionController::Pagination
|
73
|
-
include ActionController::Scaffolding
|
74
69
|
include ActionController::Helpers
|
75
70
|
include ActionController::Cookies
|
76
71
|
include ActionController::Caching
|
77
72
|
include ActionController::Verification
|
78
73
|
include ActionController::Streaming
|
79
74
|
include ActionController::SessionManagement
|
75
|
+
include ActionController::HttpAuthentication::Basic::ControllerMethods
|
80
76
|
include ActionController::Components
|
81
|
-
include ActionController::
|
82
|
-
include ActionController::
|
77
|
+
include ActionController::RecordIdentifier
|
78
|
+
include ActionController::RequestForgeryProtection
|
83
79
|
end
|
@@ -1,4 +1,3 @@
|
|
1
|
-
require 'test/unit'
|
2
1
|
require 'test/unit/assertions'
|
3
2
|
|
4
3
|
module ActionController #:nodoc:
|
@@ -9,7 +8,7 @@ module ActionController #:nodoc:
|
|
9
8
|
# * session: Objects being saved in the session.
|
10
9
|
# * flash: The flash objects currently in the session.
|
11
10
|
# * cookies: Cookies being sent to the user on this request.
|
12
|
-
#
|
11
|
+
#
|
13
12
|
# These collections can be used just like any other hash:
|
14
13
|
#
|
15
14
|
# assert_not_nil assigns(:person) # makes sure that a @person instance variable was set
|
@@ -17,7 +16,7 @@ module ActionController #:nodoc:
|
|
17
16
|
# assert flash.empty? # makes sure that there's nothing in the flash
|
18
17
|
#
|
19
18
|
# For historic reasons, the assigns hash uses string-based keys. So assigns[:person] won't work, but assigns["person"] will. To
|
20
|
-
# appease our yearning for symbols, though, an alternative accessor has been
|
19
|
+
# appease our yearning for symbols, though, an alternative accessor has been devised using a method call instead of index referencing.
|
21
20
|
# So assigns(:person) will work just like assigns["person"], but again, assigns[:person] will not work.
|
22
21
|
#
|
23
22
|
# On top of the collections, you have the complete url that a given action redirected to available in redirect_to_url.
|
@@ -39,44 +38,32 @@ module ActionController #:nodoc:
|
|
39
38
|
#
|
40
39
|
# == Testing named routes
|
41
40
|
#
|
42
|
-
# If you're using named routes, they can be easily tested using the original named routes methods straight in the test case.
|
43
|
-
# Example:
|
41
|
+
# If you're using named routes, they can be easily tested using the original named routes' methods straight in the test case.
|
42
|
+
# Example:
|
44
43
|
#
|
45
44
|
# assert_redirected_to page_url(:title => 'foo')
|
46
45
|
module Assertions
|
47
46
|
def self.included(klass)
|
48
|
-
|
49
|
-
|
50
|
-
include
|
51
|
-
include ActionController::Assertions::RoutingAssertions
|
52
|
-
include ActionController::Assertions::TagAssertions
|
53
|
-
include ActionController::Assertions::DomAssertions
|
54
|
-
include ActionController::Assertions::ModelAssertions
|
55
|
-
include ActionController::Assertions::DeprecatedAssertions
|
47
|
+
%w(response selector tag dom routing model).each do |kind|
|
48
|
+
require "action_controller/assertions/#{kind}_assertions"
|
49
|
+
klass.module_eval { include const_get("#{kind.camelize}Assertions") }
|
56
50
|
end
|
57
51
|
end
|
58
52
|
|
59
53
|
def clean_backtrace(&block)
|
60
54
|
yield
|
61
|
-
rescue Test::Unit::AssertionFailedError =>
|
62
|
-
|
63
|
-
|
55
|
+
rescue Test::Unit::AssertionFailedError => error
|
56
|
+
framework_path = Regexp.new(File.expand_path("#{File.dirname(__FILE__)}/assertions"))
|
57
|
+
error.backtrace.reject! { |line| File.expand_path(line) =~ framework_path }
|
58
|
+
raise
|
64
59
|
end
|
65
60
|
end
|
66
61
|
end
|
67
62
|
|
68
|
-
require File.dirname(__FILE__) + '/assertions/response_assertions'
|
69
|
-
require File.dirname(__FILE__) + '/assertions/selector_assertions'
|
70
|
-
require File.dirname(__FILE__) + '/assertions/tag_assertions'
|
71
|
-
require File.dirname(__FILE__) + '/assertions/dom_assertions'
|
72
|
-
require File.dirname(__FILE__) + '/assertions/routing_assertions'
|
73
|
-
require File.dirname(__FILE__) + '/assertions/model_assertions'
|
74
|
-
require File.dirname(__FILE__) + '/assertions/deprecated_assertions'
|
75
|
-
|
76
63
|
module Test #:nodoc:
|
77
64
|
module Unit #:nodoc:
|
78
65
|
class TestCase #:nodoc:
|
79
66
|
include ActionController::Assertions
|
80
67
|
end
|
81
68
|
end
|
82
|
-
end
|
69
|
+
end
|
@@ -2,24 +2,38 @@ module ActionController
|
|
2
2
|
module Assertions
|
3
3
|
module DomAssertions
|
4
4
|
# Test two HTML strings for equivalency (e.g., identical up to reordering of attributes)
|
5
|
-
|
5
|
+
#
|
6
|
+
# ==== Examples
|
7
|
+
#
|
8
|
+
# # assert that the referenced method generates the appropriate HTML string
|
9
|
+
# assert_dom_equal '<a href="http://www.example.com">Apples</a>', link_to("Apples", "http://www.example.com")
|
10
|
+
#
|
11
|
+
def assert_dom_equal(expected, actual, message = "")
|
6
12
|
clean_backtrace do
|
7
13
|
expected_dom = HTML::Document.new(expected).root
|
8
|
-
actual_dom
|
14
|
+
actual_dom = HTML::Document.new(actual).root
|
9
15
|
full_message = build_message(message, "<?> expected to be == to\n<?>.", expected_dom.to_s, actual_dom.to_s)
|
16
|
+
|
10
17
|
assert_block(full_message) { expected_dom == actual_dom }
|
11
18
|
end
|
12
19
|
end
|
13
20
|
|
14
21
|
# The negated form of +assert_dom_equivalent+.
|
15
|
-
|
22
|
+
#
|
23
|
+
# ==== Examples
|
24
|
+
#
|
25
|
+
# # assert that the referenced method does not generate the specified HTML string
|
26
|
+
# assert_dom_not_equal '<a href="http://www.example.com">Apples</a>', link_to("Oranges", "http://www.example.com")
|
27
|
+
#
|
28
|
+
def assert_dom_not_equal(expected, actual, message = "")
|
16
29
|
clean_backtrace do
|
17
30
|
expected_dom = HTML::Document.new(expected).root
|
18
31
|
actual_dom = HTML::Document.new(actual).root
|
19
32
|
full_message = build_message(message, "<?> expected to be != to\n<?>.", expected_dom.to_s, actual_dom.to_s)
|
33
|
+
|
20
34
|
assert_block(full_message) { expected_dom != actual_dom }
|
21
35
|
end
|
22
36
|
end
|
23
37
|
end
|
24
38
|
end
|
25
|
-
end
|
39
|
+
end
|
@@ -2,6 +2,13 @@ module ActionController
|
|
2
2
|
module Assertions
|
3
3
|
module ModelAssertions
|
4
4
|
# Ensures that the passed record is valid by ActiveRecord standards and returns any error messages if it is not.
|
5
|
+
#
|
6
|
+
# ==== Examples
|
7
|
+
#
|
8
|
+
# # assert that a newly created record is valid
|
9
|
+
# model = Model.new
|
10
|
+
# assert_valid(model)
|
11
|
+
#
|
5
12
|
def assert_valid(record)
|
6
13
|
clean_backtrace do
|
7
14
|
assert record.valid?, record.errors.full_messages.join("\n")
|
@@ -9,4 +16,4 @@ module ActionController
|
|
9
16
|
end
|
10
17
|
end
|
11
18
|
end
|
12
|
-
end
|
19
|
+
end
|
@@ -1,19 +1,29 @@
|
|
1
1
|
require 'rexml/document'
|
2
|
-
require
|
2
|
+
require 'html/document'
|
3
3
|
|
4
4
|
module ActionController
|
5
5
|
module Assertions
|
6
|
+
# A small suite of assertions that test responses from Rails applications.
|
6
7
|
module ResponseAssertions
|
7
8
|
# Asserts that the response is one of the following types:
|
8
9
|
#
|
9
|
-
# * <tt>:success</tt
|
10
|
-
# * <tt>:redirect</tt
|
11
|
-
# * <tt>:missing</tt
|
12
|
-
# * <tt>:error</tt
|
10
|
+
# * <tt>:success</tt> - Status code was 200
|
11
|
+
# * <tt>:redirect</tt> - Status code was in the 300-399 range
|
12
|
+
# * <tt>:missing</tt> - Status code was 404
|
13
|
+
# * <tt>:error</tt> - Status code was in the 500-599 range
|
13
14
|
#
|
14
15
|
# You can also pass an explicit status number like assert_response(501)
|
15
16
|
# or its symbolic equivalent assert_response(:not_implemented).
|
16
17
|
# See ActionController::StatusCodes for a full list.
|
18
|
+
#
|
19
|
+
# ==== Examples
|
20
|
+
#
|
21
|
+
# # assert that the response was a redirection
|
22
|
+
# assert_response :redirect
|
23
|
+
#
|
24
|
+
# # assert that the response code was status code 401 (unauthorized)
|
25
|
+
# assert_response 401
|
26
|
+
#
|
17
27
|
def assert_response(type, message = nil)
|
18
28
|
clean_backtrace do
|
19
29
|
if [ :success, :missing, :redirect, :error ].include?(type) && @response.send("#{type}?")
|
@@ -28,9 +38,18 @@ module ActionController
|
|
28
38
|
end
|
29
39
|
end
|
30
40
|
|
31
|
-
# Assert that the redirection options passed in match those of the redirect called in the latest action.
|
32
|
-
# such that assert_redirected_to(:controller => "weblog") will also
|
33
|
-
# redirect_to(:controller => "weblog", :action => "show") and so on.
|
41
|
+
# Assert that the redirection options passed in match those of the redirect called in the latest action.
|
42
|
+
# This match can be partial, such that assert_redirected_to(:controller => "weblog") will also
|
43
|
+
# match the redirection of redirect_to(:controller => "weblog", :action => "show") and so on.
|
44
|
+
#
|
45
|
+
# ==== Examples
|
46
|
+
#
|
47
|
+
# # assert that the redirection was to the "index" action on the WeblogController
|
48
|
+
# assert_redirected_to :controller => "weblog", :action => "index"
|
49
|
+
#
|
50
|
+
# # assert that the redirection was to the named route login_url
|
51
|
+
# assert_redirected_to login_url
|
52
|
+
#
|
34
53
|
def assert_redirected_to(options = {}, message=nil)
|
35
54
|
clean_backtrace do
|
36
55
|
assert_response(:redirect, message)
|
@@ -79,10 +98,8 @@ module ActionController
|
|
79
98
|
url[key] = value
|
80
99
|
end
|
81
100
|
|
82
|
-
|
83
|
-
|
84
|
-
msg = build_message(message, "response is not a redirection to all of the options supplied (redirection is <?>), difference: <?>",
|
85
|
-
url[:actual], @response_diff)
|
101
|
+
@response_diff = url[:actual].diff(url[:expected]) if url[:actual]
|
102
|
+
msg = build_message(message, "expected a redirect to <?>, found one to <?>, a difference of <?> ", url[:expected], url[:actual], @response_diff)
|
86
103
|
|
87
104
|
assert_block(msg) do
|
88
105
|
url[:expected].keys.all? do |k|
|
@@ -106,6 +123,12 @@ module ActionController
|
|
106
123
|
end
|
107
124
|
|
108
125
|
# Asserts that the request was rendered with the appropriate template file.
|
126
|
+
#
|
127
|
+
# ==== Examples
|
128
|
+
#
|
129
|
+
# # assert that the "new" view template was rendered
|
130
|
+
# assert_template "new"
|
131
|
+
#
|
109
132
|
def assert_template(expected = nil, message=nil)
|
110
133
|
clean_backtrace do
|
111
134
|
rendered = expected ? @response.rendered_file(!expected.include?('/')) : @response.rendered_file
|
@@ -1,25 +1,41 @@
|
|
1
1
|
module ActionController
|
2
2
|
module Assertions
|
3
|
+
# Suite of assertions to test routes generated by Rails and the handling of requests made to them.
|
3
4
|
module RoutingAssertions
|
4
|
-
# Asserts that the routing of the given path was handled correctly and that the parsed options
|
5
|
+
# Asserts that the routing of the given +path+ was handled correctly and that the parsed options (given in the +expected_options+ hash)
|
6
|
+
# match +path+. Basically, it asserts that Rails recognizes the route given by +expected_options+.
|
5
7
|
#
|
6
|
-
#
|
7
|
-
# assert_recognizes({:controller => 'items', :action => 'list'}, 'items/list') # check a specific action
|
8
|
-
# assert_recognizes({:controller => 'items', :action => 'list', :id => '1'}, 'items/list/1') # check an action with a parameter
|
9
|
-
#
|
10
|
-
# Pass a hash in the second argument to specify the request method. This is useful for routes
|
8
|
+
# Pass a hash in the second argument (+path+) to specify the request method. This is useful for routes
|
11
9
|
# requiring a specific HTTP method. The hash should contain a :path with the incoming request path
|
12
10
|
# and a :method containing the required HTTP verb.
|
13
11
|
#
|
14
12
|
# # assert that POSTing to /items will call the create action on ItemsController
|
15
13
|
# assert_recognizes({:controller => 'items', :action => 'create'}, {:path => 'items', :method => :post})
|
16
14
|
#
|
17
|
-
# You can also pass in
|
15
|
+
# You can also pass in +extras+ with a hash containing URL parameters that would normally be in the query string. This can be used
|
18
16
|
# to assert that values in the query string string will end up in the params hash correctly. To test query strings you must use the
|
19
17
|
# extras argument, appending the query string on the path directly will not work. For example:
|
20
18
|
#
|
21
19
|
# # assert that a path of '/items/list/1?view=print' returns the correct options
|
22
20
|
# assert_recognizes({:controller => 'items', :action => 'list', :id => '1', :view => 'print'}, 'items/list/1', { :view => "print" })
|
21
|
+
#
|
22
|
+
# The +message+ parameter allows you to pass in an error message that is displayed upon failure.
|
23
|
+
#
|
24
|
+
# ==== Examples
|
25
|
+
# # Check the default route (i.e., the index action)
|
26
|
+
# assert_recognizes({:controller => 'items', :action => 'index'}, 'items')
|
27
|
+
#
|
28
|
+
# # Test a specific action
|
29
|
+
# assert_recognizes({:controller => 'items', :action => 'list'}, 'items/list')
|
30
|
+
#
|
31
|
+
# # Test an action with a parameter
|
32
|
+
# assert_recognizes({:controller => 'items', :action => 'destroy', :id => '1'}, 'items/destroy/1')
|
33
|
+
#
|
34
|
+
# # Test a custom route
|
35
|
+
# assert_recognizes({:controller => 'items', :action => 'show', :id => '1'}, 'view/item1')
|
36
|
+
#
|
37
|
+
# # Check a Simply RESTful generated route
|
38
|
+
# assert_recognizes(list_items_url, 'items/list')
|
23
39
|
def assert_recognizes(expected_options, path, extras={}, message=nil)
|
24
40
|
if path.is_a? Hash
|
25
41
|
request_method = path[:method]
|
@@ -43,12 +59,24 @@ module ActionController
|
|
43
59
|
end
|
44
60
|
end
|
45
61
|
|
46
|
-
# Asserts that the provided options can be used to generate the provided path. This is the inverse of assert_recognizes.
|
47
|
-
#
|
62
|
+
# Asserts that the provided options can be used to generate the provided path. This is the inverse of #assert_recognizes.
|
63
|
+
# The +extras+ parameter is used to tell the request the names and values of additional request parameters that would be in
|
64
|
+
# a query string. The +message+ parameter allows you to specify a custom error message for assertion failures.
|
48
65
|
#
|
66
|
+
# The +defaults+ parameter is unused.
|
67
|
+
#
|
68
|
+
# ==== Examples
|
69
|
+
# # Asserts that the default action is generated for a route with no action
|
49
70
|
# assert_generates("/items", :controller => "items", :action => "index")
|
71
|
+
#
|
72
|
+
# # Tests that the list action is properly routed
|
50
73
|
# assert_generates("/items/list", :controller => "items", :action => "list")
|
74
|
+
#
|
75
|
+
# # Tests the generation of a route with a parameter
|
51
76
|
# assert_generates("/items/list/1", { :controller => "items", :action => "list", :id => "1" })
|
77
|
+
#
|
78
|
+
# # Asserts that the generated route gives us our custom route
|
79
|
+
# assert_generates "changesets/12", { :controller => 'scm', :action => 'show_diff', :revision => "12" }
|
52
80
|
def assert_generates(expected_path, options, defaults={}, extras = {}, message=nil)
|
53
81
|
clean_backtrace do
|
54
82
|
expected_path = "/#{expected_path}" unless expected_path[0] == ?/
|
@@ -67,9 +95,25 @@ module ActionController
|
|
67
95
|
end
|
68
96
|
end
|
69
97
|
|
70
|
-
# Asserts that path and options match both ways; in other words,
|
71
|
-
# options
|
72
|
-
#
|
98
|
+
# Asserts that path and options match both ways; in other words, it verifies that <tt>path</tt> generates
|
99
|
+
# <tt>options</tt> and then that <tt>options</tt> generates <tt>path</tt>. This essentially combines #assert_recognizes
|
100
|
+
# and #assert_generates into one step.
|
101
|
+
#
|
102
|
+
# The +extras+ hash allows you to specify options that would normally be provided as a query string to the action. The
|
103
|
+
# +message+ parameter allows you to specify a custom error message to display upon failure.
|
104
|
+
#
|
105
|
+
# ==== Examples
|
106
|
+
# # Assert a basic route: a controller with the default action (index)
|
107
|
+
# assert_routing('/home', :controller => 'home', :action => 'index')
|
108
|
+
#
|
109
|
+
# # Test a route generated with a specific controller, action, and parameter (id)
|
110
|
+
# assert_routing('/entries/show/23', :controller => 'entries', :action => 'show', id => 23)
|
111
|
+
#
|
112
|
+
# # Assert a basic route (controller + default action), with an error message if it fails
|
113
|
+
# assert_routing('/store', { :controller => 'store', :action => 'index' }, {}, {}, 'Route for store index not generated properly')
|
114
|
+
#
|
115
|
+
# # Tests a route, providing a defaults hash
|
116
|
+
# assert_routing 'controller/action/9', {:id => "9", :item => "square"}, {:controller => "controller", :action => "action"}, {}, {:item => "square"}
|
73
117
|
def assert_routing(path, options, defaults={}, extras={}, message=nil)
|
74
118
|
assert_recognizes(options, path, extras, message)
|
75
119
|
|