From 60eaae4f7df1f1dae91defb87d3707451c359cf4 Mon Sep 17 00:00:00 2001
From: francis
Date: Wed, 23 Jan 2008 01:48:14 +0000
Subject: Freeze in rails 2.0.2 (Am I going to regret having this beast in
CVS?)
---
vendor/rails-2.0.2/actionpack/CHANGELOG | 4606 ++++++++++++++++++++
vendor/rails-2.0.2/actionpack/MIT-LICENSE | 21 +
vendor/rails-2.0.2/actionpack/README | 469 ++
vendor/rails-2.0.2/actionpack/RUNNING_UNIT_TESTS | 24 +
vendor/rails-2.0.2/actionpack/Rakefile | 153 +
vendor/rails-2.0.2/actionpack/install.rb | 30 +
.../actionpack/lib/action_controller.rb | 79 +
.../actionpack/lib/action_controller/assertions.rb | 69 +
.../action_controller/assertions/dom_assertions.rb | 39 +
.../assertions/model_assertions.rb | 19 +
.../assertions/response_assertions.rb | 166 +
.../assertions/routing_assertions.rb | 143 +
.../assertions/selector_assertions.rb | 640 +++
.../action_controller/assertions/tag_assertions.rb | 130 +
.../actionpack/lib/action_controller/base.rb | 1295 ++++++
.../lib/action_controller/benchmarking.rb | 94 +
.../actionpack/lib/action_controller/caching.rb | 683 +++
.../actionpack/lib/action_controller/cgi_ext.rb | 16 +
.../lib/action_controller/cgi_ext/cookie.rb | 106 +
.../action_controller/cgi_ext/query_extension.rb | 22 +
.../lib/action_controller/cgi_ext/session.rb | 73 +
.../lib/action_controller/cgi_ext/stdinput.rb | 23 +
.../lib/action_controller/cgi_process.rb | 221 +
.../actionpack/lib/action_controller/components.rb | 165 +
.../actionpack/lib/action_controller/cookies.rb | 84 +
.../actionpack/lib/action_controller/dispatcher.rb | 195 +
.../actionpack/lib/action_controller/filters.rb | 767 ++++
.../actionpack/lib/action_controller/flash.rb | 177 +
.../actionpack/lib/action_controller/helpers.rb | 204 +
.../lib/action_controller/http_authentication.rb | 126 +
.../lib/action_controller/integration.rb | 581 +++
.../actionpack/lib/action_controller/layout.rb | 326 ++
.../lib/action_controller/mime_responds.rb | 170 +
.../actionpack/lib/action_controller/mime_type.rb | 163 +
.../actionpack/lib/action_controller/mime_types.rb | 20 +
.../lib/action_controller/polymorphic_routes.rb | 88 +
.../lib/action_controller/record_identifier.rb | 91 +
.../actionpack/lib/action_controller/request.rb | 730 ++++
.../request_forgery_protection.rb | 132 +
.../lib/action_controller/request_profiler.rb | 138 +
.../actionpack/lib/action_controller/rescue.rb | 258 ++
.../actionpack/lib/action_controller/resources.rb | 529 +++
.../actionpack/lib/action_controller/response.rb | 76 +
.../actionpack/lib/action_controller/routing.rb | 1499 +++++++
.../lib/action_controller/routing_optimisation.rb | 119 +
.../session/active_record_store.rb | 336 ++
.../lib/action_controller/session/cookie_store.rb | 164 +
.../lib/action_controller/session/drb_server.rb | 32 +
.../lib/action_controller/session/drb_store.rb | 35 +
.../action_controller/session/mem_cache_store.rb | 98 +
.../lib/action_controller/session_management.rb | 151 +
.../lib/action_controller/status_codes.rb | 88 +
.../actionpack/lib/action_controller/streaming.rb | 141 +
.../templates/rescues/_request_and_response.erb | 24 +
.../action_controller/templates/rescues/_trace.erb | 26 +
.../templates/rescues/diagnostics.erb | 11 +
.../action_controller/templates/rescues/layout.erb | 29 +
.../templates/rescues/missing_template.erb | 2 +
.../templates/rescues/routing_error.erb | 10 +
.../templates/rescues/template_error.erb | 21 +
.../templates/rescues/unknown_action.erb | 2 +
.../actionpack/lib/action_controller/test_case.rb | 53 +
.../lib/action_controller/test_process.rb | 520 +++
.../lib/action_controller/url_rewriter.rb | 135 +
.../vendor/html-scanner/html/document.rb | 68 +
.../vendor/html-scanner/html/node.rb | 530 +++
.../vendor/html-scanner/html/sanitizer.rb | 173 +
.../vendor/html-scanner/html/selector.rb | 828 ++++
.../vendor/html-scanner/html/tokenizer.rb | 105 +
.../vendor/html-scanner/html/version.rb | 11 +
.../lib/action_controller/verification.rb | 114 +
vendor/rails-2.0.2/actionpack/lib/action_pack.rb | 24 +
.../actionpack/lib/action_pack/version.rb | 9 +
vendor/rails-2.0.2/actionpack/lib/action_view.rb | 37 +
.../rails-2.0.2/actionpack/lib/action_view/base.rb | 642 +++
.../lib/action_view/compiled_templates.rb | 69 +
.../action_view/helpers/active_record_helper.rb | 255 ++
.../lib/action_view/helpers/asset_tag_helper.rb | 548 +++
.../lib/action_view/helpers/atom_feed_helper.rb | 111 +
.../lib/action_view/helpers/benchmark_helper.rb | 31 +
.../lib/action_view/helpers/cache_helper.rb | 39 +
.../lib/action_view/helpers/capture_helper.rb | 162 +
.../lib/action_view/helpers/date_helper.rb | 689 +++
.../lib/action_view/helpers/debug_helper.rb | 31 +
.../lib/action_view/helpers/form_helper.rb | 689 +++
.../lib/action_view/helpers/form_options_helper.rb | 425 ++
.../lib/action_view/helpers/form_tag_helper.rb | 432 ++
.../lib/action_view/helpers/javascript_helper.rb | 217 +
.../action_view/helpers/javascripts/controls.js | 963 ++++
.../action_view/helpers/javascripts/dragdrop.js | 972 +++++
.../lib/action_view/helpers/javascripts/effects.js | 1120 +++++
.../action_view/helpers/javascripts/prototype.js | 4225 ++++++++++++++++++
.../lib/action_view/helpers/number_helper.rb | 179 +
.../lib/action_view/helpers/prototype_helper.rb | 1268 ++++++
.../helpers/record_identification_helper.rb | 20 +
.../lib/action_view/helpers/record_tag_helper.rb | 59 +
.../lib/action_view/helpers/sanitize_helper.rb | 223 +
.../action_view/helpers/scriptaculous_helper.rb | 199 +
.../lib/action_view/helpers/tag_helper.rb | 133 +
.../lib/action_view/helpers/text_helper.rb | 479 ++
.../lib/action_view/helpers/url_helper.rb | 524 +++
.../actionpack/lib/action_view/partials.rb | 200 +
.../actionpack/lib/action_view/template_error.rb | 102 +
.../actionpack/lib/action_view/template_handler.rb | 17 +
.../lib/action_view/template_handlers/builder.rb | 19 +
.../lib/action_view/template_handlers/erb.rb | 21 +
.../lib/action_view/template_handlers/rjs.rb | 14 +
vendor/rails-2.0.2/actionpack/lib/actionpack.rb | 1 +
.../rails-2.0.2/actionpack/test/abstract_unit.rb | 36 +
.../actionpack/test/action_view_test.rb | 44 +
.../actionpack/test/active_record_unit.rb | 108 +
.../test/activerecord/active_record_store_test.rb | 142 +
...nder_partial_with_record_identification_test.rb | 74 +
.../test/controller/action_pack_assertions_test.rb | 492 +++
.../test/controller/addresses_render_test.rb | 43 +
.../test/controller/assert_select_test.rb | 682 +++
.../actionpack/test/controller/base_test.rb | 134 +
.../actionpack/test/controller/benchmark_test.rb | 33 +
.../actionpack/test/controller/caching_test.rb | 349 ++
.../actionpack/test/controller/capture_test.rb | 89 +
.../actionpack/test/controller/cgi_test.rb | 115 +
.../actionpack/test/controller/components_test.rb | 140 +
.../test/controller/content_type_test.rb | 139 +
.../app/controllers/admin/user_controller.rb | 0
.../app/controllers/user_controller.rb | 0
.../plugins/bad_plugin/lib/plugin_controller.rb | 0
.../actionpack/test/controller/cookie_test.rb | 135 +
.../test/controller/custom_handler_test.rb | 41 +
.../deprecation/deprecated_base_methods_test.rb | 37 +
.../actionpack/test/controller/dispatcher_test.rb | 123 +
.../actionpack/test/controller/fake_controllers.rb | 16 +
.../actionpack/test/controller/fake_models.rb | 5 +
.../test/controller/filter_params_test.rb | 43 +
.../actionpack/test/controller/filters_test.rb | 856 ++++
.../actionpack/test/controller/flash_test.rb | 146 +
.../test/controller/fragment_store_setting_test.rb | 47 +
.../actionpack/test/controller/helper_test.rb | 206 +
.../test/controller/html-scanner/document_test.rb | 124 +
.../test/controller/html-scanner/node_test.rb | 69 +
.../test/controller/html-scanner/sanitizer_test.rb | 250 ++
.../test/controller/html-scanner/tag_node_test.rb | 239 +
.../test/controller/html-scanner/text_node_test.rb | 51 +
.../test/controller/html-scanner/tokenizer_test.rb | 125 +
.../test/controller/http_authentication_test.rb | 54 +
.../actionpack/test/controller/integration_test.rb | 255 ++
.../actionpack/test/controller/layout_test.rb | 239 +
.../test/controller/mime_responds_test.rb | 506 +++
.../actionpack/test/controller/mime_type_test.rb | 55 +
.../actionpack/test/controller/new_render_test.rb | 832 ++++
.../test/controller/polymorphic_routes_test.rb | 98 +
.../test/controller/record_identifier_test.rb | 103 +
.../actionpack/test/controller/redirect_test.rb | 258 ++
.../actionpack/test/controller/render_test.rb | 464 ++
.../controller/request_forgery_protection_test.rb | 217 +
.../actionpack/test/controller/request_test.rb | 836 ++++
.../actionpack/test/controller/rescue_test.rb | 501 +++
.../actionpack/test/controller/resources_test.rb | 787 ++++
.../actionpack/test/controller/routing_test.rb | 2203 ++++++++++
.../actionpack/test/controller/selector_test.rb | 628 +++
.../actionpack/test/controller/send_file_test.rb | 127 +
.../test/controller/session/cookie_store_test.rb | 246 ++
.../controller/session/mem_cache_store_test.rb | 182 +
.../test/controller/session_fixation_test.rb | 89 +
.../test/controller/session_management_test.rb | 156 +
.../actionpack/test/controller/test_test.rb | 623 +++
.../test/controller/url_rewriter_test.rb | 246 ++
.../test/controller/verification_test.rb | 253 ++
.../actionpack/test/controller/view_paths_test.rb | 137 +
.../actionpack/test/controller/webservice_test.rb | 184 +
.../actionpack/test/fixtures/addresses/list.erb | 1 +
.../actionpack/test/fixtures/companies.yml | 24 +
.../actionpack/test/fixtures/company.rb | 9 +
...nder_default_content_types_for_respond_to.rhtml | 1 +
.../content_type/render_default_for_rhtml.rhtml | 1 +
.../content_type/render_default_for_rjs.rjs | 1 +
.../content_type/render_default_for_rxml.rxml | 1 +
.../test/fixtures/db_definitions/sqlite.sql | 43 +
.../actionpack/test/fixtures/developer.rb | 9 +
.../actionpack/test/fixtures/developers.yml | 21 +
.../test/fixtures/developers_projects.yml | 13 +
.../test/fixtures/fun/games/hello_world.erb | 1 +
.../actionpack/test/fixtures/helpers/abc_helper.rb | 5 +
.../test/fixtures/helpers/fun/games_helper.rb | 3 +
.../test/fixtures/helpers/fun/pdf_helper.rb | 3 +
.../test/fixtures/layout_tests/alt/hello.rhtml | 1 +
.../layouts/controller_name_space/nested.rhtml | 1 +
.../test/fixtures/layout_tests/layouts/item.rhtml | 1 +
.../layout_tests/layouts/layout_test.rhtml | 1 +
.../layouts/multiple_extensions.html.erb | 1 +
.../layouts/third_party_template_library.mab | 1 +
.../test/fixtures/layout_tests/views/hello.rhtml | 1 +
.../test/fixtures/layouts/builder.builder | 3 +
.../actionpack/test/fixtures/layouts/standard.erb | 1 +
.../test/fixtures/layouts/talk_from_action.erb | 2 +
.../actionpack/test/fixtures/layouts/yield.erb | 2 +
.../actionpack/test/fixtures/multipart/binary_file | Bin 0 -> 19820 bytes
.../test/fixtures/multipart/bracketed_param | 5 +
.../test/fixtures/multipart/large_text_file | 10 +
.../actionpack/test/fixtures/multipart/mixed_files | Bin 0 -> 19937 bytes
.../test/fixtures/multipart/mona_lisa.jpg | Bin 0 -> 159528 bytes
.../test/fixtures/multipart/single_parameter | 5 +
.../actionpack/test/fixtures/multipart/text_file | 10 +
.../test/fixtures/override/test/hello_world.erb | 1 +
.../test/fixtures/override2/layouts/test/sub.erb | 1 +
.../test/fixtures/post_test/layouts/post.html.erb | 1 +
.../post_test/layouts/super_post.iphone.erb | 1 +
.../test/fixtures/post_test/post/index.html.erb | 1 +
.../test/fixtures/post_test/post/index.iphone.erb | 1 +
.../fixtures/post_test/super_post/index.html.erb | 1 +
.../fixtures/post_test/super_post/index.iphone.erb | 1 +
.../actionpack/test/fixtures/project.rb | 3 +
.../actionpack/test/fixtures/projects.yml | 7 +
.../actionpack/test/fixtures/public/404.html | 1 +
.../actionpack/test/fixtures/public/500.html | 1 +
.../test/fixtures/public/images/rails.png | Bin 0 -> 1787 bytes
.../fixtures/public/javascripts/application.js | 0
.../test/fixtures/public/javascripts/bank.js | 1 +
.../test/fixtures/public/javascripts/robber.js | 1 +
.../test/fixtures/public/stylesheets/bank.css | 1 +
.../test/fixtures/public/stylesheets/robber.css | 1 +
.../actionpack/test/fixtures/replies.yml | 15 +
.../rails-2.0.2/actionpack/test/fixtures/reply.rb | 6 +
.../respond_to/all_types_with_layout.html.erb | 1 +
.../respond_to/all_types_with_layout.js.rjs | 1 +
...stom_constant_handling_without_block.mobile.erb | 1 +
.../iphone_with_html_response_type.html.erb | 1 +
.../iphone_with_html_response_type.iphone.erb | 1 +
.../fixtures/respond_to/layouts/missing.html.erb | 1 +
.../fixtures/respond_to/layouts/standard.html.erb | 1 +
.../respond_to/layouts/standard.iphone.erb | 1 +
.../fixtures/respond_to/using_defaults.html.erb | 1 +
.../test/fixtures/respond_to/using_defaults.js.rjs | 1 +
.../fixtures/respond_to/using_defaults.xml.builder | 1 +
.../using_defaults_with_type_list.html.erb | 1 +
.../using_defaults_with_type_list.js.rjs | 1 +
.../using_defaults_with_type_list.xml.builder | 1 +
.../test/fixtures/scope/test/modgreet.erb | 1 +
.../actionpack/test/fixtures/test/_customer.erb | 1 +
.../test/fixtures/test/_customer_greeting.erb | 1 +
.../test/fixtures/test/_hash_greeting.erb | 1 +
.../actionpack/test/fixtures/test/_hash_object.erb | 2 +
.../actionpack/test/fixtures/test/_hello.builder | 1 +
.../fixtures/test/_layout_for_partial.html.erb | 3 +
.../actionpack/test/fixtures/test/_partial.erb | 1 +
.../test/fixtures/test/_partial.html.erb | 1 +
.../actionpack/test/fixtures/test/_partial.js.erb | 1 +
.../test/_partial_for_use_in_layout.html.erb | 1 +
.../test/fixtures/test/_partial_only.erb | 1 +
.../actionpack/test/fixtures/test/_person.erb | 2 +
.../test/fixtures/test/action_talk_to_layout.erb | 2 +
.../test/fixtures/test/block_content_for.erb | 2 +
.../test/calling_partial_with_layout.html.erb | 1 +
.../actionpack/test/fixtures/test/capturing.erb | 4 +
.../actionpack/test/fixtures/test/content_for.erb | 2 +
.../fixtures/test/content_for_concatenated.erb | 3 +
.../fixtures/test/content_for_with_parameter.erb | 2 +
.../test/fixtures/test/delete_with_js.rjs | 2 +
.../test/dot.directory/render_file_with_ivar.erb | 1 +
.../test/fixtures/test/enum_rjs_test.rjs | 6 +
.../test/fixtures/test/erb_content_for.erb | 2 +
.../test/fixtures/test/formatted_html_erb.html.erb | 1 +
.../test/fixtures/test/formatted_xml_erb.builder | 1 +
.../test/fixtures/test/formatted_xml_erb.html.erb | 1 +
.../test/fixtures/test/formatted_xml_erb.xml.erb | 1 +
.../actionpack/test/fixtures/test/greeting.erb | 1 +
.../actionpack/test/fixtures/test/hello.builder | 4 +
.../actionpack/test/fixtures/test/hello_world.erb | 1 +
.../fixtures/test/hello_world_container.builder | 3 +
.../fixtures/test/hello_world_from_rxml.builder | 4 +
.../test/hello_world_with_layout_false.erb | 1 +
.../test/fixtures/test/hello_xml_world.builder | 11 +
.../actionpack/test/fixtures/test/list.erb | 1 +
.../test/non_erb_block_content_for.builder | 4 +
.../test/fixtures/test/potential_conflicts.erb | 4 +
.../test/fixtures/test/render_file_with_ivar.erb | 1 +
.../test/fixtures/test/render_file_with_locals.erb | 1 +
.../test/fixtures/test/render_to_string_test.erb | 1 +
.../fixtures/test/update_element_with_capture.erb | 9 +
.../test/using_layout_around_block.html.erb | 1 +
.../rails-2.0.2/actionpack/test/fixtures/topic.rb | 3 +
.../actionpack/test/fixtures/topics.yml | 22 +
.../test/template/active_record_helper_test.rb | 251 ++
.../test/template/asset_tag_helper_test.rb | 438 ++
.../test/template/atom_feed_helper_test.rb | 101 +
.../test/template/benchmark_helper_test.rb | 72 +
.../test/template/compiled_templates_test.rb | 193 +
.../actionpack/test/template/date_helper_test.rb | 1438 ++++++
.../actionpack/test/template/erb_util_test.rb | 56 +
.../actionpack/test/template/form_helper_test.rb | 792 ++++
.../test/template/form_options_helper_test.rb | 1296 ++++++
.../test/template/form_tag_helper_test.rb | 238 +
.../test/template/javascript_helper_test.rb | 115 +
.../actionpack/test/template/number_helper_test.rb | 93 +
.../test/template/prototype_helper_test.rb | 627 +++
.../test/template/sanitize_helper_test.rb | 49 +
.../test/template/scriptaculous_helper_test.rb | 96 +
.../actionpack/test/template/tag_helper_test.rb | 80 +
.../actionpack/test/template/text_helper_test.rb | 335 ++
.../actionpack/test/template/url_helper_test.rb | 536 +++
.../rails-2.0.2/actionpack/test/testing_sandbox.rb | 11 +
300 files changed, 57203 insertions(+)
create mode 100644 vendor/rails-2.0.2/actionpack/CHANGELOG
create mode 100644 vendor/rails-2.0.2/actionpack/MIT-LICENSE
create mode 100644 vendor/rails-2.0.2/actionpack/README
create mode 100644 vendor/rails-2.0.2/actionpack/RUNNING_UNIT_TESTS
create mode 100644 vendor/rails-2.0.2/actionpack/Rakefile
create mode 100644 vendor/rails-2.0.2/actionpack/install.rb
create mode 100755 vendor/rails-2.0.2/actionpack/lib/action_controller.rb
create mode 100644 vendor/rails-2.0.2/actionpack/lib/action_controller/assertions.rb
create mode 100644 vendor/rails-2.0.2/actionpack/lib/action_controller/assertions/dom_assertions.rb
create mode 100644 vendor/rails-2.0.2/actionpack/lib/action_controller/assertions/model_assertions.rb
create mode 100644 vendor/rails-2.0.2/actionpack/lib/action_controller/assertions/response_assertions.rb
create mode 100644 vendor/rails-2.0.2/actionpack/lib/action_controller/assertions/routing_assertions.rb
create mode 100644 vendor/rails-2.0.2/actionpack/lib/action_controller/assertions/selector_assertions.rb
create mode 100644 vendor/rails-2.0.2/actionpack/lib/action_controller/assertions/tag_assertions.rb
create mode 100755 vendor/rails-2.0.2/actionpack/lib/action_controller/base.rb
create mode 100644 vendor/rails-2.0.2/actionpack/lib/action_controller/benchmarking.rb
create mode 100644 vendor/rails-2.0.2/actionpack/lib/action_controller/caching.rb
create mode 100644 vendor/rails-2.0.2/actionpack/lib/action_controller/cgi_ext.rb
create mode 100644 vendor/rails-2.0.2/actionpack/lib/action_controller/cgi_ext/cookie.rb
create mode 100644 vendor/rails-2.0.2/actionpack/lib/action_controller/cgi_ext/query_extension.rb
create mode 100644 vendor/rails-2.0.2/actionpack/lib/action_controller/cgi_ext/session.rb
create mode 100644 vendor/rails-2.0.2/actionpack/lib/action_controller/cgi_ext/stdinput.rb
create mode 100644 vendor/rails-2.0.2/actionpack/lib/action_controller/cgi_process.rb
create mode 100644 vendor/rails-2.0.2/actionpack/lib/action_controller/components.rb
create mode 100644 vendor/rails-2.0.2/actionpack/lib/action_controller/cookies.rb
create mode 100644 vendor/rails-2.0.2/actionpack/lib/action_controller/dispatcher.rb
create mode 100644 vendor/rails-2.0.2/actionpack/lib/action_controller/filters.rb
create mode 100644 vendor/rails-2.0.2/actionpack/lib/action_controller/flash.rb
create mode 100644 vendor/rails-2.0.2/actionpack/lib/action_controller/helpers.rb
create mode 100644 vendor/rails-2.0.2/actionpack/lib/action_controller/http_authentication.rb
create mode 100644 vendor/rails-2.0.2/actionpack/lib/action_controller/integration.rb
create mode 100644 vendor/rails-2.0.2/actionpack/lib/action_controller/layout.rb
create mode 100644 vendor/rails-2.0.2/actionpack/lib/action_controller/mime_responds.rb
create mode 100644 vendor/rails-2.0.2/actionpack/lib/action_controller/mime_type.rb
create mode 100644 vendor/rails-2.0.2/actionpack/lib/action_controller/mime_types.rb
create mode 100644 vendor/rails-2.0.2/actionpack/lib/action_controller/polymorphic_routes.rb
create mode 100644 vendor/rails-2.0.2/actionpack/lib/action_controller/record_identifier.rb
create mode 100755 vendor/rails-2.0.2/actionpack/lib/action_controller/request.rb
create mode 100644 vendor/rails-2.0.2/actionpack/lib/action_controller/request_forgery_protection.rb
create mode 100755 vendor/rails-2.0.2/actionpack/lib/action_controller/request_profiler.rb
create mode 100644 vendor/rails-2.0.2/actionpack/lib/action_controller/rescue.rb
create mode 100644 vendor/rails-2.0.2/actionpack/lib/action_controller/resources.rb
create mode 100755 vendor/rails-2.0.2/actionpack/lib/action_controller/response.rb
create mode 100644 vendor/rails-2.0.2/actionpack/lib/action_controller/routing.rb
create mode 100644 vendor/rails-2.0.2/actionpack/lib/action_controller/routing_optimisation.rb
create mode 100644 vendor/rails-2.0.2/actionpack/lib/action_controller/session/active_record_store.rb
create mode 100644 vendor/rails-2.0.2/actionpack/lib/action_controller/session/cookie_store.rb
create mode 100644 vendor/rails-2.0.2/actionpack/lib/action_controller/session/drb_server.rb
create mode 100644 vendor/rails-2.0.2/actionpack/lib/action_controller/session/drb_store.rb
create mode 100644 vendor/rails-2.0.2/actionpack/lib/action_controller/session/mem_cache_store.rb
create mode 100644 vendor/rails-2.0.2/actionpack/lib/action_controller/session_management.rb
create mode 100644 vendor/rails-2.0.2/actionpack/lib/action_controller/status_codes.rb
create mode 100644 vendor/rails-2.0.2/actionpack/lib/action_controller/streaming.rb
create mode 100644 vendor/rails-2.0.2/actionpack/lib/action_controller/templates/rescues/_request_and_response.erb
create mode 100644 vendor/rails-2.0.2/actionpack/lib/action_controller/templates/rescues/_trace.erb
create mode 100644 vendor/rails-2.0.2/actionpack/lib/action_controller/templates/rescues/diagnostics.erb
create mode 100644 vendor/rails-2.0.2/actionpack/lib/action_controller/templates/rescues/layout.erb
create mode 100644 vendor/rails-2.0.2/actionpack/lib/action_controller/templates/rescues/missing_template.erb
create mode 100644 vendor/rails-2.0.2/actionpack/lib/action_controller/templates/rescues/routing_error.erb
create mode 100644 vendor/rails-2.0.2/actionpack/lib/action_controller/templates/rescues/template_error.erb
create mode 100644 vendor/rails-2.0.2/actionpack/lib/action_controller/templates/rescues/unknown_action.erb
create mode 100644 vendor/rails-2.0.2/actionpack/lib/action_controller/test_case.rb
create mode 100644 vendor/rails-2.0.2/actionpack/lib/action_controller/test_process.rb
create mode 100644 vendor/rails-2.0.2/actionpack/lib/action_controller/url_rewriter.rb
create mode 100644 vendor/rails-2.0.2/actionpack/lib/action_controller/vendor/html-scanner/html/document.rb
create mode 100644 vendor/rails-2.0.2/actionpack/lib/action_controller/vendor/html-scanner/html/node.rb
create mode 100644 vendor/rails-2.0.2/actionpack/lib/action_controller/vendor/html-scanner/html/sanitizer.rb
create mode 100644 vendor/rails-2.0.2/actionpack/lib/action_controller/vendor/html-scanner/html/selector.rb
create mode 100644 vendor/rails-2.0.2/actionpack/lib/action_controller/vendor/html-scanner/html/tokenizer.rb
create mode 100644 vendor/rails-2.0.2/actionpack/lib/action_controller/vendor/html-scanner/html/version.rb
create mode 100644 vendor/rails-2.0.2/actionpack/lib/action_controller/verification.rb
create mode 100644 vendor/rails-2.0.2/actionpack/lib/action_pack.rb
create mode 100644 vendor/rails-2.0.2/actionpack/lib/action_pack/version.rb
create mode 100644 vendor/rails-2.0.2/actionpack/lib/action_view.rb
create mode 100644 vendor/rails-2.0.2/actionpack/lib/action_view/base.rb
create mode 100644 vendor/rails-2.0.2/actionpack/lib/action_view/compiled_templates.rb
create mode 100644 vendor/rails-2.0.2/actionpack/lib/action_view/helpers/active_record_helper.rb
create mode 100644 vendor/rails-2.0.2/actionpack/lib/action_view/helpers/asset_tag_helper.rb
create mode 100644 vendor/rails-2.0.2/actionpack/lib/action_view/helpers/atom_feed_helper.rb
create mode 100644 vendor/rails-2.0.2/actionpack/lib/action_view/helpers/benchmark_helper.rb
create mode 100644 vendor/rails-2.0.2/actionpack/lib/action_view/helpers/cache_helper.rb
create mode 100644 vendor/rails-2.0.2/actionpack/lib/action_view/helpers/capture_helper.rb
create mode 100755 vendor/rails-2.0.2/actionpack/lib/action_view/helpers/date_helper.rb
create mode 100644 vendor/rails-2.0.2/actionpack/lib/action_view/helpers/debug_helper.rb
create mode 100644 vendor/rails-2.0.2/actionpack/lib/action_view/helpers/form_helper.rb
create mode 100644 vendor/rails-2.0.2/actionpack/lib/action_view/helpers/form_options_helper.rb
create mode 100644 vendor/rails-2.0.2/actionpack/lib/action_view/helpers/form_tag_helper.rb
create mode 100644 vendor/rails-2.0.2/actionpack/lib/action_view/helpers/javascript_helper.rb
create mode 100644 vendor/rails-2.0.2/actionpack/lib/action_view/helpers/javascripts/controls.js
create mode 100644 vendor/rails-2.0.2/actionpack/lib/action_view/helpers/javascripts/dragdrop.js
create mode 100644 vendor/rails-2.0.2/actionpack/lib/action_view/helpers/javascripts/effects.js
create mode 100644 vendor/rails-2.0.2/actionpack/lib/action_view/helpers/javascripts/prototype.js
create mode 100644 vendor/rails-2.0.2/actionpack/lib/action_view/helpers/number_helper.rb
create mode 100644 vendor/rails-2.0.2/actionpack/lib/action_view/helpers/prototype_helper.rb
create mode 100644 vendor/rails-2.0.2/actionpack/lib/action_view/helpers/record_identification_helper.rb
create mode 100644 vendor/rails-2.0.2/actionpack/lib/action_view/helpers/record_tag_helper.rb
create mode 100644 vendor/rails-2.0.2/actionpack/lib/action_view/helpers/sanitize_helper.rb
create mode 100644 vendor/rails-2.0.2/actionpack/lib/action_view/helpers/scriptaculous_helper.rb
create mode 100644 vendor/rails-2.0.2/actionpack/lib/action_view/helpers/tag_helper.rb
create mode 100644 vendor/rails-2.0.2/actionpack/lib/action_view/helpers/text_helper.rb
create mode 100644 vendor/rails-2.0.2/actionpack/lib/action_view/helpers/url_helper.rb
create mode 100644 vendor/rails-2.0.2/actionpack/lib/action_view/partials.rb
create mode 100644 vendor/rails-2.0.2/actionpack/lib/action_view/template_error.rb
create mode 100644 vendor/rails-2.0.2/actionpack/lib/action_view/template_handler.rb
create mode 100644 vendor/rails-2.0.2/actionpack/lib/action_view/template_handlers/builder.rb
create mode 100644 vendor/rails-2.0.2/actionpack/lib/action_view/template_handlers/erb.rb
create mode 100644 vendor/rails-2.0.2/actionpack/lib/action_view/template_handlers/rjs.rb
create mode 100644 vendor/rails-2.0.2/actionpack/lib/actionpack.rb
create mode 100644 vendor/rails-2.0.2/actionpack/test/abstract_unit.rb
create mode 100644 vendor/rails-2.0.2/actionpack/test/action_view_test.rb
create mode 100644 vendor/rails-2.0.2/actionpack/test/active_record_unit.rb
create mode 100644 vendor/rails-2.0.2/actionpack/test/activerecord/active_record_store_test.rb
create mode 100644 vendor/rails-2.0.2/actionpack/test/activerecord/render_partial_with_record_identification_test.rb
create mode 100644 vendor/rails-2.0.2/actionpack/test/controller/action_pack_assertions_test.rb
create mode 100644 vendor/rails-2.0.2/actionpack/test/controller/addresses_render_test.rb
create mode 100644 vendor/rails-2.0.2/actionpack/test/controller/assert_select_test.rb
create mode 100644 vendor/rails-2.0.2/actionpack/test/controller/base_test.rb
create mode 100644 vendor/rails-2.0.2/actionpack/test/controller/benchmark_test.rb
create mode 100644 vendor/rails-2.0.2/actionpack/test/controller/caching_test.rb
create mode 100644 vendor/rails-2.0.2/actionpack/test/controller/capture_test.rb
create mode 100755 vendor/rails-2.0.2/actionpack/test/controller/cgi_test.rb
create mode 100644 vendor/rails-2.0.2/actionpack/test/controller/components_test.rb
create mode 100644 vendor/rails-2.0.2/actionpack/test/controller/content_type_test.rb
create mode 100644 vendor/rails-2.0.2/actionpack/test/controller/controller_fixtures/app/controllers/admin/user_controller.rb
create mode 100644 vendor/rails-2.0.2/actionpack/test/controller/controller_fixtures/app/controllers/user_controller.rb
create mode 100644 vendor/rails-2.0.2/actionpack/test/controller/controller_fixtures/vendor/plugins/bad_plugin/lib/plugin_controller.rb
create mode 100644 vendor/rails-2.0.2/actionpack/test/controller/cookie_test.rb
create mode 100644 vendor/rails-2.0.2/actionpack/test/controller/custom_handler_test.rb
create mode 100644 vendor/rails-2.0.2/actionpack/test/controller/deprecation/deprecated_base_methods_test.rb
create mode 100644 vendor/rails-2.0.2/actionpack/test/controller/dispatcher_test.rb
create mode 100644 vendor/rails-2.0.2/actionpack/test/controller/fake_controllers.rb
create mode 100644 vendor/rails-2.0.2/actionpack/test/controller/fake_models.rb
create mode 100644 vendor/rails-2.0.2/actionpack/test/controller/filter_params_test.rb
create mode 100644 vendor/rails-2.0.2/actionpack/test/controller/filters_test.rb
create mode 100644 vendor/rails-2.0.2/actionpack/test/controller/flash_test.rb
create mode 100644 vendor/rails-2.0.2/actionpack/test/controller/fragment_store_setting_test.rb
create mode 100644 vendor/rails-2.0.2/actionpack/test/controller/helper_test.rb
create mode 100644 vendor/rails-2.0.2/actionpack/test/controller/html-scanner/document_test.rb
create mode 100644 vendor/rails-2.0.2/actionpack/test/controller/html-scanner/node_test.rb
create mode 100644 vendor/rails-2.0.2/actionpack/test/controller/html-scanner/sanitizer_test.rb
create mode 100644 vendor/rails-2.0.2/actionpack/test/controller/html-scanner/tag_node_test.rb
create mode 100644 vendor/rails-2.0.2/actionpack/test/controller/html-scanner/text_node_test.rb
create mode 100644 vendor/rails-2.0.2/actionpack/test/controller/html-scanner/tokenizer_test.rb
create mode 100644 vendor/rails-2.0.2/actionpack/test/controller/http_authentication_test.rb
create mode 100644 vendor/rails-2.0.2/actionpack/test/controller/integration_test.rb
create mode 100644 vendor/rails-2.0.2/actionpack/test/controller/layout_test.rb
create mode 100644 vendor/rails-2.0.2/actionpack/test/controller/mime_responds_test.rb
create mode 100644 vendor/rails-2.0.2/actionpack/test/controller/mime_type_test.rb
create mode 100644 vendor/rails-2.0.2/actionpack/test/controller/new_render_test.rb
create mode 100644 vendor/rails-2.0.2/actionpack/test/controller/polymorphic_routes_test.rb
create mode 100644 vendor/rails-2.0.2/actionpack/test/controller/record_identifier_test.rb
create mode 100755 vendor/rails-2.0.2/actionpack/test/controller/redirect_test.rb
create mode 100644 vendor/rails-2.0.2/actionpack/test/controller/render_test.rb
create mode 100644 vendor/rails-2.0.2/actionpack/test/controller/request_forgery_protection_test.rb
create mode 100644 vendor/rails-2.0.2/actionpack/test/controller/request_test.rb
create mode 100644 vendor/rails-2.0.2/actionpack/test/controller/rescue_test.rb
create mode 100644 vendor/rails-2.0.2/actionpack/test/controller/resources_test.rb
create mode 100644 vendor/rails-2.0.2/actionpack/test/controller/routing_test.rb
create mode 100644 vendor/rails-2.0.2/actionpack/test/controller/selector_test.rb
create mode 100644 vendor/rails-2.0.2/actionpack/test/controller/send_file_test.rb
create mode 100755 vendor/rails-2.0.2/actionpack/test/controller/session/cookie_store_test.rb
create mode 100644 vendor/rails-2.0.2/actionpack/test/controller/session/mem_cache_store_test.rb
create mode 100644 vendor/rails-2.0.2/actionpack/test/controller/session_fixation_test.rb
create mode 100644 vendor/rails-2.0.2/actionpack/test/controller/session_management_test.rb
create mode 100644 vendor/rails-2.0.2/actionpack/test/controller/test_test.rb
create mode 100644 vendor/rails-2.0.2/actionpack/test/controller/url_rewriter_test.rb
create mode 100644 vendor/rails-2.0.2/actionpack/test/controller/verification_test.rb
create mode 100644 vendor/rails-2.0.2/actionpack/test/controller/view_paths_test.rb
create mode 100644 vendor/rails-2.0.2/actionpack/test/controller/webservice_test.rb
create mode 100644 vendor/rails-2.0.2/actionpack/test/fixtures/addresses/list.erb
create mode 100644 vendor/rails-2.0.2/actionpack/test/fixtures/companies.yml
create mode 100644 vendor/rails-2.0.2/actionpack/test/fixtures/company.rb
create mode 100644 vendor/rails-2.0.2/actionpack/test/fixtures/content_type/render_default_content_types_for_respond_to.rhtml
create mode 100644 vendor/rails-2.0.2/actionpack/test/fixtures/content_type/render_default_for_rhtml.rhtml
create mode 100644 vendor/rails-2.0.2/actionpack/test/fixtures/content_type/render_default_for_rjs.rjs
create mode 100644 vendor/rails-2.0.2/actionpack/test/fixtures/content_type/render_default_for_rxml.rxml
create mode 100644 vendor/rails-2.0.2/actionpack/test/fixtures/db_definitions/sqlite.sql
create mode 100644 vendor/rails-2.0.2/actionpack/test/fixtures/developer.rb
create mode 100644 vendor/rails-2.0.2/actionpack/test/fixtures/developers.yml
create mode 100644 vendor/rails-2.0.2/actionpack/test/fixtures/developers_projects.yml
create mode 100644 vendor/rails-2.0.2/actionpack/test/fixtures/fun/games/hello_world.erb
create mode 100644 vendor/rails-2.0.2/actionpack/test/fixtures/helpers/abc_helper.rb
create mode 100644 vendor/rails-2.0.2/actionpack/test/fixtures/helpers/fun/games_helper.rb
create mode 100644 vendor/rails-2.0.2/actionpack/test/fixtures/helpers/fun/pdf_helper.rb
create mode 100644 vendor/rails-2.0.2/actionpack/test/fixtures/layout_tests/alt/hello.rhtml
create mode 100644 vendor/rails-2.0.2/actionpack/test/fixtures/layout_tests/layouts/controller_name_space/nested.rhtml
create mode 100644 vendor/rails-2.0.2/actionpack/test/fixtures/layout_tests/layouts/item.rhtml
create mode 100644 vendor/rails-2.0.2/actionpack/test/fixtures/layout_tests/layouts/layout_test.rhtml
create mode 100644 vendor/rails-2.0.2/actionpack/test/fixtures/layout_tests/layouts/multiple_extensions.html.erb
create mode 100644 vendor/rails-2.0.2/actionpack/test/fixtures/layout_tests/layouts/third_party_template_library.mab
create mode 100644 vendor/rails-2.0.2/actionpack/test/fixtures/layout_tests/views/hello.rhtml
create mode 100644 vendor/rails-2.0.2/actionpack/test/fixtures/layouts/builder.builder
create mode 100644 vendor/rails-2.0.2/actionpack/test/fixtures/layouts/standard.erb
create mode 100644 vendor/rails-2.0.2/actionpack/test/fixtures/layouts/talk_from_action.erb
create mode 100644 vendor/rails-2.0.2/actionpack/test/fixtures/layouts/yield.erb
create mode 100644 vendor/rails-2.0.2/actionpack/test/fixtures/multipart/binary_file
create mode 100644 vendor/rails-2.0.2/actionpack/test/fixtures/multipart/bracketed_param
create mode 100644 vendor/rails-2.0.2/actionpack/test/fixtures/multipart/large_text_file
create mode 100644 vendor/rails-2.0.2/actionpack/test/fixtures/multipart/mixed_files
create mode 100644 vendor/rails-2.0.2/actionpack/test/fixtures/multipart/mona_lisa.jpg
create mode 100644 vendor/rails-2.0.2/actionpack/test/fixtures/multipart/single_parameter
create mode 100644 vendor/rails-2.0.2/actionpack/test/fixtures/multipart/text_file
create mode 100644 vendor/rails-2.0.2/actionpack/test/fixtures/override/test/hello_world.erb
create mode 100644 vendor/rails-2.0.2/actionpack/test/fixtures/override2/layouts/test/sub.erb
create mode 100644 vendor/rails-2.0.2/actionpack/test/fixtures/post_test/layouts/post.html.erb
create mode 100644 vendor/rails-2.0.2/actionpack/test/fixtures/post_test/layouts/super_post.iphone.erb
create mode 100644 vendor/rails-2.0.2/actionpack/test/fixtures/post_test/post/index.html.erb
create mode 100644 vendor/rails-2.0.2/actionpack/test/fixtures/post_test/post/index.iphone.erb
create mode 100644 vendor/rails-2.0.2/actionpack/test/fixtures/post_test/super_post/index.html.erb
create mode 100644 vendor/rails-2.0.2/actionpack/test/fixtures/post_test/super_post/index.iphone.erb
create mode 100644 vendor/rails-2.0.2/actionpack/test/fixtures/project.rb
create mode 100644 vendor/rails-2.0.2/actionpack/test/fixtures/projects.yml
create mode 100644 vendor/rails-2.0.2/actionpack/test/fixtures/public/404.html
create mode 100644 vendor/rails-2.0.2/actionpack/test/fixtures/public/500.html
create mode 100644 vendor/rails-2.0.2/actionpack/test/fixtures/public/images/rails.png
create mode 100644 vendor/rails-2.0.2/actionpack/test/fixtures/public/javascripts/application.js
create mode 100644 vendor/rails-2.0.2/actionpack/test/fixtures/public/javascripts/bank.js
create mode 100644 vendor/rails-2.0.2/actionpack/test/fixtures/public/javascripts/robber.js
create mode 100644 vendor/rails-2.0.2/actionpack/test/fixtures/public/stylesheets/bank.css
create mode 100644 vendor/rails-2.0.2/actionpack/test/fixtures/public/stylesheets/robber.css
create mode 100644 vendor/rails-2.0.2/actionpack/test/fixtures/replies.yml
create mode 100644 vendor/rails-2.0.2/actionpack/test/fixtures/reply.rb
create mode 100644 vendor/rails-2.0.2/actionpack/test/fixtures/respond_to/all_types_with_layout.html.erb
create mode 100644 vendor/rails-2.0.2/actionpack/test/fixtures/respond_to/all_types_with_layout.js.rjs
create mode 100644 vendor/rails-2.0.2/actionpack/test/fixtures/respond_to/custom_constant_handling_without_block.mobile.erb
create mode 100644 vendor/rails-2.0.2/actionpack/test/fixtures/respond_to/iphone_with_html_response_type.html.erb
create mode 100644 vendor/rails-2.0.2/actionpack/test/fixtures/respond_to/iphone_with_html_response_type.iphone.erb
create mode 100644 vendor/rails-2.0.2/actionpack/test/fixtures/respond_to/layouts/missing.html.erb
create mode 100644 vendor/rails-2.0.2/actionpack/test/fixtures/respond_to/layouts/standard.html.erb
create mode 100644 vendor/rails-2.0.2/actionpack/test/fixtures/respond_to/layouts/standard.iphone.erb
create mode 100644 vendor/rails-2.0.2/actionpack/test/fixtures/respond_to/using_defaults.html.erb
create mode 100644 vendor/rails-2.0.2/actionpack/test/fixtures/respond_to/using_defaults.js.rjs
create mode 100644 vendor/rails-2.0.2/actionpack/test/fixtures/respond_to/using_defaults.xml.builder
create mode 100644 vendor/rails-2.0.2/actionpack/test/fixtures/respond_to/using_defaults_with_type_list.html.erb
create mode 100644 vendor/rails-2.0.2/actionpack/test/fixtures/respond_to/using_defaults_with_type_list.js.rjs
create mode 100644 vendor/rails-2.0.2/actionpack/test/fixtures/respond_to/using_defaults_with_type_list.xml.builder
create mode 100644 vendor/rails-2.0.2/actionpack/test/fixtures/scope/test/modgreet.erb
create mode 100644 vendor/rails-2.0.2/actionpack/test/fixtures/test/_customer.erb
create mode 100644 vendor/rails-2.0.2/actionpack/test/fixtures/test/_customer_greeting.erb
create mode 100644 vendor/rails-2.0.2/actionpack/test/fixtures/test/_hash_greeting.erb
create mode 100644 vendor/rails-2.0.2/actionpack/test/fixtures/test/_hash_object.erb
create mode 100644 vendor/rails-2.0.2/actionpack/test/fixtures/test/_hello.builder
create mode 100644 vendor/rails-2.0.2/actionpack/test/fixtures/test/_layout_for_partial.html.erb
create mode 100644 vendor/rails-2.0.2/actionpack/test/fixtures/test/_partial.erb
create mode 100644 vendor/rails-2.0.2/actionpack/test/fixtures/test/_partial.html.erb
create mode 100644 vendor/rails-2.0.2/actionpack/test/fixtures/test/_partial.js.erb
create mode 100644 vendor/rails-2.0.2/actionpack/test/fixtures/test/_partial_for_use_in_layout.html.erb
create mode 100644 vendor/rails-2.0.2/actionpack/test/fixtures/test/_partial_only.erb
create mode 100644 vendor/rails-2.0.2/actionpack/test/fixtures/test/_person.erb
create mode 100644 vendor/rails-2.0.2/actionpack/test/fixtures/test/action_talk_to_layout.erb
create mode 100644 vendor/rails-2.0.2/actionpack/test/fixtures/test/block_content_for.erb
create mode 100644 vendor/rails-2.0.2/actionpack/test/fixtures/test/calling_partial_with_layout.html.erb
create mode 100644 vendor/rails-2.0.2/actionpack/test/fixtures/test/capturing.erb
create mode 100644 vendor/rails-2.0.2/actionpack/test/fixtures/test/content_for.erb
create mode 100644 vendor/rails-2.0.2/actionpack/test/fixtures/test/content_for_concatenated.erb
create mode 100644 vendor/rails-2.0.2/actionpack/test/fixtures/test/content_for_with_parameter.erb
create mode 100644 vendor/rails-2.0.2/actionpack/test/fixtures/test/delete_with_js.rjs
create mode 100644 vendor/rails-2.0.2/actionpack/test/fixtures/test/dot.directory/render_file_with_ivar.erb
create mode 100644 vendor/rails-2.0.2/actionpack/test/fixtures/test/enum_rjs_test.rjs
create mode 100644 vendor/rails-2.0.2/actionpack/test/fixtures/test/erb_content_for.erb
create mode 100644 vendor/rails-2.0.2/actionpack/test/fixtures/test/formatted_html_erb.html.erb
create mode 100644 vendor/rails-2.0.2/actionpack/test/fixtures/test/formatted_xml_erb.builder
create mode 100644 vendor/rails-2.0.2/actionpack/test/fixtures/test/formatted_xml_erb.html.erb
create mode 100644 vendor/rails-2.0.2/actionpack/test/fixtures/test/formatted_xml_erb.xml.erb
create mode 100644 vendor/rails-2.0.2/actionpack/test/fixtures/test/greeting.erb
create mode 100644 vendor/rails-2.0.2/actionpack/test/fixtures/test/hello.builder
create mode 100644 vendor/rails-2.0.2/actionpack/test/fixtures/test/hello_world.erb
create mode 100644 vendor/rails-2.0.2/actionpack/test/fixtures/test/hello_world_container.builder
create mode 100644 vendor/rails-2.0.2/actionpack/test/fixtures/test/hello_world_from_rxml.builder
create mode 100644 vendor/rails-2.0.2/actionpack/test/fixtures/test/hello_world_with_layout_false.erb
create mode 100644 vendor/rails-2.0.2/actionpack/test/fixtures/test/hello_xml_world.builder
create mode 100644 vendor/rails-2.0.2/actionpack/test/fixtures/test/list.erb
create mode 100644 vendor/rails-2.0.2/actionpack/test/fixtures/test/non_erb_block_content_for.builder
create mode 100644 vendor/rails-2.0.2/actionpack/test/fixtures/test/potential_conflicts.erb
create mode 100644 vendor/rails-2.0.2/actionpack/test/fixtures/test/render_file_with_ivar.erb
create mode 100644 vendor/rails-2.0.2/actionpack/test/fixtures/test/render_file_with_locals.erb
create mode 100644 vendor/rails-2.0.2/actionpack/test/fixtures/test/render_to_string_test.erb
create mode 100644 vendor/rails-2.0.2/actionpack/test/fixtures/test/update_element_with_capture.erb
create mode 100644 vendor/rails-2.0.2/actionpack/test/fixtures/test/using_layout_around_block.html.erb
create mode 100644 vendor/rails-2.0.2/actionpack/test/fixtures/topic.rb
create mode 100644 vendor/rails-2.0.2/actionpack/test/fixtures/topics.yml
create mode 100644 vendor/rails-2.0.2/actionpack/test/template/active_record_helper_test.rb
create mode 100644 vendor/rails-2.0.2/actionpack/test/template/asset_tag_helper_test.rb
create mode 100644 vendor/rails-2.0.2/actionpack/test/template/atom_feed_helper_test.rb
create mode 100644 vendor/rails-2.0.2/actionpack/test/template/benchmark_helper_test.rb
create mode 100644 vendor/rails-2.0.2/actionpack/test/template/compiled_templates_test.rb
create mode 100755 vendor/rails-2.0.2/actionpack/test/template/date_helper_test.rb
create mode 100644 vendor/rails-2.0.2/actionpack/test/template/erb_util_test.rb
create mode 100644 vendor/rails-2.0.2/actionpack/test/template/form_helper_test.rb
create mode 100644 vendor/rails-2.0.2/actionpack/test/template/form_options_helper_test.rb
create mode 100644 vendor/rails-2.0.2/actionpack/test/template/form_tag_helper_test.rb
create mode 100644 vendor/rails-2.0.2/actionpack/test/template/javascript_helper_test.rb
create mode 100644 vendor/rails-2.0.2/actionpack/test/template/number_helper_test.rb
create mode 100644 vendor/rails-2.0.2/actionpack/test/template/prototype_helper_test.rb
create mode 100644 vendor/rails-2.0.2/actionpack/test/template/sanitize_helper_test.rb
create mode 100644 vendor/rails-2.0.2/actionpack/test/template/scriptaculous_helper_test.rb
create mode 100644 vendor/rails-2.0.2/actionpack/test/template/tag_helper_test.rb
create mode 100644 vendor/rails-2.0.2/actionpack/test/template/text_helper_test.rb
create mode 100644 vendor/rails-2.0.2/actionpack/test/template/url_helper_test.rb
create mode 100644 vendor/rails-2.0.2/actionpack/test/testing_sandbox.rb
(limited to 'vendor/rails-2.0.2/actionpack')
diff --git a/vendor/rails-2.0.2/actionpack/CHANGELOG b/vendor/rails-2.0.2/actionpack/CHANGELOG
new file mode 100644
index 000000000..d8a1cc752
--- /dev/null
+++ b/vendor/rails-2.0.2/actionpack/CHANGELOG
@@ -0,0 +1,4606 @@
+*2.0.2* (December 16th, 2007)
+
+* Added delete_via_redirect and put_via_redirect to integration testing #10497 [philodespotos]
+
+* Allow headers['Accept'] to be set by hand when calling xml_http_request #10461 [BMorearty]
+
+* Added OPTIONS to list of default accepted HTTP methods #10449 [holoway]
+
+* Added option to pass proc to ActionController::Base.asset_host for maximum configurability #10521 [chuyeow]. Example:
+
+ ActionController::Base.asset_host = Proc.new { |source|
+ if source.starts_with?('/images')
+ "http://images.example.com"
+ else
+ "http://assets.example.com"
+ end
+ }
+
+* Fixed that ActionView#file_exists? would be incorrect if @first_render is set #10569 [dbussink]
+
+* Added that Array#to_param calls to_param on all it's elements #10473 [brandon]
+
+* Ensure asset cache directories are automatically created. #10337 [Josh Peek, Cheah Chu Yeow]
+
+* render :xml and :json preserve custom content types. #10388 [jmettraux, Cheah Chu Yeow]
+
+* Refactor Action View template handlers. #10437, #10455 [Josh Peek]
+
+* Fix DoubleRenderError message and leave out mention of returning false from filters. Closes #10380 [Frederick Cheung]
+
+* Clean up some cruft around ActionController::Base#head. Closes #10417 [ssoroka]
+
+
+*2.0.1* (December 7th, 2007)
+
+* Fixed send_file/binary_content for testing #8044 [tolsen]
+
+* When a NonInferrableControllerError is raised, make the proposed fix clearer in the error message. Closes #10199 [danger]
+
+* Update Prototype to 1.6.0.1. [sam]
+
+* Update script.aculo.us to 1.8.0.1. [madrobby]
+
+* Add 'disabled' attribute to separators used in time zone and country selects. Closes #10354 [hasmanyjosh]
+
+* Added the same record identification guessing rules to fields_for as form_for has [DHH]
+
+* Fixed that verification violations with no specified action didn't halt the chain (now they do with a 400 Bad Request) [DHH]
+
+* Raise UnknownHttpMethod exception for unknown HTTP methods. Closes #10303 [Tarmo Tänav]
+
+* Update to Prototype -r8232. [sam]
+
+* Make sure the optimisation code for routes doesn't get used if :host, :anchor or :port are provided in the hash arguments. [pager, Koz] #10292
+
+* Added protection from trailing slashes on page caching #10229 [devrieda]
+
+* Asset timestamps are appended, not prepended. Closes #10276 [mnaberez]
+
+* Minor inconsistency in description of render example. Closes #10029 [ScottSchram]
+
+* Add #prepend_view_path and #append_view_path instance methods on ActionController::Base for consistency with the class methods. [rick]
+
+* Refactor sanitizer helpers into HTML classes and make it easy to swap them out with custom implementations. Closes #10129. [rick]
+
+* Add deprecation for old subtemplate syntax for ActionMailer templates, use render :partial [rick]
+
+* Fix TemplateError so it doesn't bomb on exceptions while running tests [rick]
+
+* Fixed that named routes living under resources shouldn't have double slashes #10198 [isaacfeliu]
+
+* Make sure that cookie sessions use a secret that is at least 30 chars in length. [Koz]
+
+* Fixed that partial rendering should look at the type of the first render to determine its own type if no other clues are available (like when using text.plain.erb as the extension in AM) #10130 [java]
+
+* Fixed that has_many :through associations should render as collections too #9051 [mathie/danger]
+
+* Added :mouseover short-cut to AssetTagHelper#image_tag for doing easy image swaps #6893 [joost]
+
+* Fixed handling of non-domain hosts #9479 [purp]
+
+* Fix syntax error in documentation example for cycle method. Closes #8735 [foca]
+
+* Document :with option for link_to_remote. Closes #8765 [ryanb]
+
+* Document :minute_step option for time_select. Closes #8814 [brupm]
+
+* Explain how to use the :href option for link_to_remote to degrade gracefully in the absence of JavaScript. Closes #8911 [vlad]
+
+* Disambiguate :size option for text area tag. Closes #8955 [redbeard]
+
+* Fix broken tag in assert_tag documentation. Closes #9037 [mfazekas]
+
+* Add documentation for route conditions. Closes #9041 [innu, manfred]
+
+* Fix typo left over from previous typo fix in url helper. Closes #9414 [Henrik N]
+
+* Fixed that ActionController::CgiRequest#host_with_port() should handle standard port #10082 [moro]
+
+* Update Prototype to 1.6.0 and script.aculo.us to 1.8.0. [sam, madrobby]
+
+* Expose the cookie jar as a helper method (before the view would just get the raw cookie hash) [DHH]
+
+* Integration tests: get_ and post_via_redirect take a headers hash. #9130 [simonjefford]
+
+* Simplfy #view_paths implementation. ActionView templates get the exact object, not a dup. [Rick]
+
+* Update tests for ActiveSupport's JSON escaping change. [rick]
+
+* FormHelper's auto_index should use #to_param instead of #id_before_type_cast. Closes #9994 [mattly]
+
+* Doc typo fixes for ActiveRecordHelper. Closes #9973 [mikong]
+
+* Make example parameters in restful routing docs idiomatic. Closes #9993 [danger]
+
+* Make documentation comment for mime responders match documentation example. Closes #9357 [yon]
+
+* Introduce a new test case class for functional tests. ActionController::TestCase. [Koz]
+
+* Fix incorrect path in helper rdoc. Closes #9926 [viktor tron]
+
+* Partials also set 'object' to the default partial variable. #8823 [Nick Retallack, Jeremy Kemper]
+
+* Request profiler. [Jeremy Kemper]
+ $ cat login_session.rb
+ get_with_redirect '/'
+ say "GET / => #{path}"
+ post_with_redirect '/sessions', :username => 'john', :password => 'doe'
+ say "POST /sessions => #{path}"
+ $ ./script/performance/request -n 10 login_session.rb
+
+* Disabled checkboxes don't submit a form value. #9301 [vladr, robinjfisher]
+
+* Added tests for options to ActiveRecordHelper#form. Closes #7213 [richcollins, mikong, mislav]
+
+* Changed before_filter halting to happen automatically on render or redirect but no longer on simply returning false [DHH]
+
+* Ensure that cookies handle array values correctly. Closes #9937 [queso]
+
+* Make sure resource routes don't clash with internal helpers like javascript_path, image_path etc. #9928 [gbuesing]
+
+* caches_page uses a single after_filter instead of one per action. #9891 [Pratik Naik]
+
+* Update Prototype to 1.6.0_rc1 and script.aculo.us to 1.8.0 preview 0. [sam, madrobby]
+
+* Dispatcher: fix that to_prepare should only run once in production. #9889 [Nathaniel Talbott]
+
+* Memcached sessions: add session data on initialization; don't silently discard exceptions; add unit tests. #9823 [kamk]
+
+* error_messages_for also takes :message and :header_message options which defaults to the old "There were problems with the following fields:" and " errors prohibited this from being saved". #8270 [rmm5t, zach-inglis-lt3]
+
+* Make sure that custom inflections are picked up by map.resources. #9815 [mislav]
+
+* Changed SanitizeHelper#sanitize to only allow the custom attributes and tags when specified in the call [DHH]
+
+* Extracted sanitization methods from TextHelper to SanitizeHelper [DHH]
+
+* rescue_from accepts :with => lambda { |exception| ... } or a normal block. #9827 [Pratik Naik]
+
+* Add :status to redirect_to allowing users to choose their own response code without manually setting headers. #8297 [codahale, chasgrundy]
+
+* Add link_to :back which uses your referrer with a fallback to a javascript link. #7366 [eventualbuddha, Tarmo Tänav]
+
+* error_messages_for and friends also work with local variables. #9699 [Frederick Cheung]
+
+* Fix url_for, redirect_to, etc. with :controller => :symbol instead of 'string'. #8562, #9525 [Justin Lynn, Tarmo Tänav, shoe]
+
+* Use #require_library_or_gem to load the memcache library for the MemCache session and fragment cache stores. Closes #8662. [Rick]
+
+* Move ActionController::Routing.optimise_named_routes to ActionController::Base.optimise_named_routes. Now you can set it in the config. [Rick]
+
+ config.action_controller.optimise_named_routes = false
+
+* ActionController::Routing::DynamicSegment#interpolation_chunk should call #to_s on all values before calling URI.escape. [Rick]
+
+* Only accept session ids from cookies, prevents session fixation attacks. [bradediger]
+
+
+*2.0.0 [Preview Release]* (September 29th, 2007) [Includes duplicates of changes from 1.12.2 - 1.13.3]
+
+* Fixed that render template did not honor exempt_from_layout #9698 [pezra]
+
+* Better error messages if you leave out the :secret option for request forgery protection. Closes #9670 [rick]
+
+* Allow ability to disable request forgery protection, disable it in test mode by default. Closes #9693 [Pratik Naik]
+
+* Avoid calling is_missing on LoadErrors. Closes #7460. [ntalbott]
+
+* Move Railties' Dispatcher to ActionController::Dispatcher, introduce before_ and after_dispatch callbacks, and warm up to non-CGI requests. [Jeremy Kemper]
+
+* The tag helper may bypass escaping. [Jeremy Kemper]
+
+* Cache asset ids. [Jeremy Kemper]
+
+* Optimized named routes respect AbstractRequest.relative_url_root. #9612 [danielmorrison, Jeremy Kemper]
+
+* Introduce ActionController::Base.rescue_from to declare exception-handling methods. Cleaner style than the case-heavy rescue_action_in_public. #9449 [Norbert Crombach]
+
+* Rename some RequestForgeryProtection methods. The class method is now #protect_from_forgery, and the default parameter is now 'authenticity_token'. [Rick]
+
+* Merge csrf_killer plugin into rails. Adds RequestForgeryProtection model that verifies session-specific _tokens for non-GET requests. [Rick]
+
+* Secure #sanitize, #strip_tags, and #strip_links helpers against xss attacks. Closes #8877. [Rick, Pratik Naik, Jacques Distler]
+
+ This merges and renames the popular white_list helper (along with some css sanitizing from Jacques Distler version of the same plugin).
+ Also applied updated versions of #strip_tags and #strip_links from #8877.
+
+* Remove use of & logic operator. Closes #8114. [watson]
+
+* Fixed JavaScriptHelper#escape_javascript to also escape closing tags #8023 [rubyruy]
+
+* Fixed TextHelper#word_wrap for multiline strings with extra carrier returns #8663 [seth]
+
+* Fixed that setting the :host option in url_for would automatically turn off :only_path (since :host would otherwise not be shown) #9586 [Bounga]
+
+* Added FormHelper#label. #8641, #9850 [jcoglan, jarkko]
+
+* Added AtomFeedHelper (slightly improved from the atom_feed_helper plugin) [DHH]
+
+* Prevent errors when generating routes for uncountable resources, (i.e. sheep where plural == singluar). map.resources :sheep now creates sheep_index_url for the collection and sheep_url for the specific item. [Koz]
+
+* Added support for HTTP Only cookies (works in IE6+ and FF 2.0.5+) as an improvement for XSS attacks #8895 [Pratik Naik, Spakman]
+
+* Don't warn when a path segment precedes a required segment. Closes #9615. [Nicholas Seckar]
+
+* Fixed CaptureHelper#content_for to work with the optional content parameter instead of just the block #9434 [sandofsky/wildchild].
+
+* Added Mime::Type.register_alias for dealing with different formats using the same mime type [DHH]. Example:
+
+ class PostsController < ApplicationController
+ before_filter :adjust_format_for_iphone
+
+ def index
+ @posts = Post.find(:all)
+
+ respond_to do |format|
+ format.html # => renders index.html.erb and uses "text/html" as the content type
+ format.iphone # => renders index.iphone.erb and uses "text/html" as the content type
+ end
+ end
+
+
+ private
+ def adjust_format_for_iphone
+ if request.env["HTTP_USER_AGENT"] && request.env["HTTP_USER_AGENT"][/iPhone/]
+ request.format = :iphone
+ end
+ end
+ end
+
+* Added that render :json will automatically call .to_json unless it's being passed a string [DHH].
+
+* Autolink behaves well with emails embedded in URLs. #7313 [Jeremy McAnally, Tarmo Tänav]
+
+* Fixed that default layouts did not take the format into account #9564 [Pratik Naik]
+
+* Fixed optimized route segment escaping. #9562 [wildchild, Jeremy Kemper]
+
+* Added block acceptance to JavaScriptHelper#javascript_tag. #7527 [Bob Silva, Tarmo Tänav, rmm5t]
+
+* root_path returns '/' not ''. #9563 [Pratik Naik]
+
+* Fixed that setting request.format should also affect respond_to blocks [DHH]
+
+* Add option to force binary mode on tempfile used for fixture_file_upload. #6380 [Jonathan Viney]
+
+* Fixed that resource namespaces wouldn't stick to all nested resources #9399 [pixeltrix]
+
+* Moved ActionController::Macros::AutoComplete into the auto_complete plugin on the official Rails svn. #9512 [Pratik Naik]
+
+* Moved ActionController::Macros::InPlaceEditing into the in_place_editor plugin on the official Rails svn. #9513 [Pratik Naik]
+
+* Removed deprecated form of calling xml_http_request/xhr without the first argument being the http verb [DHH]
+
+* Removed deprecated methods [DHH]:
+
+ - ActionController::Base#keep_flash (use flash.keep instead)
+ - ActionController::Base#expire_matched_fragments (just call expire_fragment with a regular expression)
+ - ActionController::Base.template_root/= methods (use ActionController#Base.view_paths/= instead)
+ - ActionController::Base.cookie (use ActionController#Base.cookies[]= instead)
+
+* Removed the deprecated behavior of appending ".png" to image_tag/image_path calls without an existing extension [DHH]
+
+* Removed ActionController::Base.scaffold -- it went through the whole idea of scaffolding (card board walls you remove and tweak one by one). Use the scaffold generator instead (it does resources too now!) [DHH]
+
+* Optimise named route generation when using positional arguments. [Koz]
+
+ This change delivers significant performance benefits for the most
+ common usage scenarios for modern rails applications by avoiding the
+ costly trip through url_for. Initial benchmarks indicate this is
+ between 6 and 20 times as fast.
+
+* Explicitly require active_record/query_cache before using it. [Jeremy Kemper]
+
+* Fix layout overriding response status. #9476 [lotswholetime]
+
+* Add field_set_tag for generating field_sets, closes #9477. [djanowski]
+
+* Allow additional parameters to be passed to named route helpers when using positional arguments. Closes #8930 [ian.w.white@gmail.com]
+
+* Make render :partial work with a :collection of Hashes, previously this wasn't possible due to backwards compatibility restrictions. [Pratik Naik]
+
+* request.host works with IPv6 addresses. #9458 [yuya]
+
+* Fix bug where action caching sets the content type to the ActionCachePath object. Closes #9282 [mindforge]
+
+* Find layouts even if they're not in the first view_paths directory. Closes #9258 [caio]
+
+* Major improvement to the documentation for the options / select form helpers. Closes #9038 [kampers, jardeon, wesg]
+
+* Fix number_to_human_size when using different precisions. Closes #7536. [RichardStrand, mpalmer]
+
+* Added partial layouts (see example in action_view/lib/partials.rb) [DHH]
+
+* Allow you to set custom :conditions on resource routes. [Rick]
+
+* Fixed that file.content_type for uploaded files would include a trailing \r #9053 [bgreenlee]
+
+* url_for now accepts a series of symbols representing the namespace of the record [Josh Knowles]
+
+* Make :trailing_slash work with query parameters for url_for. Closes #4004 [nov]
+
+* Make sure missing template exceptions actually say which template they were looking for. Closes #8683 [dasil003]
+
+* Fix errors with around_filters which do not yield, restore 1.1 behaviour with after filters. Closes #8891 [skaes]
+
+ After filters will *no longer* be run if an around_filter fails to yield, users relying on
+ this behaviour are advised to put the code in question after a yield statement in an around filter.
+
+
+* Allow you to delete cookies with options. Closes #3685 [Josh Peek, Chris Wanstrath]
+
+* Allow you to render views with periods in the name. Closes #8076 [Norbert Crombach]
+
+ render :partial => 'show.html.erb'
+
+* Improve capture helper documentation. #8796 [kampers]
+
+* Prefix nested resource named routes with their action name, e.g. new_group_user_path(@group) instead of group_new_user_path(@group). The old nested action named route is deprecated in Rails 1.2.4. #8558 [David Chelimsky]
+
+* Allow sweepers to be created solely for expiring after controller actions, not model changes [DHH]
+
+* Added assigns method to ActionController::Caching::Sweeper to easily access instance variables on the controller [DHH]
+
+* Give the legacy X-POST_DATA_FORMAT header greater precedence during params parsing for backward compatibility. [Jeremy Kemper]
+
+* Fixed that link_to with an href of # when using :method will not allow for click-through without JavaScript #7037 [Steven Bristol, Josh Peek]
+
+* Fixed that radio_button_tag should generate unique ids #3353 [Bob Silva, Rebecca, Josh Peek]
+
+* Fixed that HTTP authentication should work if the header is called REDIRECT_X_HTTP_AUTHORIZATION as well #6754 [mislaw]
+
+* Don't mistakenly interpret the request uri as the query string. #8731 [Pratik Naik, Jeremy Kemper]
+
+* Make ActionView#view_paths an attr_accessor for real this time. Also, don't perform an unnecessary #compact on the @view_paths array in #initialize. Closes #8582 [dasil003, julik, rick]
+
+* Tolerate missing content type on multipart file uploads. Fix for Safari 3. [Jeremy Kemper]
+
+* Deprecation: remove pagination. Install the classic_pagination plugin for forward compatibility, or move to the superior will_paginate plugin. #8157 [Josh Peek]
+
+* Action caching is limited to GET requests returning 200 OK status. #3335 [tom@craz8.com, halfbyte, Dan Kubb, Josh Peek]
+
+* Improve Text Helper test coverage. #7274 [Rob Sanheim, Josh Peek]
+
+* Improve helper test coverage. #7208, #7212, #7215, #7233, #7234, #7235, #7236, #7237, #7238, #7241, #7243, #7244 [Rich Collins, Josh Peek]
+
+* Improve UrlRewriter tests. #7207 [Rich Collins]
+
+* Resources: url_for([parent, child]) generates /parents/1/children/2 for the nested resource. Likewise with the other simply helpful methods like form_for and link_to. #6432 [mhw, Jonathan Vaught, lotswholetime]
+
+* Assume html format when rendering partials in RJS. #8076 [Rick]
+
+* Don't double-escape url_for in views. #8144 [Rich Collins, Josh Peek]
+
+* Allow JSON-style values for the :with option of observe_field. Closes #8557 [kommen]
+
+* Remove RAILS_ROOT from backtrace paths. #8540 [Tim Pope]
+
+* Routing: map.resource :logo routes to LogosController so the controller may be reused for multiple nestings or namespaces. [Jeremy Kemper]
+
+* render :partial recognizes Active Record associations as Arrays. #8538 [Kamal Fariz Mahyuddin]
+
+* Routing: drop semicolon and comma as route separators. [Jeremy Kemper]
+
+* request.remote_ip understands X-Forwarded-For addresses with nonstandard whitespace. #7386 [moses]
+
+* Don't prepare response when rendering a component. #8493 [jsierles]
+
+* Reduce file stat calls when checking for template changes. #7736 [alex]
+
+* Added custom path cache_page/expire_page parameters in addition to the options hashes [DHH]. Example:
+
+ def index
+ caches_page(response.body, "/index.html")
+ end
+
+* Action Caching speedup. #8231 [skaes]
+
+* Wordsmith resources documentation. #8484 [marclove]
+
+* Fix syntax error in code example for routing documentation. #8377. [Norbert Crombach]
+
+* Routing: respond with 405 Method Not Allowed status when the route path matches but the HTTP method does not. #6953 [Josh Peek, defeated, Dan Kubb, Coda Hale]
+
+* Add support for assert_select_rjs with :show and :hide. #7780 [dchelimsky]
+
+* Make assert_select's failure messages clearer about what failed. #7779 [dchelimsky]
+
+* Introduce a default respond_to block for custom types. #8174 [Josh Peek]
+
+* auto_complete_field takes a :method option so you can GET or POST. #8120 [zapnap]
+
+* Added option to suppress :size when using :maxlength for FormTagHelper#text_field #3112 [Tim Pope]
+
+* catch possible WSOD when trying to render a missing partial. Closes #8454 [Catfish]
+
+* Rewind request body after reading it, if possible. #8438 [s450r1]
+
+* Resource namespaces are inherited by their has_many subresources. #8280 [marclove, ggarside]
+
+* Fix filtered parameter logging with nil parameter values. #8422 [choonkeat]
+
+* Integration tests: alias xhr to xml_http_request and add a request_method argument instead of always using POST. #7124 [Nik Wakelin, Francois Beausoleil, Wizard]
+
+* Document caches_action. #5419 [Jarkko Laine]
+
+* Update to Prototype 1.5.1. [Sam Stephenson]
+
+* Allow routes to be decalred under namespaces [Tobias Luetke]:
+
+ map.namespace :admin do |admin|
+ admin.root :controller => "products"
+ admin.feed 'feed.xml', :controller => 'products', :action => 'feed', :format => 'xml'
+ end
+
+* Update to script.aculo.us 1.7.1_beta3. [Thomas Fuchs]
+
+* observe_form always sends the serialized form. #5271 [manfred, normelton@gmail.com]
+
+* Parse url-encoded and multipart requests ourselves instead of delegating to CGI. [Jeremy Kemper]
+
+* select :include_blank option can be set to a string instead of true, which just uses an empty string. #7664 [Wizard]
+
+* Added url_for usage on render :location, which allows for record identification [DHH]. Example:
+
+ render :xml => person, :status => :created, :location => person
+
+ ...expands the location to person_url(person).
+
+* Introduce the request.body stream. Lazy-read to parse parameters rather than always setting RAW_POST_DATA. Reduces the memory footprint of large binary PUT requests. [Jeremy Kemper]
+
+* Add some performance enhancements to ActionView.
+
+ * Cache base_paths in @@cached_base_paths
+ * Cache template extensions in @@cached_template_extension
+ * Remove unnecessary rescues
+
+* Assume that rendered partials go by the HTML format by default
+
+ def my_partial
+ render :update do |page|
+ # in this order
+ # _foo.html.erb
+ # _foo.erb
+ # _foo.rhtml
+ page.replace :foo, :partial => 'foo'
+ end
+ end
+
+* Added record identifications to FormHelper#form_for and PrototypeHelper#remote_form_for [DHH]. Examples:
+
+ <% form_for(@post) do |f| %>
+ ...
+ <% end %>
+
+ This will expand to be the same as:
+
+ <% form_for :post, @post, :url => post_path(@post), :html => { :method => :put, :class => "edit_post", :id => "edit_post_45" } do |f| %>
+ ...
+ <% end %>
+
+ And for new records:
+
+ <% form_for(Post.new) do |f| %>
+ ...
+ <% end %>
+
+ This will expand to be the same as:
+
+ <% form_for :post, @post, :url => posts_path, :html => { :class => "new_post", :id => "new_post" } do |f| %>
+ ...
+ <% end %>
+
+* Rationalize route path escaping according to RFC 2396 section 3.3. #7544, #8307. [Jeremy Kemper, chrisroos, begemot, jugend]
+
+* Added record identification with polymorphic routes for ActionController::Base#url_for and ActionView::Base#url_for [DHH]. Examples:
+
+ redirect_to(post) # => redirect_to(posts_url(post)) => Location: http://example.com/posts/1
+ link_to(post.title, post) # => link_to(post.title, posts_url(post)) => Hello world
+
+ Any method that calls url_for on its parameters will automatically benefit from this.
+
+* Removed deprecated parameters_for_method_reference concept (legacy from before named routes) [DHH]
+
+* Add ActionController::Routing::Helpers, a module to contain common URL helpers such as polymorphic_url. [Nicholas Seckar]
+
+* Included the HttpAuthentication plugin as part of core (ActionController::HttpAuthentication::Basic) [DHH]
+
+* Modernize documentation for form helpers. [jeremymcanally]
+
+* Add brief introduction to REST to the resources documentation. [fearoffish]
+
+* Fix various documentation typos throughout ActionPack. [Henrik N]
+
+* Enhance documentation and add examples for url_for. [jeremymcanally]
+
+* Fix documentation typo in routes. [Norbert Crombach, pam]
+
+* Sweep flash when filter chain is halted. [Caio Chassot ]
+
+* Fixed that content_tag with a block will just return the result instead of concate it if not used in a ERb view #7857, #7432 [michael.niessner]
+
+* Replace the current block/continuation filter chain handling by an implementation based on a simple loop. #8226 [Stefan Kaes]
+
+* Update UrlWriter to accept :anchor parameter. Closes #6771. [octopod]
+
+* Added RecordTagHelper for using RecordIdentifier conventions on divs and other container elements [DHH]. Example:
+
+ <% div_for(post) do %>
+ <%= post.body %> What a wonderful world!
+ <% end %>
+
+* Added page[record] accessor to JavaScriptGenerator that relies on RecordIdentifier to find the right dom id [DHH]. Example:
+
+ format.js do
+ # Calls: new Effect.fade('post_45');
+ render(:update) { |page| page[post].visual_effect(:fade) }
+ end
+
+* Added RecordIdentifier to enforce view conventions on records for dom ids, classes, and partial paths [DHH]
+
+* Added map.namespace to deal with the common situation of admin sections and the like [DHH]
+
+ Before:
+
+ map.resources :products, :path_prefix => "admin", :controller => "admin/products", :collection => { :inventory => :get }, :member => { :duplicate => :post }
+ map.resources :tags, :name_prefix => 'admin_product_', :path_prefix => "admin/products/:product_id", :controller => "admin/product_tags"
+ map.resources :images, :name_prefix => 'admin_product_', :path_prefix => "admin/products/:product_id", :controller => "admin/product_images"
+ map.resources :variants, :name_prefix => 'admin_product_', :path_prefix => "admin/products/:product_id", :controller => "admin/product_variants"
+
+ After:
+
+ map.namespace(:admin) do |admin|
+ admin.resources :products,
+ :collection => { :inventory => :get },
+ :member => { :duplicate => :post },
+ :has_many => [ :tags, :images, :variants ]
+ end
+
+* Added :name_prefix as standard for nested resources [DHH]. WARNING: May be backwards incompatible with your app
+
+ Before:
+
+ map.resources :emails do |emails|
+ emails.resources :comments, :name_prefix => "email_"
+ emails.resources :attachments, :name_prefix => "email_"
+ end
+
+ After:
+
+ map.resources :emails do |emails|
+ emails.resources :comments
+ emails.resources :attachments
+ end
+
+ This does mean that if you intended to have comments_url go to /emails/5/comments, then you'll have to set :name_prefix to nil explicitly.
+
+* Added :has_many and :has_one for declaring plural and singular resources beneath the current [DHH]
+
+ Before:
+
+ map.resources :notes do |notes|
+ notes.resources :comments
+ notes.resources :attachments
+ notes.resource :author
+ end
+
+ After:
+
+ map.resources :notes, :has_many => [ :comments, :attachments ], :has_one => :author
+
+* Added that render :xml will try to call to_xml if it can [DHH]. Makes these work:
+
+ render :xml => post
+ render :xml => comments
+
+* Added :location option to render so that the common pattern of rendering a response after creating a new resource is now a 1-liner [DHH]
+
+ render :xml => post.to_xml, :status => :created, :location => post_url(post)
+
+* Ensure that render_text only adds string content to the body of the response [DHH]
+
+* Return the string representation from an Xml Builder when rendering a partial. Closes #5044 [Tim Pope]
+
+* Fixed that parameters from XML should also be presented in a hash with indifferent access [DHH]
+
+* Tweak template format rules so that the ACCEPT header is only used if it's text/javascript. This is so ajax actions without a :format param get recognized as Mime::JS. [Rick]
+
+* The default respond_to blocks don't set a specific extension anymore, so that both 'show.rjs' and 'show.js.rjs' will work. [Rick]
+
+* Allow layouts with extension of .html.erb. Closes #8032 [Josh Knowles]
+
+* Change default respond_to templates for xml and rjs formats. [Rick]
+
+ * Default xml template goes from #{action_name}.rxml => #{action_name}.xml.builder.
+ * Default rjs template goes from #{action_name}.rjs => #{action_name}.js.rjs.
+
+ You can still specify your old templates:
+
+ respond_to do |format|
+ format.xml do
+ render :action => "#{action_name}.rxml"
+ end
+ end
+
+* Fix WSOD due to modification of a formatted template extension so that requests to templates like 'foo.html.erb' fail on the second hit. [Rick]
+
+* Fix WSOD when template compilation fails [Rick]
+
+* Change ActionView template defaults. Look for templates using the request format first, such as "show.html.erb" or "show.xml.builder", before looking for the old defaults like "show.erb" or "show.builder" [Rick]
+
+* Highlight helper highlights one or many terms in a single pass. [Jeremy Kemper]
+
+* Dropped the use of ; as a separator of non-crud actions on resources and went back to the vanilla slash. It was a neat idea, but lots of the non-crud actions turned out not to be RPC (as the ; was primarily intended to discourage), but legitimate sub-resources, like /parties/recent, which didn't deserve the uglification of /parties;recent. Further more, the semicolon caused issues with caching and HTTP authentication in Safari. Just Not Worth It [DHH]
+
+* Added that FormTagHelper#submit_tag will return to its original state if the submit fails and you're using :disable_with [DHH]
+
+* Cleaned up, corrected, and mildly expanded ActionPack documentation. Closes #7190 [jeremymcanally]
+
+* Small collection of ActionController documentation cleanups. Closes #7319 [jeremymcanally]
+
+* Make sure the route expiry hash is constructed by comparing the to_param-ized values of each hash. [Jamis Buck]
+
+* Allow configuration of the default action cache path for #caches_action calls. [Rick Olson]
+
+ class ListsController < ApplicationController
+ caches_action :index, :cache_path => Proc.new { |controller|
+ controller.params[:user_id] ?
+ controller.send(:user_lists_url, c.params[:user_id]) :
+ controller.send(:lists_url) }
+ end
+
+* Performance: patch cgi/session/pstore to require digest/md5 once rather than per #initialize. #7583 [Stefan Kaes]
+
+* Cookie session store: ensure that new sessions doesn't reuse data from a deleted session in the same request. [Jeremy Kemper]
+
+* Deprecation: verification with :redirect_to => :named_route shouldn't be deprecated. #7525 [Justin French]
+
+* Cookie session store: raise ArgumentError when :session_key is blank. [Jeremy Kemper]
+
+* Deprecation: remove deprecated request, redirect, and dependency methods. Remove deprecated instance variables. Remove deprecated url_for(:symbol, *args) and redirect_to(:symbol, *args) in favor of named routes. Remove uses_component_template_root for toplevel components directory. Privatize deprecated render_partial and render_partial_collection view methods. Remove deprecated link_to_image, link_image_to, update_element_function, start_form_tag, and end_form_tag helper methods. Remove deprecated human_size helper alias. [Jeremy Kemper]
+
+* Consistent public/protected/private visibility for chained methods. #7813 [Dan Manges]
+
+* Prefer MIME constants to strings. #7707 [Dan Kubb]
+
+* Allow array and hash query parameters. Array route parameters are converted/to/a/path as before. #6765, #7047, #7462 [bgipsy, Jeremy McAnally, Dan Kubb, brendan]
+
+# Add a #dbman attr_reader for CGI::Session and make CGI::Session::CookieStore#generate_digest public so it's easy to generate digests
+using the cookie store's secret. [Rick]
+
+* Added Request#url that returns the complete URL used for the request [DHH]
+
+* Extract dynamic scaffolding into a plugin. #7700 [Josh Peek]
+
+* Added user/password options for url_for to add http authentication in a URL [DHH]
+
+* Fixed that FormTagHelper#text_area_tag should disregard :size option if it's not a string [Brendon Davidson]
+
+* Set the original button value in an attribute of the button when using the :disable_with key with submit_tag, so that the original can be restored later. [Jamis Buck]
+
+* session_enabled? works with session :off. #6680 [Catfish]
+
+* Added :port and :host handling to UrlRewriter (which unified url_for usage, regardless of whether it's called in view or controller) #7616 [alancfrancis]
+
+* Allow send_file/send_data to use a registered mime type as the :type parameter #7620 [jonathan]
+
+* Allow routing requirements on map.resource(s) #7633 [quixoten]. Example:
+
+ map.resources :network_interfaces, :requirements => { :id => /^\d+\.\d+\.\d+\.\d+$/ }
+
+* Cookie session store: empty and unchanged sessions don't write a cookie. [Jeremy Kemper]
+
+* Added helper(:all) as a way to include all helpers from app/helpers/**/*.rb in ApplicationController [DHH]
+
+* Integration tests: introduce methods for other HTTP methods. #6353 [caboose]
+
+* Routing: better support for escaped values in route segments. #7544 [Chris
+Roos]
+
+* Introduce a cookie-based session store as the Rails default. Sessions typically contain at most a user_id and flash message; both fit within the 4K cookie size limit. A secure message digest is included with the cookie to ensure data integrity (a user cannot alter his user_id without knowing the secret key included in the digest). If you have more than 4K of session data or don't want your data to be visible to the user, pick another session store. Cookie-based sessions are dramatically faster than the alternatives. [Jeremy Kemper]
+
+ Example config/environment.rb:
+ # Use an application-wide secret key and the default SHA1 message digest.
+ config.action_controller.session = { :secret => "can't touch this" }
+
+ # Store a secret key per user and employ a stronger message digest.
+ config.action_controller.session = {
+ :digest => 'SHA512',
+ :secret => Proc.new { User.current.secret_key }
+ }
+
+* Added .erb and .builder as preferred aliases to the now deprecated .rhtml and .rxml extensions [Chad Fowler]. This is done to separate the renderer from the mime type. .erb templates are often used to render emails, atom, csv, whatever. So labeling them .rhtml doesn't make too much sense. The same goes for .rxml, which can be used to build everything from HTML to Atom to whatever. .rhtml and .rxml will continue to work until Rails 3.0, though. So this is a slow phasing out. All generators and examples will start using the new aliases, though.
+
+* Added caching option to AssetTagHelper#stylesheet_link_tag and AssetTagHelper#javascript_include_tag [DHH]. Examples:
+
+ stylesheet_link_tag :all, :cache => true # when ActionController::Base.perform_caching is false =>
+
+
+
+
+ stylesheet_link_tag :all, :cache => true # when ActionController::Base.perform_caching is true =>
+
+
+ ...when caching is on, all.css is the concatenation of style1.css, styleB.css, and styleX2.css.
+ Same deal for JavaScripts.
+
+* Work around the two connection per host browser limit: use asset%d.myapp.com to distribute asset requests among asset[0123].myapp.com. Use a DNS wildcard or CNAMEs to map these hosts to your asset server. See http://www.die.net/musings/page_load_time/ for background. [Jeremy Kemper]
+
+* Added default mime type for CSS (Mime::CSS) [DHH]
+
+* Added that rendering will automatically insert the etag header on 200 OK responses. The etag is calculated using MD5 of the response body. If a request comes in that has a matching etag, the response will be changed to a 304 Not Modified and the response body will be set to an empty string. [DHH]
+
+* Added X-Runtime to all responses with the request run time [DHH]
+
+* Add Mime::Type convenience methods to check the current mime type. [Rick]
+
+ request.format.html? # => true if Mime::HTML
+ request.format.jpg? # => true if Mime::JPG
+
+ # ActionController sample usage:
+ # the session will be disabled for non html/ajax requests
+ session :off, :if => Proc.new { |req| !(req.format.html? || req.format.js?) }
+
+* Performance: patch cgi/session to require digest/md5 once rather than per #create_new_id. [Stefan Kaes]
+
+* Add a :url_based_filename => true option to ActionController::Streaming::send_file, which allows URL-based filenames. [Thomas Fuchs]
+
+* Fix that FormTagHelper#submit_tag using :disable_with should trigger the onsubmit handler of its form if available [DHH]
+
+* Fix #render_file so that TemplateError is called with the correct params and you don't get the WSOD. [Rick]
+
+* Fix issue with deprecation messing up #template_root= usage. Add #prepend_view_path and #append_view_path to allow modification of a copy of the
+superclass' view_paths. [Rick]
+
+* Allow Controllers to have multiple view_paths instead of a single template_root. Closes #2754 [John Long]
+
+* Add much-needed html-scanner tests. Fixed CDATA parsing bug. [Rick]
+
+* improve error message for Routing for named routes. Closes #7346 [Rob Sanheim]
+
+* Added enhanced docs to routing assertions. Closes #7359 [Rob Sanheim]
+
+* fix form_for example in ActionController::Resources documentation. Closes #7362 [gnarg]
+
+* Make sure that the string returned by TextHelper#truncate is actually a string, not a char proxy -- that should only be used internally while working on a multibyte-safe way of truncating [DHH]
+
+* Added FormBuilder#submit as a delegate for FormTagHelper#submit_tag [DHH]
+
+* Allow Routes to generate all urls for a set of options by specifying :generate_all => true. Allows caching to properly set or expire all paths for a resource. References #1739. [Nicholas Seckar]
+
+* Change the query parser to map empty GET params to "" rather than nil. Closes #5694. [Nicholas Seckar]
+
+* date_select and datetime_select take a :default option. #7052 [nik.wakelin]
+ date_select "post", "written_on", :default => 3.days.from_now
+ date_select "credit_card", "bill_due", :default => { :day => 20 }
+
+* select :multiple => true suffixes the attribute name with [] unless already suffixed. #6977 [nik.kakelin, ben, julik]
+
+* Improve routes documentation. #7095 [zackchandler]
+
+* mail_to :encode => 'hex' also encodes the mailto: part of the href attribute as well as the linked email when no name is given. #2061 [Jarkko Laine, pfc.pille@gmx.net]
+
+* Resource member routes require :id, eliminating the ambiguous overlap with collection routes. #7229 [dkubb]
+
+* Remove deprecated assertions. [Jeremy Kemper]
+
+* Change session restoration to allow namespaced models to be autoloaded. Closes #6348. [Nicholas Seckar]
+
+* Fix doubly appearing parameters due to string and symbol mixups. Closes #2551. [aeden]
+
+* Fix overly greedy rescues when loading helpers. Fixes #6268. [Nicholas Seckar]
+
+* Fixed NumberHelper#number_with_delimiter to use "." always for splitting the original number, not the delimiter parameter #7389 [ceefour]
+
+* Autolinking recognizes trailing and embedded . , : ; #7354 [Jarkko Laine]
+
+* Make TextHelper::auto_link recognize URLs with colons in path correctly, fixes #7268. [imajes]
+
+* Update to script.aculo.us 1.7.0. [Thomas Fuchs]
+
+* Modernize cookie testing code, and increase coverage (Heckle++) #7101 [Kevin Clark]
+
+* Improve Test Coverage for ActionController::Routing::Route#matches_controller_and_action? (Heckle++) #7115 [Kevin Clark]
+
+* Heckling ActionController::Resources::Resource revealed that set_prefixes didn't break when :name_prefix was munged. #7081 [Kevin Clark]
+
+* Fix #distance_of_time_in_words to report accurately against the Duration class. #7114 [eventualbuddha]
+
+* Refactor #form_tag to allow easy extending. [Rick]
+
+* Update to Prototype 1.5.0. [Sam Stephenson]
+
+* RecordInvalid, RecordNotSaved => 422 Unprocessable Entity, StaleObjectError => 409 Conflict. #7097 [dkubb]
+
+* Allow fields_for to be nested inside form_for, so that the name and id get properly constructed [Jamis Buck]
+
+* Allow inGroupsOf and eachSlice to be called through rjs. #7046 [Cody Fauser]
+
+* Allow exempt_from_layout :rhtml. #6742, #7026 [Dan Manges, Squeegy]
+
+* Recognize the .txt extension as Mime::TEXT [Rick]
+
+* Fix parsing of array[] CGI parameters so extra empty values aren't included. #6252 [Nicholas Seckar, aiwilliams, brentrowland]
+
+* link_to_unless_current works with full URLs as well as paths. #6891 [Jarkko Laine, manfred, idrifter]
+
+* Lookup the mime type for #auto_discovery_link_tag in the Mime::Type class. Closes #6941 [Josh Peek]
+
+* Fix bug where nested resources ignore a parent singleton parent's path prefix. Closes #6940 [Dan Kubb]
+
+* Fix no method error with error_messages_on. Closes #6935 [nik.wakelin Koz]
+
+* Slight doc tweak to the ActionView::Helpers::PrototypeHelper#replace docs. Closes #6922 [Steven Bristol]
+
+* Slight doc tweak to #prepend_filter. Closes #6493 [Jeremy Voorhis]
+
+* Add more extensive documentation to the AssetTagHelper. Closes #6452 [Bob Silva]
+
+* Clean up multiple calls to #stringify_keys in TagHelper, add better documentation and testing for TagHelper. Closes #6394 [Bob Silva]
+
+* [DOCS] fix reference to ActionController::Macros::AutoComplete for #text_field_with_auto_complete. Closes #2578 [Jan Prill]
+
+* Make sure html_document is reset between integration test requests. [ctm]
+
+* Set session to an empty hash if :new_session => false and no session cookie or param is present. CGI::Session was raising an unrescued ArgumentError. [Josh Susser]
+
+* Routing uses URI escaping for path components and CGI escaping for query parameters. [darix, Jeremy Kemper]
+
+* Fix assert_redirected_to bug where redirecting from a nested to to a top-level controller incorrectly added the current controller's nesting. Closes #6128. [Rick Olson]
+
+* Singleton resources: POST /singleton => create, GET /singleton/new => new. [Jeremy Kemper]
+
+* Use 400 Bad Request status for unrescued ActiveRecord::RecordInvalid exceptions. [Jeremy Kemper]
+
+* Silence log_error deprecation warnings from inspecting deprecated instance variables. [Nate Wiger]
+
+* Only cache GET requests with a 200 OK response. #6514, #6743 [RSL, anamba]
+
+* Add a 'referer' attribute to TestRequest. [Jamis Buck]
+
+* Ensure render :json => ... skips the layout. Closes #6808 [Josh Peek]
+
+* Fix HTML::Node to output double quotes instead of single quotes. Closes #6845 [mitreandy]
+
+* Correctly report which filter halted the chain. #6699 [Martin Emde]
+
+* Fix a bug in Routing where a parameter taken from the path of the current request could not be used as a query parameter for the next. Closes #6752. [Nicholas Seckar]
+
+* Unrescued ActiveRecord::RecordNotFound responds with 404 instead of 500. [Jeremy Kemper]
+
+* Improved auto_link to match more valid urls correctly [Tobias Luetke]
+
+* Add singleton resources. [Rick Olson]
+
+ map.resource :account
+
+ GET /account
+ GET /account;edit
+ UPDATE /account
+ DELETE /account
+
+* respond_to recognizes JSON. render :json => @person.to_json automatically sets the content type and takes a :callback option to specify a client-side function to call using the rendered JSON as an argument. #4185 [Scott Raymond, eventualbuddha]
+ # application/json response with body 'Element.show({:name: "David"})'
+ respond_to do |format|
+ format.json { render :json => { :name => "David" }.to_json, :callback => 'Element.show' }
+ end
+
+* Makes :discard_year work without breaking multi-attribute parsing in AR. #1260, #3800 [sean@ardismg.com, jmartin@desertflood.com, stephen@touset.org, Bob Silva]
+
+* Adds html id attribute to date helper elements. #1050, #1382 [mortonda@dgrmm.net, David North, Bob Silva]
+
+* Add :index and @auto_index capability to model driven date/time selects. #847, #2655 [moriq, Doug Fales, Bob Silva]
+
+* Add :order to datetime_select, select_datetime, and select_date. #1427 [Timothee Peignier, patrick@lenz.sh, Bob Silva]
+
+* Added time_select to work with time values in models. Update scaffolding. #2489, #2833 [Justin Palmer, Andre Caum, Bob Silva]
+
+* Added :include_seconds to select_datetime, datetime_select and time_select. #2998 [csn, Bob Silva]
+
+* All date/datetime selects can now accept an array of month names with :use_month_names. Allows for localization. #363 [tomasj, Bob Silva]
+
+* Adds :time_separator to select_time and :date_separator to select_datetime. Preserves BC. #3811 [Bob Silva]
+
+* Added map.root as an alias for map.connect '' [DHH]
+
+* Added Request#format to return the format used for the request as a mime type. If no format is specified, the first Request#accepts type is used. This means you can stop using respond_to for anything else than responses [DHH]. Examples:
+
+ GET /posts/5.xml | request.format => Mime::XML
+ GET /posts/5.xhtml | request.format => Mime::HTML
+ GET /posts/5 | request.format => request.accepts.first (usually Mime::HTML for browsers)
+
+* Added the option for extension aliases to mime type registration [DHH]. Example (already in the default routes):
+
+ Mime::Type.register "text/html", :html, %w( application/xhtml+xml ), %w( xhtml )
+
+ ...will respond on both .html and .xhtml.
+
+* @response.redirect_url works with 201 Created responses: just return headers['Location'] rather than checking the response status. [Jeremy Kemper]
+
+* Added CSV to Mime::SET so that respond_to csv will work [Cody Fauser]
+
+* Fixed that HEAD should return the proper Content-Length header (that is, actually use @body.size, not just 0) [DHH]
+
+* Added GET-masquarading for HEAD, so request.method will return :get even for HEADs. This will help anyone relying on case request.method to automatically work with HEAD and map.resources will also allow HEADs to all GET actions. Rails automatically throws away the response content in a reply to HEAD, so you don't even need to worry about that. If you, for whatever reason, still need to distinguish between GET and HEAD in some edge case, you can use Request#head? and even Request.headers["REQUEST_METHOD"] for get the "real" answer. Closes #6694 [DHH]
+
+* Update Routing to complain when :controller is not specified by a route. Closes #6669. [Nicholas Seckar]
+
+* Ensure render_to_string cleans up after itself when an exception is raised. #6658 [Rob Sanheim]
+
+* Extract template_changed_since? from compile_template? so plugins may override its behavior for non-file-based templates. #6651 [Jeff Barczewski]
+
+* Update to Prototype and script.aculo.us [5579]. [Thomas Fuchs]
+
+* simple_format helper doesn't choke on nil. #6644 [jerry426]
+
+* Update to Prototype 1.5.0_rc2 [5550] which makes it work in Opera again [Thomas Fuchs]
+
+* Reuse named route helper module between Routing reloads. Use remove_method to delete named route methods after each load. Since the module is never collected, this fixes a significant memory leak. [Nicholas Seckar]
+
+* ActionView::Base.erb_variable accessor names the buffer variable used to render templates. Defaults to _erbout; use _buf for erubis. [Rick Olson]
+
+* assert_select_rjs :remove. [Dylan Egan]
+
+* Always clear model associations from session. #4795 [sd@notso.net, andylien@gmail.com]
+
+* Update to Prototype 1.5.0_rc2. [Sam Stephenson]
+
+* Remove JavaScriptLiteral in favor of ActiveSupport::JSON::Variable. [Sam Stephenson]
+
+* Sync ActionController::StatusCodes::STATUS_CODES with http://www.iana.org/assignments/http-status-codes. #6586 [dkubb]
+
+* Multipart form values may have a content type without being treated as uploaded files if they do not provide a filename. #6401 [Andreas Schwarz, Jeremy Kemper]
+
+* assert_response supports symbolic status codes. #6569 [Kevin Clark]
+ assert_response :ok
+ assert_response :not_found
+ assert_response :forbidden
+
+* Cache parsed query parameters. #6559 [Stefan Kaes]
+
+* Deprecate JavaScriptHelper#update_element_function, which is superseeded by RJS [Thomas Fuchs]
+
+* pluralize helper interprets nil as zero. #6474 [Tim Pope]
+
+* Fix invalid test fixture exposed by stricter Ruby 1.8.5 multipart parsing. #6524 [Bob Silva]
+
+* Set ActionView::Base.default_form_builder once rather than passing the :builder option to every form or overriding the form helper methods. [Jeremy Kemper]
+
+* Deprecate expire_matched_fragments. Use expire_fragment instead. #6535 [Bob Silva]
+
+* Update to latest Prototype, which doesn't serialize disabled form elements, adds clone() to arrays, empty/non-string Element.update() and adds a fixes excessive error reporting in WebKit beta versions [Thomas Fuchs]
+
+* Deprecate start_form_tag and end_form_tag. Use form_tag / '' from now on. [Rick]
+
+* Added block-usage to PrototypeHelper#form_remote_tag, document block-usage of FormTagHelper#form_tag [Rick]
+
+* Add a 0 margin/padding div around the hidden _method input tag that form_tag outputs. [Rick]
+
+* Added block-usage to TagHelper#content_tag [DHH]. Example:
+
+ <% content_tag :div, :class => "strong" %>
+ Hello world!
+ <% end %>
+
+ Will output:
+ Hello world!
+
+* Deprecated UrlHelper#link_to_image and UrlHelper#link_to :post => true #6409 [BobSilva]
+
+* Upgraded NumberHelper with number_to_phone support international formats to comply with ITU E.123 by supporting area codes with less than 3 digits, added precision argument to number_to_human_size (defaults to 1) #6421 [BobSilva]
+
+* Fixed that setting RAILS_ASSET_ID to "" should not add a trailing slash after assets #6454 [BobSilva/chrismear]
+
+* Force *_url named routes to show the host in ActionView [Rick]
+
+ <%= url_for ... %> # no host
+ <%= foo_path %> # no host
+ <%= foo_url %> # host!
+
+* Add support for converting blocks into function arguments to JavaScriptGenerator#call and JavaScriptProxy#call. [Sam Stephenson]
+
+* Add JavaScriptGenerator#literal for wrapping a string in an object whose #to_json is the string itself. [Sam Stephenson]
+
+* Add <%= escape_once html %> to escape html while leaving any currently escaped entities alone. Fix button_to double-escaping issue. [Rick]
+
+* Fix double-escaped entities, such as &, {, etc. [Rick]
+
+* Fix deprecation warnings when rendering the template error template. [Nicholas Seckar]
+
+* Fix routing to correctly determine when generation fails. Closes #6300. [psross].
+
+* Fix broken assert_generates when extra keys are being checked. [Jamis Buck]
+
+* Replace KCODE checks with String#chars for truncate. Closes #6385 [Manfred Stienstra]
+
+* Make page caching respect the format of the resource that is being requested even if the current route is the default route so that, e.g. posts.rss is not transformed by url_for to '/' and subsequently cached as '/index.html' when it should be cached as '/posts.rss'. [Marcel Molina Jr.]
+
+* Use String#chars in TextHelper::excerpt. Closes #6386 [Manfred Stienstra]
+
+* Install named routes into ActionView::Base instead of proxying them to the view via helper_method. Closes #5932. [Nicholas Seckar]
+
+* Update to latest Prototype and script.aculo.us trunk versions [Thomas Fuchs]
+
+* Fix relative URL root matching problems. [Mark Imbriaco]
+
+* Fix filter skipping in controller subclasses. #5949, #6297, #6299 [Martin Emde]
+
+* render_text may optionally append to the response body. render_javascript appends by default. This allows you to chain multiple render :update calls by setting @performed_render = false between them (awaiting a better public API). [Jeremy Kemper]
+
+* Rename test assertion to prevent shadowing. Closes #6306. [psross]
+
+* Fixed that NumberHelper#number_to_delimiter should respect precision of higher than two digits #6231 [phallstrom]
+
+* Fixed that FormHelper#radio_button didn't respect an :id being passed in #6266 [evansj]
+
+* Added an html_options hash parameter to javascript_tag() and update_page_tag() helpers #6311 [tzaharia]. Example:
+
+ update_page_tag :defer => 'true' { |page| ... }
+
+ Gives:
+
+
+
+ Which is needed for dealing with the IE6 DOM when it's not yet fully loaded.
+
+* Fixed that rescue template path shouldn't be hardcoded, then it's easier to hook in your own #6295 [mnaberez]
+
+* Fixed escaping of backslashes in JavaScriptHelper#escape_javascript #6302 [sven@c3d2.de]
+
+* Fixed that some 500 rescues would cause 500's themselves because the response had not yet been generated #6329 [cmselmer]
+
+* respond_to :html doesn't assume .rhtml. #6281 [Hampton Catlin]
+
+* Fixed some deprecation warnings in ActionPack [Rick Olson]
+
+* assert_select_rjs decodes escaped unicode chars since the Javascript generators encode them. #6240 [japgolly]
+
+* Deprecation: @cookies, @headers, @request, @response will be removed after 1.2. Use the corresponding method instead. [Jeremy Kemper]
+
+* Make the :status parameter expand to the default message for that status code if it is an integer. Also support symbol statuses. [Jamis Buck]. Examples:
+
+ head :status => 404 # expands to "404 Not Found"
+ head :status => :not_found # expands to "404 Not Found"
+ head :status => :created # expands to "201 Created"
+
+* Add head(options = {}) for responses that have no body. [Jamis Buck]. Examples:
+
+ head :status => 404 # return an empty response with a 404 status
+ head :location => person_path(@person), :status => 201
+
+* Fix bug that kept any before_filter except the first one from being able to halt the before_filter chain. [Rick Olson]
+
+* strip_links is case-insensitive. #6285 [tagoh, Bob Silva]
+
+* Clear the cache of possible controllers whenever Routes are reloaded. [Nicholas Seckar]
+
+* Filters overhaul including meantime filter support using around filters + blocks. #5949 [Martin Emde, Roman Le Negrate, Stefan Kaes, Jeremy Kemper]
+
+* Update RJS render tests. [sam]
+
+* Update CGI process to allow sessions to contain namespaced models. Closes #4638. [dfelstead@site5.com]
+
+* Fix routing to respect user provided requirements and defaults when assigning default routing options (such as :action => 'index'). Closes #5950. [Nicholas Seckar]
+
+* Rescue Errno::ECONNRESET to handle an unexpectedly closed socket connection. Improves SCGI reliability. #3368, #6226 [sdsykes, fhanshaw@vesaria.com]
+
+* Added that respond_to blocks will automatically set the content type to be the same as is requested [DHH]. Examples:
+
+ respond_to do |format|
+ format.html { render :text => "I'm being sent as text/html" }
+ format.rss { render :text => "I'm being sent as application/rss+xml" }
+ format.atom { render :text => "I'm being sent as application/xml", :content_type => Mime::XML }
+ end
+
+* Added utf-8 as the default charset for all renders. You can change this default using ActionController::Base.default_charset=(encoding) [DHH]
+
+* Added proper getters and setters for content type and charset [DHH]. Example of what we used to do:
+
+ response.headers["Content-Type"] = "application/atom+xml; charset=utf-8"
+
+ ...now:
+
+ response.content_type = Mime::ATOM
+ response.charset = "utf-8"
+
+* Updated prototype.js to 1.5.0_rc1 with latest fixes. [Rick Olson]
+
+ - XPATH support
+ - Make Form.getElements() return elements in the correct order
+ - fix broken Form.serialize return
+
+* Declare file extensions exempt from layouts. #6219 [brandon]
+ Example: ActionController::Base.exempt_from_layout 'rpdf'
+
+* Add chained replace/update support for assert_select_rjs [Rick Olson]
+
+ Given RJS like...
+
+ page['test1'].replace "foo
"
+ page['test2'].replace_html "foo
"
+
+ Test it with...
+
+ assert_select_rjs :chained_replace
+ assert_select_rjs :chained_replace, "test1"
+
+ assert_select_rjs :chained_replace_html
+ assert_select_rjs :chained_replace_html, "test2"
+
+* Load helpers in alphabetical order for consistency. Resolve cyclic javascript_helper dependency. #6132, #6178 [choonkeat@gmail.com]
+
+* Skip params with empty names, such as the &=Save query string from . #2569 [manfred, raphinou@yahoo.com]
+
+* Fix assert_tag so that :content => "foo" does not match substrings, but only exact strings. Use :content => /foo/ to match substrings. #2799 [Eric Hodel]
+
+* Add descriptive messages to the exceptions thrown by cgi_methods. #6091, #6103 [Nicholas Seckar, Bob Silva]
+
+* Update JavaScriptGenerator#show/hide/toggle/remove to new Prototype syntax for multiple ids, #6068 [petermichaux@gmail.com]
+
+* Update UrlWriter to support :only_path. [Nicholas Seckar, Dave Thomas]
+
+* Fixed JavaScriptHelper#link_to_function and JavaScriptHelper#button_to_function to have the script argument be optional [DHH]. So what used to require a nil, like this:
+
+ link_to("Hider", nil, :class => "hider_link") { |p| p[:something].hide }
+
+ ...can be written like this:
+
+ link_to("Hider", :class => "hider_link") { |p| p[:something].hide }
+
+* Update to script.aculo.us 1.6.3 [Thomas Fuchs]
+
+* Update to Prototype 1.5.0_rc1 [sam]
+
+* Added access to nested attributes in RJS #4548 [richcollins@gmail.com]. Examples:
+
+ page['foo']['style'] # => $('foo').style;
+ page['foo']['style']['color'] # => $('blank_slate').style.color;
+ page['foo']['style']['color'] = 'red' # => $('blank_slate').style.color = 'red';
+ page['foo']['style'].color = 'red' # => $('blank_slate').style.color = 'red';
+
+* Fixed that AssetTagHelper#image_tag and others using compute_public_path should not modify the incoming source argument (closes #5102) [eule@space.ch]
+
+* Deprecated the auto-appending of .png to AssetTagHelper#image_tag calls that doesn't have an extension [DHH]
+
+* Fixed FormOptionsHelper#select to respect :selected value #5813
+
+* Fixed TextHelper#simple_format to deal with multiple single returns within a single paragraph #5835 [moriq@moriq.com]
+
+* Fixed TextHelper#pluralize to handle 1 as a string #5909 [rails@bencurtis.com]
+
+* Improved resolution of DateHelper#distance_of_time_in_words for better precision #5994 [Bob Silva]
+
+* Changed that uncaught exceptions raised any where in the application will cause RAILS_ROOT/public/500.html to be read and shown instead of just the static "Application error (Rails)" [DHH]
+
+* Integration tests: thoroughly test ActionController::Integration::Session. #6022 [Kevin Clark]
+ (tests skipped unless you `gem install mocha`)
+
+* Added deprecation language for pagination which will become a plugin by Rails 2.0 [DHH]
+
+* Added deprecation language for in_place_editor and auto_complete_field that both pieces will become plugins by Rails 2.0 [DHH]
+
+* Deprecated all of ActionController::Dependencies. All dependency loading is now handled from Active Support [DHH]
+
+* Added assert_select* for CSS selector-based testing (deprecates assert_tag) #5936 [assaf.arkin@gmail.com]
+
+* radio_button_tag generates unique id attributes. #3353 [Bob Silva, somekool@gmail.com]
+
+* strip_tags passes through blank args such as nil or "". #2229, #6702 [duncan@whomwah.com, dharana]
+
+* Cleanup assert_tag :children counting. #2181 [jamie@bravenet.com]
+
+* button_to accepts :method so you can PUT and DELETE with it. #6005 [Dan Webb]
+
+* Update sanitize text helper to strip plaintext tags, and . [Rick Olson]
+
+* Update routing documentation. Closes #6017 [Nathan Witmer]
+
+* Add routing tests to assert that RoutingError is raised when conditions aren't met. Closes #6016 [Nathan Witmer]
+
+* Deprecation: update docs. #5998 [jakob@mentalized.net, Kevin Clark]
+
+* Make auto_link parse a greater subset of valid url formats. [Jamis Buck]
+
+* Integration tests: headers beginning with X aren't excluded from the HTTP_ prefix, so X-Requested-With becomes HTTP_X_REQUESTED_WITH as expected. [Mike Clark]
+
+* Tighten rescue clauses. #5985 [james@grayproductions.net]
+
+* Fix send_data documentation typo. #5982 [brad@madriska.com]
+
+* Switch to using FormEncodedPairParser for parsing request parameters. [Nicholas Seckar, DHH]
+
+* respond_to .html now always renders #{action_name}.rhtml so that registered custom template handlers do not override it in priority. Custom mime types require a block and throw proper error now. [Tobias Luetke]
+
+* Deprecation: test deprecated instance vars in partials. [Jeremy Kemper]
+
+* Add UrlWriter to allow writing urls from Mailers and scripts. [Nicholas Seckar]
+
+* Clean up and run the Active Record integration tests by default. #5854 [kevin.clark@gmail.com, Jeremy Kemper]
+
+* Correct example in cookies docs. #5832 [jessemerriman@warpmail.net]
+
+* Updated to script.aculo.us 1.6.2 [Thomas Fuchs]
+
+* Relax Routing's anchor pattern warning; it was preventing use of [^/] inside restrictions. [Nicholas Seckar]
+
+* Add controller_paths variable to Routing. [Nicholas Seckar]
+
+* Fix assert_redirected_to issue with named routes for module controllers. [Rick Olson]
+
+* Tweak RoutingError message to show option diffs, not just missing named route significant keys. [Rick Olson]
+
+* Invoke method_missing directly on hidden actions. Closes #3030. [Nicholas Seckar]
+
+* Require Tempfile explicitly for TestUploadedFile due to changes in class auto loading. [Rick Olson]
+
+* Add RoutingError exception when RouteSet fails to generate a path from a Named Route. [Rick Olson]
+
+* Replace Reloadable with Reloadable::Deprecated. [Nicholas Seckar]
+
+* Deprecation: check whether instance variables have been monkeyed with before assigning them to deprecation proxies. Raises a RuntimeError if so. [Jeremy Kemper]
+
+* Add support for the param_name parameter to the auto_complete_field helper. #5026 [david.a.williams@gmail.com]
+
+* Deprecation! @params, @session, @flash will be removed after 1.2. Use the corresponding instance methods instead. You'll get printed warnings during tests and logged warnings in dev mode when you access either instance variable directly. [Jeremy Kemper]
+
+* Make Routing noisy when an anchor regexp is assigned to a segment. #5674 [francois.beausoleil@gmail.com]
+
+* Added months and years to the resolution of DateHelper#distance_of_time_in_words, such that "60 days ago" becomes "2 months ago" #5611 [pjhyett@gmail.com]
+
+* Short documentation to mention use of Mime::Type.register. #5710 [choonkeat@gmail.com]
+
+* Make controller_path available as an instance method. #5724 [jmckible@gmail.com]
+
+* Update query parser to support adjacent hashes. [Nicholas Seckar]
+
+* Make action caching aware of different formats for the same action so that, e.g. foo.xml is cached separately from foo.html. Implicitly set content type when reading in cached content with mime revealing extensions so the entire onous isn't on the webserver. [Marcel Molina Jr.]
+
+* Restrict Request Method hacking with ?_method to POST requests. [Rick Olson]
+
+* Fix bug when passing multiple options to SimplyRestful, like :new => { :preview => :get, :draft => :get }. [Rick Olson, Josh Susser, Lars Pind]
+
+* Dup the options passed to map.resources so that multiple resources get the same options. [Rick Olson]
+
+* Fixed the new_#{resource}_url route and added named route tests for Simply Restful. [Rick Olson]
+
+* Added map.resources from the Simply Restful plugin [DHH]. Examples (the API has changed to use plurals!):
+
+ map.resources :messages
+ map.resources :messages, :comments
+ map.resources :messages, :new => { :preview => :post }
+
+* Fixed that integration simulation of XHRs should set Accept header as well [Edward Frederick]
+
+* TestRequest#reset_session should restore a TestSession, not a hash [Koz]
+
+* Don't search a load-path of '.' for controller files [Jamis Buck]
+
+* Update integration.rb to require test_process explicitly instead of via Dependencies. [Nicholas Seckar]
+
+* Fixed that you can still access the flash after the flash has been reset in reset_session. Closes #5584 [lmarlow@yahoo.com]
+
+* Allow form_for and fields_for to work with indexed form inputs. [Jeremy Kemper, Matt Lyon]
+
+ <% form_for 'post[]', @post do |f| -%>
+ <% end -%>
+
+* Remove leak in development mode by replacing define_method with module_eval. [Nicholas Seckar]
+
+* Provide support for decimal columns to form helpers. Closes #5672. [dave@pragprog.com]
+
+* Update documentation for erb trim syntax. #5651 [matt@mattmargolis.net]
+
+* Pass :id => nil or :class => nil to error_messages_for to supress that html attribute. #3586 [olivier_ansaldi@yahoo.com, sebastien@goetzilla.info]
+
+* Reset @html_document between requests so assert_tag works. #4810 [jarkko@jlaine.net, easleydp@gmail.com]
+
+* Update render :partial documentation. #5646 [matt@mattmargolis.net]
+
+* Integration tests behave well with render_component. #4632 [edward.frederick@revolution.com, dev.rubyonrails@maxdunn.com]
+
+* Added exception handling of missing layouts #5373 [chris@ozmm.org]
+
+* Fixed that real files and symlinks should be treated the same when compiling templates #5438 [zachary@panandscan.com]
+
+* Fixed that the flash should be reset when reset_session is called #5584 [shugo@ruby-lang.org]
+
+* Added special case for "1 Byte" in NumberHelper#number_to_human_size #5593 [murpyh@rubychan.de]
+
+* Fixed proper form-encoded parameter parsing for requests with "Content-Type: application/x-www-form-urlencoded; charset=utf-8" (note the presence of a charset directive) [DHH]
+
+* Add route_name_path method to generate only the path for a named routes. For example, map.person will add person_path. [Nicholas Seckar]
+
+* Avoid naming collision among compiled view methods. [Jeremy Kemper]
+
+* Fix CGI extensions when they expect string but get nil in Windows. Closes #5276 [mislav@nippur.irb.hr]
+
+* Determine the correct template_root for deeply nested components. #2841 [s.brink@web.de]
+
+* Fix that routes with *path segments in the recall can generate URLs. [Rick]
+
+* Fix strip_links so that it doesn't hang on multiline tags [Jamis Buck]
+
+* Remove problematic control chars in rescue template. #5316 [Stefan Kaes]
+
+* Make sure passed routing options are not mutated by routing code. #5314 [Blair Zajac]
+
+* Make sure changing the controller from foo/bar to bing/bang does not change relative to foo. [Jamis Buck]
+
+* Escape the path before routing recognition. #3671
+
+* Make sure :id and friends are unescaped properly. #5275 [me@julik.nl]
+
+* Fix documentation for with_routing to reflect new reality. #5281 [rramdas@gmail.com]
+
+* Rewind readable CGI params so others may reread them (such as CGI::Session when passing the session id in a multipart form). #210 [mklame@atxeu.com, matthew@walker.wattle.id.au]
+
+* Added Mime::TEXT (text/plain) and Mime::ICS (text/calendar) as new default types [DHH]
+
+* Added Mime::Type.register(string, symbol, synonyms = []) for adding new custom mime types [DHH]. Example: Mime::Type.register("image/gif", :gif)
+
+* Added support for Mime objects in render :content_type option [DHH]. Example: render :text => some_atom, :content_type => Mime::ATOM
+
+* Add :status option to send_data and send_file. Defaults to '200 OK'. #5243 [Manfred Stienstra ]
+
+* Routing rewrite. Simpler, faster, easier to understand. The published API for config/routes.rb is unchanged, but nearly everything else is different, so expect breakage in plugins and libs that try to fiddle with routes. [Nicholas Seckar, Jamis Buck]
+
+ map.connect '/foo/:id', :controller => '...', :action => '...'
+ map.connect '/foo/:id.:format', :controller => '...', :action => '...'
+ map.connect '/foo/:id', ..., :conditions => { :method => :get }
+
+* Cope with missing content type and length headers. Parse parameters from multipart and urlencoded request bodies only. [Jeremy Kemper]
+
+* Accept multipart PUT parameters. #5235 [guy.naor@famundo.com]
+
+* Added interrogation of params[:format] to determine Accept type. If :format is specified and matches a declared extension, like "rss" or "xml", that mime type will be put in front of the accept handler. This means you can link to the same action from different extensions and use that fact to determine output [DHH]. Example:
+
+ class WeblogController < ActionController::Base
+ def index
+ @posts = Post.find :all
+
+ respond_to do |format|
+ format.html
+ format.xml { render :xml => @posts.to_xml }
+ format.rss { render :action => "feed.rxml" }
+ end
+ end
+ end
+
+ # returns HTML when requested by a browser, since the browser
+ # has the HTML mimetype at the top of its priority list
+ Accept: text/html
+ GET /weblog
+
+ # returns the XML
+ Accept: application/xml
+ GET /weblog
+
+ # returns the HTML
+ Accept: application/xml
+ GET /weblog.html
+
+ # returns the XML
+ Accept: text/html
+ GET /weblog.xml
+
+ All this relies on the fact that you have a route that includes .:format.
+
+* Expanded :method option in FormTagHelper#form_tag, FormHelper#form_for, PrototypeHelper#remote_form_for, PrototypeHelper#remote_form_tag, and PrototypeHelper#link_to_remote to allow for verbs other than GET and POST by automatically creating a hidden form field named _method, which will simulate the other verbs over post [DHH]
+
+* Added :method option to UrlHelper#link_to, which allows for using other verbs than GET for the link. This replaces the :post option, which is now deprecated. Example: link_to "Destroy", person_url(:id => person), :method => :delete [DHH]
+
+* follow_redirect doesn't complain about being redirected to the same controller. #5153 [dymo@mk.ukrtelecom.ua]
+
+* Add layout attribute to response object with the name of the layout that was rendered, or nil if none rendered. [Kevin Clark kevin.clark@gmail.com]
+
+* Fix NoMethodError when parsing params like &&. [Adam Greenfield]
+
+* Fix flip flopped logic in docs for url_for's :only_path option. Closes #4998. [esad@esse.at]
+
+* form.text_area handles the :size option just like the original text_area (:size => '60x10' becomes cols="60" rows="10"). [Jeremy Kemper]
+
+* Excise ingrown code from FormOptionsHelper#options_for_select. #5008 [anonymous]
+
+* Small fix in routing to allow dynamic routes (broken after [4242]) [Rick]
+
+ map.connect '*path', :controller => 'files', :action => 'show'
+
+* Replace alias method chaining with Module#alias_method_chain. [Marcel Molina Jr.]
+
+* Replace Ruby's deprecated append_features in favor of included. [Marcel Molina Jr.]
+
+* Use #flush between switching from #write to #syswrite. Closes #4907. [Blair Zajac ]
+
+* Documentation fix: integration test scripts don't require integration_test. Closes #4914. [Frederick Ros ]
+
+* ActionController::Base Summary documentation rewrite. Closes #4900. [kevin.clark@gmail.com]
+
+* Fix text_helper.rb documentation rendering. Closes #4725. [Frederick Ros]
+
+* Fixes bad rendering of JavaScriptMacrosHelper rdoc (closes #4910) [Frederick Ros]
+
+* Allow error_messages_for to report errors for multiple objects, as well as support for customizing the name of the object in the error summary header. Closes #4186. [andrew@redlinesoftware.com, Marcel Molina Jr.]
+
+ error_messages_for :account, :user, :subscription, :object_name => :account
+
+* Enhance documentation for setting headers in integration tests. Skip auto HTTP prepending when its already there. Closes #4079. [Rick Olson]
+
+* Documentation for AbstractRequest. Closes #4895. [kevin.clark@gmail.com]
+
+* Refactor various InstanceTag instance method to class methods. Closes #4800. [skaes@web.de]
+
+* Remove all remaining references to @params in the documentation. [Marcel Molina Jr.]
+
+* Add documentation for redirect_to :back's RedirectBackError exception. [Marcel Molina Jr.]
+
+* Update layout and content_for documentation to use yield rather than magic @content_for instance variables. [Marcel Molina Jr.]
+
+* Fix assert_redirected_to tests according to real-world usage. Also, don't fail if you add an extra :controller option: [Rick]
+
+ redirect_to :action => 'new'
+ assert_redirected_to :controller => 'monkeys', :action => 'new'
+
+* Cache CgiRequest#request_parameters so that multiple calls don't re-parse multipart data. [Rick]
+
+* Diff compared routing options. Allow #assert_recognizes to take a second arg as a hash to specify optional request method [Rick]
+
+ assert_recognizes({:controller => 'users', :action => 'index'}, 'users')
+ assert_recognizes({:controller => 'users', :action => 'create'}, {:path => 'users', :method => :post})
+
+* Diff compared options with #assert_redirected_to [Rick]
+
+* Add support in routes for semicolon delimited "subpaths", like /books/:id;:action [Jamis Buck]
+
+* Change link_to_function and button_to_function to (optionally) take an update_page block instead of a JavaScript string. Closes #4804. [zraii@comcast.net, Sam Stephenson]
+
+* Fixed that remote_form_for can leave out the object parameter and default to the instance variable of the object_name, just like form_for [DHH]
+
+* Modify routing so that you can say :require => { :method => :post } for a route, and the route will never be selected unless the request method is POST. Only works for route recognition, not for route generation. [Jamis Buck]
+
+* Added :add_headers option to verify which merges a hash of name/value pairs into the response's headers hash if the prerequisites cannot be satisfied. [Sam Stephenson]
+ ex. verify :only => :speak, :method => :post,
+ :render => { :status => 405, :text => "Must be post" },
+ :add_headers => { "Allow" => "POST" }
+
+* Added ActionController.filter_parameter_logging that makes it easy to remove passwords, credit card numbers, and other sensitive information from being logged when a request is handled #1897 [jeremye@bsa.ca.gov]
+
+
+*1.13.3* (March 12th, 2007)
+
+* Apply [5709] to stable.
+
+* session_enabled? works with session :off. #6680 [Catfish]
+
+* Performance: patch cgi/session to require digest/md5 once rather than per #create_new_id. [Stefan Kaes]
+
+
+*1.13.2* (February 5th, 2007)
+
+* Add much-needed html-scanner tests. Fixed CDATA parsing bug. [Rick]
+
+* improve error message for Routing for named routes. [Rob Sanheim]
+
+* Added enhanced docs to routing assertions. [Rob Sanheim]
+
+* fix form_for example in ActionController::Resources documentation. [gnarg]
+
+* Add singleton resources from trunk [Rick Olson]
+
+* select :multiple => true suffixes the attribute name with [] unless already suffixed. #6977 [nik.kakelin, ben, julik]
+
+* Improve routes documentation. #7095 [zackchandler]
+
+* Resource member routes require :id, eliminating the ambiguous overlap with collection routes. #7229 [dkubb]
+
+* Fixed NumberHelper#number_with_delimiter to use "." always for splitting the original number, not the delimiter parameter #7389 [ceefour]
+
+* Autolinking recognizes trailing and embedded . , : ; #7354 [Jarkko Laine]
+
+* Make TextHelper::auto_link recognize URLs with colons in path correctly, fixes #7268. [imajes]
+
+* Improved auto_link to match more valid urls correctly [Tobias Luetke]
+
+
+*1.13.1* (January 18th, 2007)
+
+* Fixed content-type bug in Prototype [sam]
+
+
+*1.13.0* (January 16th, 2007)
+
+* Modernize cookie testing code, and increase coverage (Heckle++) #7101 [Kevin Clark]
+
+* Heckling ActionController::Resources::Resource revealed that set_prefixes didn't break when :name_prefix was munged. #7081 [Kevin Clark]
+
+* Update to Prototype 1.5.0. [Sam Stephenson]
+
+* Allow exempt_from_layout :rhtml. #6742, #7026 [dcmanges, Squeegy]
+
+* Fix parsing of array[] CGI parameters so extra empty values aren't included. #6252 [Nicholas Seckar, aiwilliams, brentrowland]
+
+* link_to_unless_current works with full URLs as well as paths. #6891 [Jarkko Laine, manfred, idrifter]
+
+* Fix HTML::Node to output double quotes instead of single quotes. Closes #6845 [mitreandy]
+
+* Fix no method error with error_messages_on. Closes #6935 [nik.wakelin Koz]
+
+* Slight doc tweak to the ActionView::Helpers::PrototypeHelper#replace docs. Closes #6922 [Steven Bristol]
+
+* Slight doc tweak to #prepend_filter. Closes #6493 [Jeremy Voorhis]
+
+* Add more extensive documentation to the AssetTagHelper. Closes #6452 [Bob Silva]
+
+* Clean up multiple calls to #stringify_keys in TagHelper, add better documentation and testing for TagHelper. Closes #6394 [Bob Silva]
+
+* [DOCS] fix reference to ActionController::Macros::AutoComplete for #text_field_with_auto_complete. Closes #2578 [Jan Prill]
+
+* Make sure html_document is reset between integration test requests. [ctm]
+
+* Set session to an empty hash if :new_session => false and no session cookie or param is present. CGI::Session was raising an unrescued ArgumentError. [Josh Susser]
+
+* Fix assert_redirected_to bug where redirecting from a nested to to a top-level controller incorrectly added the current controller's nesting. Closes #6128. [Rick Olson]
+
+* Ensure render :json => ... skips the layout. #6808 [Josh Peek]
+
+* Silence log_error deprecation warnings from inspecting deprecated instance variables. [Nate Wiger]
+
+* Only cache GET requests with a 200 OK response. #6514, #6743 [RSL, anamba]
+
+* Correctly report which filter halted the chain. #6699 [Martin Emde]
+
+* respond_to recognizes JSON. render :json => @person.to_json automatically sets the content type and takes a :callback option to specify a client-side function to call using the rendered JSON as an argument. #4185 [Scott Raymond, eventualbuddha]
+ # application/json response with body 'Element.show({:name: "David"})'
+ respond_to do |format|
+ format.json { render :json => { :name => "David" }.to_json, :callback => 'Element.show' }
+ end
+
+* Makes :discard_year work without breaking multi-attribute parsing in AR. #1260, #3800 [sean@ardismg.com, jmartin@desertflood.com, stephen@touset.org, Bob Silva]
+
+* Adds html id attribute to date helper elements. #1050, #1382 [mortonda@dgrmm.net, David North, Bob Silva]
+
+* Add :index and @auto_index capability to model driven date/time selects. #847, #2655 [moriq, Doug Fales, Bob Silva]
+
+* Add :order to datetime_select, select_datetime, and select_date. #1427 [Timothee Peignier, patrick@lenz.sh, Bob Silva]
+
+* Added time_select to work with time values in models. Update scaffolding. #2489, #2833 [Justin Palmer, Andre Caum, Bob Silva]
+
+* Added :include_seconds to select_datetime, datetime_select and time_select. #2998 [csn, Bob Silva]
+
+* All date/datetime selects can now accept an array of month names with :use_month_names. Allows for localization. #363 [tomasj, Bob Silva]
+
+* Adds :time_separator to select_time and :date_separator to select_datetime. Preserves BC. #3811 [Bob Silva]
+
+* @response.redirect_url works with 201 Created responses: just return headers['Location'] rather than checking the response status. [Jeremy Kemper]
+
+* Fixed that HEAD should return the proper Content-Length header (that is, actually use @body.size, not just 0) [DHH]
+
+* Added GET-masquarading for HEAD, so request.method will return :get even for HEADs. This will help anyone relying on case request.method to automatically work with HEAD and map.resources will also allow HEADs to all GET actions. Rails automatically throws away the response content in a reply to HEAD, so you don't even need to worry about that. If you, for whatever reason, still need to distinguish between GET and HEAD in some edge case, you can use Request#head? and even Request.headers["REQUEST_METHOD"] for get the "real" answer. Closes #6694 [DHH]
+
+
+*1.13.0 RC1* (r5619, November 22nd, 2006)
+
+* Update Routing to complain when :controller is not specified by a route. Closes #6669. [Nicholas Seckar]
+
+* Ensure render_to_string cleans up after itself when an exception is raised. #6658 [rsanheim]
+
+* Update to Prototype and script.aculo.us [5579]. [Sam Stephenson, Thomas Fuchs]
+
+* simple_format helper doesn't choke on nil. #6644 [jerry426]
+
+* Reuse named route helper module between Routing reloads. Use remove_method to delete named route methods after each load. Since the module is never collected, this fixes a significant memory leak. [Nicholas Seckar]
+
+* Deprecate standalone components. [Jeremy Kemper]
+
+* Always clear model associations from session. #4795 [sd@notso.net, andylien@gmail.com]
+
+* Remove JavaScriptLiteral in favor of ActiveSupport::JSON::Variable. [Sam Stephenson]
+
+* Sync ActionController::StatusCodes::STATUS_CODES with http://www.iana.org/assignments/http-status-codes. #6586 [dkubb]
+
+* Multipart form values may have a content type without being treated as uploaded files if they do not provide a filename. #6401 [Andreas Schwarz, Jeremy Kemper]
+
+* assert_response supports symbolic status codes. #6569 [Kevin Clark]
+ assert_response :ok
+ assert_response :not_found
+ assert_response :forbidden
+
+* Cache parsed query parameters. #6559 [Stefan Kaes]
+
+* Deprecate JavaScriptHelper#update_element_function, which is superseeded by RJS [Thomas Fuchs]
+
+* Fix invalid test fixture exposed by stricter Ruby 1.8.5 multipart parsing. #6524 [Bob Silva]
+
+* Set ActionView::Base.default_form_builder once rather than passing the :builder option to every form or overriding the form helper methods. [Jeremy Kemper]
+
+* Deprecate expire_matched_fragments. Use expire_fragment instead. #6535 [Bob Silva]
+
+* Deprecate start_form_tag and end_form_tag. Use form_tag / '' from now on. [Rick]
+
+* Added block-usage to PrototypeHelper#form_remote_tag, document block-usage of FormTagHelper#form_tag [Rick]
+
+* Add a 0 margin/padding div around the hidden _method input tag that form_tag outputs. [Rick]
+
+* Added block-usage to TagHelper#content_tag [DHH]. Example:
+
+ <% content_tag :div, :class => "strong" %>
+ Hello world!
+ <% end %>
+
+ Will output:
+ Hello world!
+
+* Deprecated UrlHelper#link_to_image and UrlHelper#link_to :post => true #6409 [BobSilva]
+
+* Upgraded NumberHelper with number_to_phone support international formats to comply with ITU E.123 by supporting area codes with less than 3 digits, added precision argument to number_to_human_size (defaults to 1) #6421 [BobSilva]
+
+* Fixed that setting RAILS_ASSET_ID to "" should not add a trailing slash after assets #6454 [BobSilva/chrismear]
+
+* Force *_url named routes to show the host in ActionView [Rick]
+
+ <%= url_for ... %> # no host
+ <%= foo_path %> # no host
+ <%= foo_url %> # host!
+
+* Add support for converting blocks into function arguments to JavaScriptGenerator#call and JavaScriptProxy#call. [Sam Stephenson]
+
+* Add JavaScriptGenerator#literal for wrapping a string in an object whose #to_json is the string itself. [Sam Stephenson]
+
+* Add <%= escape_once html %> to escape html while leaving any currently escaped entities alone. Fix button_to double-escaping issue. [Rick]
+
+* Fix double-escaped entities, such as &, {, etc. [Rick]
+
+* Fix routing to correctly determine when generation fails. Closes #6300. [psross].
+
+* Fix broken assert_generates when extra keys are being checked. [Jamis Buck]
+
+* Replace KCODE checks with String#chars for truncate. Closes #6385 [Manfred Stienstra]
+
+* Make page caching respect the format of the resource that is being requested even if the current route is the default route so that, e.g. posts.rss is not transformed by url_for to '/' and subsequently cached as '/index.html' when it should be cached as '/posts.rss'. [Marcel Molina Jr.]
+
+* Use String#chars in TextHelper::excerpt. Closes #6386 [Manfred Stienstra]
+
+* Fix relative URL root matching problems. [Mark Imbriaco]
+
+* Fix filter skipping in controller subclasses. #5949, #6297, #6299 [Martin Emde]
+
+* render_text may optionally append to the response body. render_javascript appends by default. This allows you to chain multiple render :update calls by setting @performed_render = false between them (awaiting a better public API). [Jeremy Kemper]
+
+* Rename test assertion to prevent shadowing. Closes #6306. [psross]
+
+* Fixed that NumberHelper#number_to_delimiter should respect precision of higher than two digits #6231 [phallstrom]
+
+* Fixed that FormHelper#radio_button didn't respect an :id being passed in #6266 [evansj]
+
+* Added an html_options hash parameter to javascript_tag() and update_page_tag() helpers #6311 [tzaharia]. Example:
+
+ update_page_tag :defer => 'true' { |page| ... }
+
+ Gives:
+
+
+
+ Which is needed for dealing with the IE6 DOM when it's not yet fully loaded.
+
+* Fixed that rescue template path shouldn't be hardcoded, then it's easier to hook in your own #6295 [mnaberez]
+
+* Fixed escaping of backslashes in JavaScriptHelper#escape_javascript #6302 [sven@c3d2.de]
+
+* Fixed that some 500 rescues would cause 500's themselves because the response had not yet been generated #6329 [cmselmer]
+
+* respond_to :html doesn't assume .rhtml. #6281 [Hampton Catlin]
+
+* Fixed some deprecation warnings in ActionPack [Rick Olson]
+
+* assert_select_rjs decodes escaped unicode chars since the Javascript generators encode them. #6240 [japgolly]
+
+* Deprecation: @cookies, @headers, @request, @response will be removed after 1.2. Use the corresponding method instead. [Jeremy Kemper]
+
+* Make the :status parameter expand to the default message for that status code if it is an integer. Also support symbol statuses. [Jamis Buck]. Examples:
+
+ head :status => 404 # expands to "404 Not Found"
+ head :status => :not_found # expands to "404 Not Found"
+ head :status => :created # expands to "201 Created"
+
+* Add head(options = {}) for responses that have no body. [Jamis Buck]. Examples:
+
+ head :status => 404 # return an empty response with a 404 status
+ head :location => person_path(@person), :status => 201
+
+* Fix bug that kept any before_filter except the first one from being able to halt the before_filter chain. [Rick Olson]
+
+* strip_links is case-insensitive. #6285 [tagoh, Bob Silva]
+
+* Clear the cache of possible controllers whenever Routes are reloaded. [Nicholas Seckar]
+
+* Filters overhaul including meantime filter support using around filters + blocks. #5949 [Martin Emde, Roman Le Negrate, Stefan Kaes, Jeremy Kemper]
+
+* Update CGI process to allow sessions to contain namespaced models. Closes #4638. [dfelstead@site5.com]
+
+* Fix routing to respect user provided requirements and defaults when assigning default routing options (such as :action => 'index'). Closes #5950. [Nicholas Seckar]
+
+* Rescue Errno::ECONNRESET to handle an unexpectedly closed socket connection. Improves SCGI reliability. #3368, #6226 [sdsykes, fhanshaw@vesaria.com]
+
+* Added that respond_to blocks will automatically set the content type to be the same as is requested [DHH]. Examples:
+
+ respond_to do |format|
+ format.html { render :text => "I'm being sent as text/html" }
+ format.rss { render :text => "I'm being sent as application/rss+xml" }
+ format.atom { render :text => "I'm being sent as application/xml", :content_type => Mime::XML }
+ end
+
+* Added utf-8 as the default charset for all renders. You can change this default using ActionController::Base.default_charset=(encoding) [DHH]
+
+* Added proper getters and setters for content type and charset [DHH]. Example of what we used to do:
+
+ response.headers["Content-Type"] = "application/atom+xml; charset=utf-8"
+
+ ...now:
+
+ response.content_type = Mime::ATOM
+ response.charset = "utf-8"
+
+* Declare file extensions exempt from layouts. #6219 [brandon]
+ Example: ActionController::Base.exempt_from_layout 'rpdf'
+
+* Add chained replace/update support for assert_select_rjs [Rick Olson]
+
+ Given RJS like...
+
+ page['test1'].replace "foo
"
+ page['test2'].replace_html "foo
"
+
+ Test it with...
+
+ assert_select_rjs :chained_replace
+ assert_select_rjs :chained_replace, "test1"
+
+ assert_select_rjs :chained_replace_html
+ assert_select_rjs :chained_replace_html, "test2"
+
+* Load helpers in alphabetical order for consistency. Resolve cyclic javascript_helper dependency. #6132, #6178 [choonkeat@gmail.com]
+
+* Skip params with empty names, such as the &=Save query string from . #2569 [manfred, raphinou@yahoo.com]
+
+* Fix assert_tag so that :content => "foo" does not match substrings, but only exact strings. Use :content => /foo/ to match substrings. #2799 [Eric Hodel]
+
+* Update JavaScriptGenerator#show/hide/toggle/remove to new Prototype syntax for multiple ids, #6068 [petermichaux@gmail.com]
+
+* Update UrlWriter to support :only_path. [Nicholas Seckar, Dave Thomas]
+
+* Fixed JavaScriptHelper#link_to_function and JavaScriptHelper#button_to_function to have the script argument be optional [DHH]. So what used to require a nil, like this:
+
+ link_to("Hider", nil, :class => "hider_link") { |p| p[:something].hide }
+
+ ...can be written like this:
+
+ link_to("Hider", :class => "hider_link") { |p| p[:something].hide }
+
+* Added access to nested attributes in RJS #4548 [richcollins@gmail.com]. Examples:
+
+ page['foo']['style'] # => $('foo').style;
+ page['foo']['style']['color'] # => $('blank_slate').style.color;
+ page['foo']['style']['color'] = 'red' # => $('blank_slate').style.color = 'red';
+ page['foo']['style'].color = 'red' # => $('blank_slate').style.color = 'red';
+
+* Fixed that AssetTagHelper#image_tag and others using compute_public_path should not modify the incoming source argument (closes #5102) [eule@space.ch]
+
+* Deprecated the auto-appending of .png to AssetTagHelper#image_tag calls that doesn't have an extension [DHH]
+
+* Fixed FormOptionsHelper#select to respect :selected value #5813
+
+* Fixed TextHelper#simple_format to deal with multiple single returns within a single paragraph #5835 [moriq@moriq.com]
+
+* Fixed TextHelper#pluralize to handle 1 as a string #5909 [rails@bencurtis.com]
+
+* Improved resolution of DateHelper#distance_of_time_in_words for better precision #5994 [Bob Silva]
+
+* Changed that uncaught exceptions raised any where in the application will cause RAILS_ROOT/public/500.html to be read and shown instead of just the static "Application error (Rails)" [DHH]
+
+* Added deprecation language for pagination which will become a plugin by Rails 2.0 [DHH]
+
+* Added deprecation language for in_place_editor and auto_complete_field that both pieces will become plugins by Rails 2.0 [DHH]
+
+* Deprecated all of ActionController::Dependencies. All dependency loading is now handled from Active Support [DHH]
+
+* Added assert_select* for CSS selector-based testing (deprecates assert_tag) #5936 [assaf.arkin@gmail.com]
+
+* radio_button_tag generates unique id attributes. #3353 [Bob Silva, somekool@gmail.com]
+
+* strip_tags passes through blank args such as nil or "". #2229, #6702 [duncan@whomwah.com, dharana]
+
+* Cleanup assert_tag :children counting. #2181 [jamie@bravenet.com]
+
+* button_to accepts :method so you can PUT and DELETE with it. #6005 [Dan Webb]
+
+* Update sanitize text helper to strip plaintext tags, and . [Rick Olson]
+
+* Add routing tests to assert that RoutingError is raised when conditions aren't met. Closes #6016 [Nathan Witmer]
+
+* Make auto_link parse a greater subset of valid url formats. [Jamis Buck]
+
+* Integration tests: headers beginning with X aren't excluded from the HTTP_ prefix, so X-Requested-With becomes HTTP_X_REQUESTED_WITH as expected. [Mike Clark]
+
+* Switch to using FormEncodedPairParser for parsing request parameters. [Nicholas Seckar, DHH]
+
+* respond_to .html now always renders #{action_name}.rhtml so that registered custom template handlers do not override it in priority. Custom mime types require a block and throw proper error now. [Tobias Luetke]
+
+* Deprecation: test deprecated instance vars in partials. [Jeremy Kemper]
+
+* Add UrlWriter to allow writing urls from Mailers and scripts. [Nicholas Seckar]
+
+* Relax Routing's anchor pattern warning; it was preventing use of [^/] inside restrictions. [Nicholas Seckar]
+
+* Add controller_paths variable to Routing. [Nicholas Seckar]
+
+* Fix assert_redirected_to issue with named routes for module controllers. [Rick Olson]
+
+* Tweak RoutingError message to show option diffs, not just missing named route significant keys. [Rick Olson]
+
+* Invoke method_missing directly on hidden actions. Closes #3030. [Nicholas Seckar]
+
+* Add RoutingError exception when RouteSet fails to generate a path from a Named Route. [Rick Olson]
+
+* Replace Reloadable with Reloadable::Deprecated. [Nicholas Seckar]
+
+* Deprecation: check whether instance variables have been monkeyed with before assigning them to deprecation proxies. Raises a RuntimeError if so. [Jeremy Kemper]
+
+* Add support for the param_name parameter to the auto_complete_field helper. #5026 [david.a.williams@gmail.com]
+
+* Deprecation! @params, @session, @flash will be removed after 1.2. Use the corresponding instance methods instead. You'll get printed warnings during tests and logged warnings in dev mode when you access either instance variable directly. [Jeremy Kemper]
+
+* Make Routing noisy when an anchor regexp is assigned to a segment. #5674 [francois.beausoleil@gmail.com]
+
+* Added months and years to the resolution of DateHelper#distance_of_time_in_words, such that "60 days ago" becomes "2 months ago" #5611 [pjhyett@gmail.com]
+
+* Make controller_path available as an instance method. #5724 [jmckible@gmail.com]
+
+* Update query parser to support adjacent hashes. [Nicholas Seckar]
+
+* Make action caching aware of different formats for the same action so that, e.g. foo.xml is cached separately from foo.html. Implicitly set content type when reading in cached content with mime revealing extensions so the entire onous isn't on the webserver. [Marcel Molina Jr.]
+
+* Restrict Request Method hacking with ?_method to POST requests. [Rick Olson]
+
+* Fixed the new_#{resource}_url route and added named route tests for Simply Restful. [Rick Olson]
+
+* Added map.resources from the Simply Restful plugin [DHH]. Examples (the API has changed to use plurals!):
+
+ map.resources :messages
+ map.resources :messages, :comments
+ map.resources :messages, :new => { :preview => :post }
+
+* Fixed that integration simulation of XHRs should set Accept header as well [Edward Frederick]
+
+* TestRequest#reset_session should restore a TestSession, not a hash [Koz]
+
+* Don't search a load-path of '.' for controller files [Jamis Buck]
+
+* Update integration.rb to require test_process explicitly instead of via Dependencies. [Nicholas Seckar]
+
+* Fixed that you can still access the flash after the flash has been reset in reset_session. Closes #5584 [lmarlow@yahoo.com]
+
+* Allow form_for and fields_for to work with indexed form inputs. [Jeremy Kemper, Matt Lyon]
+
+ <% form_for 'post[]', @post do |f| -%>
+ <% end -%>
+
+* Remove leak in development mode by replacing define_method with module_eval. [Nicholas Seckar]
+
+* Provide support for decimal columns to form helpers. Closes #5672. [dave@pragprog.com]
+
+* Pass :id => nil or :class => nil to error_messages_for to supress that html attribute. #3586 [olivier_ansaldi@yahoo.com, sebastien@goetzilla.info]
+
+* Reset @html_document between requests so assert_tag works. #4810 [jarkko@jlaine.net, easleydp@gmail.com]
+
+* Integration tests behave well with render_component. #4632 [edward.frederick@revolution.com, dev.rubyonrails@maxdunn.com]
+
+* Added exception handling of missing layouts #5373 [chris@ozmm.org]
+
+* Fixed that real files and symlinks should be treated the same when compiling templates #5438 [zachary@panandscan.com]
+
+* Fixed that the flash should be reset when reset_session is called #5584 [shugo@ruby-lang.org]
+
+* Added special case for "1 Byte" in NumberHelper#number_to_human_size #5593 [murpyh@rubychan.de]
+
+* Fixed proper form-encoded parameter parsing for requests with "Content-Type: application/x-www-form-urlencoded; charset=utf-8" (note the presence of a charset directive) [DHH]
+
+* Add route_name_path method to generate only the path for a named routes. For example, map.person will add person_path. [Nicholas Seckar]
+
+* Avoid naming collision among compiled view methods. [Jeremy Kemper]
+
+* Fix CGI extensions when they expect string but get nil in Windows. Closes #5276 [mislav@nippur.irb.hr]
+
+* Determine the correct template_root for deeply nested components. #2841 [s.brink@web.de]
+
+* Fix that routes with *path segments in the recall can generate URLs. [Rick]
+
+* Fix strip_links so that it doesn't hang on multiline tags [Jamis Buck]
+
+* Remove problematic control chars in rescue template. #5316 [Stefan Kaes]
+
+* Make sure passed routing options are not mutated by routing code. #5314 [Blair Zajac]
+
+* Make sure changing the controller from foo/bar to bing/bang does not change relative to foo. [Jamis Buck]
+
+* Escape the path before routing recognition. #3671
+
+* Make sure :id and friends are unescaped properly. #5275 [me@julik.nl]
+
+* Rewind readable CGI params so others may reread them (such as CGI::Session when passing the session id in a multipart form). #210 [mklame@atxeu.com, matthew@walker.wattle.id.au]
+
+* Added Mime::TEXT (text/plain) and Mime::ICS (text/calendar) as new default types [DHH]
+
+* Added Mime::Type.register(string, symbol, synonyms = []) for adding new custom mime types [DHH]. Example: Mime::Type.register("image/gif", :gif)
+
+* Added support for Mime objects in render :content_type option [DHH]. Example: render :text => some_atom, :content_type => Mime::ATOM
+
+* Add :status option to send_data and send_file. Defaults to '200 OK'. #5243 [Manfred Stienstra ]
+
+* Routing rewrite. Simpler, faster, easier to understand. The published API for config/routes.rb is unchanged, but nearly everything else is different, so expect breakage in plugins and libs that try to fiddle with routes. [Nicholas Seckar, Jamis Buck]
+
+ map.connect '/foo/:id', :controller => '...', :action => '...'
+ map.connect '/foo/:id.:format', :controller => '...', :action => '...'
+ map.connect '/foo/:id', ..., :conditions => { :method => :get }
+
+* Cope with missing content type and length headers. Parse parameters from multipart and urlencoded request bodies only. [Jeremy Kemper]
+
+* Accept multipart PUT parameters. #5235 [guy.naor@famundo.com]
+
+* Added interrogation of params[:format] to determine Accept type. If :format is specified and matches a declared extension, like "rss" or "xml", that mime type will be put in front of the accept handler. This means you can link to the same action from different extensions and use that fact to determine output [DHH]. Example:
+
+ class WeblogController < ActionController::Base
+ def index
+ @posts = Post.find :all
+
+ respond_to do |format|
+ format.html
+ format.xml { render :xml => @posts.to_xml }
+ format.rss { render :action => "feed.rxml" }
+ end
+ end
+ end
+
+ # returns HTML when requested by a browser, since the browser
+ # has the HTML mimetype at the top of its priority list
+ Accept: text/html
+ GET /weblog
+
+ # returns the XML
+ Accept: application/xml
+ GET /weblog
+
+ # returns the HTML
+ Accept: application/xml
+ GET /weblog.html
+
+ # returns the XML
+ Accept: text/html
+ GET /weblog.xml
+
+ All this relies on the fact that you have a route that includes .:format.
+
+* Expanded :method option in FormTagHelper#form_tag, FormHelper#form_for, PrototypeHelper#remote_form_for, PrototypeHelper#remote_form_tag, and PrototypeHelper#link_to_remote to allow for verbs other than GET and POST by automatically creating a hidden form field named _method, which will simulate the other verbs over post [DHH]
+
+* Added :method option to UrlHelper#link_to, which allows for using other verbs than GET for the link. This replaces the :post option, which is now deprecated. Example: link_to "Destroy", person_url(:id => person), :method => :delete [DHH]
+
+* follow_redirect doesn't complain about being redirected to the same controller. #5153 [dymo@mk.ukrtelecom.ua]
+
+* Add layout attribute to response object with the name of the layout that was rendered, or nil if none rendered. [Kevin Clark kevin.clark@gmail.com]
+
+* Fix NoMethodError when parsing params like &&. [Adam Greenfield]
+
+* form.text_area handles the :size option just like the original text_area (:size => '60x10' becomes cols="60" rows="10"). [Jeremy Kemper]
+
+* Excise ingrown code from FormOptionsHelper#options_for_select. #5008 [anonymous]
+
+* Small fix in routing to allow dynamic routes (broken after [4242]) [Rick]
+
+ map.connect '*path', :controller => 'files', :action => 'show'
+
+* Use #flush between switching from #write to #syswrite. Closes #4907. [Blair Zajac ]
+
+* Allow error_messages_for to report errors for multiple objects, as well as support for customizing the name of the object in the error summary header. Closes #4186. [andrew@redlinesoftware.com, Marcel Molina Jr.]
+
+ error_messages_for :account, :user, :subscription, :object_name => :account
+
+* Fix assert_redirected_to tests according to real-world usage. Also, don't fail if you add an extra :controller option: [Rick]
+
+ redirect_to :action => 'new'
+ assert_redirected_to :controller => 'monkeys', :action => 'new'
+
+* Diff compared routing options. Allow #assert_recognizes to take a second arg as a hash to specify optional request method [Rick]
+
+ assert_recognizes({:controller => 'users', :action => 'index'}, 'users')
+ assert_recognizes({:controller => 'users', :action => 'create'}, {:path => 'users', :method => :post})
+
+* Diff compared options with #assert_redirected_to [Rick]
+
+* Add support in routes for semicolon delimited "subpaths", like /books/:id;:action [Jamis Buck]
+
+* Change link_to_function and button_to_function to (optionally) take an update_page block instead of a JavaScript string. Closes #4804. [zraii@comcast.net, Sam Stephenson]
+
+* Modify routing so that you can say :require => { :method => :post } for a route, and the route will never be selected unless the request method is POST. Only works for route recognition, not for route generation. [Jamis Buck]
+
+* Added :add_headers option to verify which merges a hash of name/value pairs into the response's headers hash if the prerequisites cannot be satisfied. [Sam Stephenson]
+ ex. verify :only => :speak, :method => :post,
+ :render => { :status => 405, :text => "Must be post" },
+ :add_headers => { "Allow" => "POST" }
+
+
+*1.12.5* (August 10th, 2006)
+
+* Updated security fix
+
+
+*1.12.4* (August 8th, 2006)
+
+* Cache CgiRequest#request_parameters so that multiple calls don't re-parse multipart data. [Rick]
+
+* Fixed that remote_form_for can leave out the object parameter and default to the instance variable of the object_name, just like form_for [DHH]
+
+* Added ActionController.filter_parameter_logging that makes it easy to remove passwords, credit card numbers, and other sensitive information from being logged when a request is handled. #1897 [jeremye@bsa.ca.gov]
+
+* Fixed that real files and symlinks should be treated the same when compiling templates. #5438 [zachary@panandscan.com]
+
+* Add :status option to send_data and send_file. Defaults to '200 OK'. #5243 [Manfred Stienstra ]
+
+* Update documentation for erb trim syntax. #5651 [matt@mattmargolis.net]
+
+* Short documentation to mention use of Mime::Type.register. #5710 [choonkeat@gmail.com]
+
+
+*1.12.3* (June 28th, 2006)
+
+* Fix broken traverse_to_controller. We now:
+ Look for a _controller.rb file under RAILS_ROOT to load.
+ If we find it, we require_dependency it and return the controller it defined. (If none was defined we stop looking.)
+ If we don't find it, we look for a .rb file under RAILS_ROOT to load. If we find it, and it loads a constant we keep looking.
+ Otherwise we check to see if a directory of the same name exists, and if it does we create a module for it.
+
+
+*1.12.2* (June 27th, 2006)
+
+* Refinement to avoid exceptions in traverse_to_controller.
+
+* (Hackish) Fix loading of arbitrary files in Ruby's load path by traverse_to_controller. [Nicholas Seckar]
+
+
+*1.12.1* (April 6th, 2006)
+
+* Fixed that template extensions would be cached development mode #4624 [Stefan Kaes]
+
+* Update to Prototype 1.5.0_rc0 [Sam Stephenson]
+
+* Honor skipping filters conditionally for only certain actions even when the parent class sets that filter to conditionally be executed only for the same actions. #4522 [Marcel Molina Jr.]
+
+* Delegate xml_http_request in integration tests to the session instance. [Jamis Buck]
+
+* Update the diagnostics template skip the useless '' text. [Nicholas Seckar]
+
+* CHANGED DEFAULT: Don't parse YAML input by default, but keep it available as an easy option [DHH]
+
+* Add additional autocompleter options [aballai, Thomas Fuchs]
+
+* Fixed fragment caching of binary data on Windows #4493 [bellis@deepthought.org]
+
+* Applied Prototype $() performance patches (#4465, #4477) and updated script.aculo.us [Sam Stephenson, Thomas Fuchs]
+
+* Added automated timestamping to AssetTagHelper methods for stylesheets, javascripts, and images when Action Controller is run under Rails [DHH]. Example:
+
+ image_tag("rails.png") # => ' '
+
+ ...to avoid frequent stats (not a problem for most people), you can set RAILS_ASSET_ID in the ENV to avoid stats:
+
+ ENV["RAILS_ASSET_ID"] = "2345"
+ image_tag("rails.png") # => ' '
+
+ This can be used by deployment managers to set the asset id by application revision
+
+
+*1.12.0* (March 27th, 2006)
+
+* Add documentation for respond_to. [Jamis Buck]
+
+* Fixed require of bluecloth and redcloth when gems haven't been loaded #4446 [murphy@cYcnus.de]
+
+* Update to Prototype 1.5.0_pre1 [Sam Stephenson]
+
+* Change #form_for and #fields_for so that the second argument is not required [Dave Thomas]
+
+ <% form_for :post, @post, :url => { :action => 'create' } do |f| -%>
+
+ becomes...
+
+ <% form_for :post, :url => { :action => 'create' } do |f| -%>
+
+* Update to script.aculo.us 1.6 [Thomas Fuchs]
+
+* Enable application/x-yaml processing by default [Jamis Buck]
+
+* Fix double url escaping of remote_function. Add :escape => false option to ActionView's url_for. [Nicholas Seckar]
+
+* Add :script option to in_place_editor to support evalScripts (closes #4194) [codyfauser@gmail.com]
+
+* Fix mixed case enumerable methods in the JavaScript Collection Proxy (closes #4314) [codyfauser@gmail.com]
+
+* Undo accidental escaping for mail_to; add regression test. [Nicholas Seckar]
+
+* Added nicer message for assert_redirected_to (closes #4294) [court3nay]
+
+ assert_redirected_to :action => 'other_host', :only_path => false
+
+ when it was expecting...
+
+ redirected_to :action => 'other_host', :only_path => true, :host => 'other.test.host'
+
+ gives the error message...
+
+ response is not a redirection to all of the options supplied (redirection is <{:only_path=>false, :host=>"other.test.host", :action=>"other_host"}>), difference: <{:only_path=>"true", :host=>"other.test.host"}>
+
+* Change url_for to escape the resulting URLs when called from a view. [Nicholas Seckar, coffee2code]
+
+* Added easy support for testing file uploads with fixture_file_upload #4105 [turnip@turnipspatch.com]. Example:
+
+ # Looks in Test::Unit::TestCase.fixture_path + '/files/spongebob.png'
+ post :change_avatar, :avatar => fixture_file_upload('/files/spongebob.png', 'image/png')
+
+* Fixed UrlHelper#current_page? to behave even when url-escaped entities are present #3929 [jeremy@planetargon.com]
+
+* Add ability for relative_url_root to be specified via an environment variable RAILS_RELATIVE_URL_ROOT. [isaac@reuben.com, Nicholas Seckar]
+
+* Fixed link_to "somewhere", :post => true to produce valid XHTML by using the parentnode instead of document.body for the instant form #3007 [Bob Silva]
+
+* Added :function option to PrototypeHelper#observe_field/observe_form that allows you to call a function instead of submitting an ajax call as the trigger #4268 [jonathan@daikini.com]
+
+* Make Mime::Type.parse consider q values (if any) [Jamis Buck]
+
+* XML-formatted requests are typecast according to "type" attributes for :xml_simple [Jamis Buck]
+
+* Added protection against proxy setups treating requests as local even when they're not #3898 [stephen_purcell@yahoo.com]
+
+* Added TestRequest#raw_post that simulate raw_post from CgiRequest #3042 [francois.beausoleil@gmail.com]
+
+* Underscore dasherized keys in formatted requests [Jamis Buck]
+
+* Add MimeResponds::Responder#any for managing multiple types with identical responses [Jamis Buck]
+
+* Make the xml_http_request testing method set the HTTP_ACCEPT header [Jamis Buck]
+
+* Add Verification to scaffolds. Prevent destructive actions using GET [Michael Koziarski]
+
+* Avoid hitting the filesystem when using layouts by using a File.directory? cache. [Stefan Kaes, Nicholas Seckar]
+
+* Simplify ActionController::Base#controller_path [Nicholas Seckar]
+
+* Added simple alert() notifications for RJS exceptions when config.action_view.debug_rjs = true. [Sam Stephenson]
+
+* Added :content_type option to render, so you can change the content type on the fly [DHH]. Example: render :action => "atom.rxml", :content_type => "application/atom+xml"
+
+* CHANGED DEFAULT: The default content type for .rxml is now application/xml instead of type/xml, see http://www.xml.com/pub/a/2004/07/21/dive.html for reason [DHH]
+
+* Added option to render action/template/file of a specific extension (and here by template type). This means you can have multiple templates with the same name but a different extension [DHH]. Example:
+
+ class WeblogController < ActionController::Base
+ def index
+ @posts = Post.find :all
+
+ respond_to do |type|
+ type.html # using defaults, which will render weblog/index.rhtml
+ type.xml { render :action => "index.rxml" }
+ type.js { render :action => "index.rjs" }
+ end
+ end
+ end
+
+* Added better support for using the same actions to output for different sources depending on the Accept header [DHH]. Example:
+
+ class WeblogController < ActionController::Base
+ def create
+ @post = Post.create(params[:post])
+
+ respond_to do |type|
+ type.js { render } # renders create.rjs
+ type.html { redirect_to :action => "index" }
+ type.xml do
+ headers["Location"] = url_for(:action => "show", :id => @post)
+ render(:nothing, :status => "201 Created")
+ end
+ end
+ end
+ end
+
+* Added Base#render(:xml => xml) that works just like Base#render(:text => text), but sets the content-type to text/xml and the charset to UTF-8 [DHH]
+
+* Integration test's url_for now runs in the context of the last request (if any) so after post /products/show/1 url_for :action => 'new' will yield /product/new [Tobias Luetke]
+
+* Re-added mixed-in helper methods for the JavascriptGenerator. Moved JavascriptGenerators methods to a module that is mixed in after the helpers are added. Also fixed that variables set in the enumeration methods like #collect are set correctly. Documentation added for the enumeration methods [Rick Olson]. Examples:
+
+ page.select('#items li').collect('items') do |element|
+ element.hide
+ end
+ # => var items = $$('#items li').collect(function(value, index) { return value.hide(); });
+
+* Added plugin support for parameter parsers, which allows for better support for REST web services. By default, posts submitted with the application/xml content type is handled by creating a XmlSimple hash with the same name as the root element of the submitted xml. More handlers can easily be registered like this:
+
+ # Assign a new param parser to a new content type
+ ActionController::Base.param_parsers['application/atom+xml'] = Proc.new do |data|
+ node = REXML::Document.new(post)
+ { node.root.name => node.root }
+ end
+
+ # Assign the default XmlSimple to a new content type
+ ActionController::Base.param_parsers['application/backpack+xml'] = :xml_simple
+
+Default YAML web services were retired, ActionController::Base.param_parsers carries an example which shows how to get this functionality back. As part of this new plugin support, request.[formatted_post?, xml_post?, yaml_post? and post_format] were all deprecated in favor of request.content_type [Tobias Luetke]
+
+* Fixed Effect.Appear in effects.js to work with floats in Safari #3524, #3813, #3044 [Thomas Fuchs]
+
+* Fixed that default image extension was not appended when using a full URL with AssetTagHelper#image_tag #4032, #3728 [rubyonrails@beautifulpixel.com]
+
+* Added that page caching will only happen if the response code is less than 400 #4033 [g.bucher@teti.ch]
+
+* Add ActionController::IntegrationTest to allow high-level testing of the way the controllers and routes all work together [Jamis Buck]
+
+* Added support to AssetTagHelper#javascript_include_tag for having :defaults appear anywhere in the list, so you can now make one call ala javascript_include_tag(:defaults, "my_scripts") or javascript_include_tag("my_scripts", :defaults) depending on how you want the load order #3506 [Bob Silva]
+
+* Added support for visual effects scoped queues to the visual_effect helper #3530 [Abdur-Rahman Advany]
+
+* Added .rxml (and any non-rhtml template, really) supportfor CaptureHelper#content_for and CaptureHelper#capture #3287 [Brian Takita]
+
+* Added script.aculo.us drag and drop helpers to RJS [Thomas Fuchs]. Examples:
+
+ page.draggable 'product-1'
+ page.drop_receiving 'wastebasket', :url => { :action => 'delete' }
+ page.sortable 'todolist', :url => { action => 'change_order' }
+
+* Fixed that form elements would strip the trailing [] from the first parameter #3545 [ruby@bobsilva.com]
+
+* During controller resolution, update the NameError suppression to check for the expected constant. [Nicholas Seckar]
+
+* Update script.aculo.us to V1.5.3 [Thomas Fuchs]
+
+* Added various InPlaceEditor options, #3746, #3891, #3896, #3906 [Bill Burcham, ruairi, sl33p3r]
+
+* Added :count option to pagination that'll make it possible for the ActiveRecord::Base.count call to using something else than * for the count. Especially important for count queries using DISTINCT #3839 [skaes]
+
+* Update script.aculo.us to V1.5.2 [Thomas Fuchs]
+
+* Added element and collection proxies to RJS [DHH]. Examples:
+
+ page['blank_slate'] # => $('blank_slate');
+ page['blank_slate'].show # => $('blank_slate').show();
+ page['blank_slate'].show('first').up # => $('blank_slate').show('first').up();
+
+ page.select('p') # => $$('p');
+ page.select('p.welcome b').first # => $$('p.welcome b').first();
+ page.select('p.welcome b').first.hide # => $$('p.welcome b').first().hide();
+
+* Add JavaScriptGenerator#replace for replacing an element's "outer HTML". #3246 [tom@craz8.com, Sam Stephenson]
+
+* Remove over-engineered form_for code for a leaner implementation. [Nicholas Seckar]
+
+* Document form_for's :html option. [Nicholas Seckar]
+
+* Major components cleanup and speedup. #3527 [Stefan Kaes]
+
+* Fix problems with pagination and :include. [Kevin Clark]
+
+* Add ActiveRecordTestCase for testing AR integration. [Kevin Clark]
+
+* Add Unit Tests for pagination [Kevin Clark]
+
+* Add :html option for specifying form tag options in form_for. [Sam Stephenson]
+
+* Replace dubious controller parent class in filter docs. #3655, #3722 [info@rhalff.com, eigentone@gmail.com]
+
+* Don't interpret the :value option on text_area as an html attribute. Set the text_area's value. #3752 [gabriel@gironda.org]
+
+* Fix remote_form_for creates a non-ajax form. [Rick Olson]
+
+* Don't let arbitrary classes match as controllers -- a potentially dangerous bug. [Nicholas Seckar]
+
+* Fix Routing tests. Fix routing where failing to match a controller would prevent the rest of routes from being attempted. [Nicholas Seckar]
+
+* Add :builder => option to form_for and friends. [Nicholas Seckar, Rick Olson]
+
+* Fix controller resolution to avoid accidentally inheriting a controller from a parent module. [Nicholas Seckar]
+
+* Set sweeper's @controller to nil after a request so that the controller may be collected between requests. [Nicholas Seckar]
+
+* Subclasses of ActionController::Caching::Sweeper should be Reloadable. [Rick Olson]
+
+* Document the :xhr option for verifications. #3666 [leeo]
+
+* Added :only and :except controls to skip_before/after_filter just like for when you add filters [DHH]
+
+* Ensure that the instance variables are copied to the template when performing render :update. [Nicholas Seckar]
+
+* Add the ability to call JavaScriptGenerator methods from helpers called in update blocks. [Sam Stephenson] Example:
+ module ApplicationHelper
+ def update_time
+ page.replace_html 'time', Time.now.to_s(:db)
+ page.visual_effect :highlight, 'time'
+ end
+ end
+
+ class UserController < ApplicationController
+ def poll
+ render :update { |page| page.update_time }
+ end
+ end
+
+* Add render(:update) to ActionView::Base. [Sam Stephenson]
+
+* Fix render(:update) to not render layouts. [Sam Stephenson]
+
+* Fixed that SSL would not correctly be detected when running lighttpd/fcgi behind lighttpd w/mod_proxy #3548 [stephen_purcell@yahoo.com]
+
+* Added the possibility to specify atomatic expiration for the memcachd session container #3571 [Stefan Kaes]
+
+* Change layout discovery to take into account the change in semantics with File.join and nil arguments. [Marcel Molina Jr.]
+
+* Raise a RedirectBackError if redirect_to :back is called when there's no HTTP_REFERER defined #3049 [kevin.clark@gmail.com]
+
+* Treat timestamps like datetimes for scaffolding purposes #3388 [Maik Schmidt]
+
+* Fix IE bug with link_to "something", :post => true #3443 [Justin Palmer]
+
+* Extract Test::Unit::TestCase test process behavior into an ActionController::TestProcess module. [Sam Stephenson]
+
+* Pass along blocks from render_to_string to render. [Sam Stephenson]
+
+* Add render :update for inline RJS. [Sam Stephenson] Example:
+ class UserController < ApplicationController
+ def refresh
+ render :update do |page|
+ page.replace_html 'user_list', :partial => 'user', :collection => @users
+ page.visual_effect :highlight, 'user_list'
+ end
+ end
+ end
+
+* allow nil objects for error_messages_for [Michael Koziarski]
+
+* Refactor human_size to exclude decimal place if it is zero. [Marcel Molina Jr.]
+
+* Update to Prototype 1.5.0_pre0 [Sam Stephenson]
+
+* Automatically discover layouts when a controller is namespaced. #2199, #3424 [me@jonnii.com rails@jeffcole.net Marcel Molina Jr.]
+
+* Add support for multiple proxy servers to CgiRequest#host [gaetanot@comcast.net]
+
+* Documentation typo fix. #2367 [Blair Zajac]
+
+* Remove Upload Progress. #2871 [Sean Treadway]
+
+* Fix typo in function name mapping in auto_complete_field. #2929 #3446 [doppler@gmail.com phil.ross@gmail.com]
+
+* Allow auto-discovery of third party template library layouts. [Marcel Molina Jr.]
+
+* Have the form builder output radio button, not check box, when calling the radio button helper. #3331 [LouisStAmour@gmail.com]
+
+* Added assignment of the Autocompleter object created by JavaScriptMacroHelper#auto_complete_field to a local javascript variables [DHH]
+
+* Added :on option for PrototypeHelper#observe_field that allows you to specify a different callback hook to have the observer trigger on [DHH]
+
+* Added JavaScriptHelper#button_to_function that works just like JavaScriptHelper#link_to_function but uses a button instead of a href [DHH]
+
+* Added that JavaScriptHelper#link_to_function will honor existing :onclick definitions when adding the function call [DHH]
+
+* Added :disable_with option to FormTagHelper#submit_tag to allow for easily disabled submit buttons with different text [DHH]
+
+* Make auto_link handle nil by returning quickly if blank? [Scott Barron]
+
+* Make auto_link match urls with a port number specified. [Marcel Molina Jr.]
+
+* Added support for toggling visual effects to ScriptaculousHelper::visual_effect, #3323. [Thomas Fuchs]
+
+* Update to script.aculo.us to 1.5.0 rev. 3343 [Thomas Fuchs]
+
+* Added :select option for JavaScriptMacroHelper#auto_complete_field that makes it easier to only use part of the auto-complete suggestion as the value for insertion [Thomas Fuchs]
+
+* Added delayed execution of Javascript from within RJS #3264 [devslashnull@gmail.com]. Example:
+
+ page.delay(20) do
+ page.visual_effect :fade, 'notice'
+ end
+
+* Add session ID to default logging, but remove the verbose description of every step [DHH]
+
+* Add the following RJS methods: [Sam Stephenson]
+
+ * alert - Displays an alert() dialog
+ * redirect_to - Changes window.location.href to simulate a browser redirect
+ * call - Calls a JavaScript function
+ * assign - Assigns to a JavaScript variable
+ * << - Inserts an arbitrary JavaScript string
+
+* Fix incorrect documentation for form_for [Nicholas Seckar]
+
+* Don't include a layout when rendering an rjs template using render's :template option. [Marcel Molina Jr.]
+
+*1.1.2* (December 13th, 2005)
+
+* Become part of Rails 1.0
+
+* Update to script.aculo.us 1.5.0 final (equals 1.5.0_rc6) [Thomas Fuchs]
+
+* Update to Prototype 1.4.0 final [Sam Stephenson]
+
+* Added form_remote_for (form_for meets form_remote_tag) [DHH]
+
+* Update to script.aculo.us 1.5.0_rc6
+
+* More robust relative url root discovery for SCGI compatibility. This solves the 'SCGI routes problem' -- you no longer need to prefix all your routes with the name of the SCGI mountpoint. #3070 [Dave Ringoen]
+
+* Fix docs for text_area_tag. #3083. [Christopher Cotton]
+
+* Change form_for and fields_for method signatures to take object name and object as separate arguments rather than as a Hash. [DHH]
+
+* Introduce :selected option to the select helper. Allows you to specify a selection other than the current value of object.method. Specify :selected => nil to leave all options unselected. #2991 [Jonathan Viney ]
+
+* Initialize @optional in routing code to avoid warnings about uninitialized access to an instance variable. [Nicholas Seckar]
+
+* Make ActionController's render honor the :locals option when rendering a :file. #1665. [Emanuel Borsboom, Marcel Molina Jr.]
+
+* Allow assert_tag(:conditions) to match the empty string when a tag has no children. Closes #2959. [Jamis Buck]
+
+* Update html-scanner to handle CDATA sections better. Closes #2970. [Jamis Buck]
+
+* Don't put flash in session if sessions are disabled. [Jeremy Kemper]
+
+* Strip out trailing &_= for raw post bodies. Closes #2868. [Sam Stephenson]
+
+* Pass multiple arguments to Element.show and Element.hide in JavaScriptGenerator instead of using iterators. [Sam Stephenson]
+
+* Improve expire_fragment documentation. #2966 [court3nay@gmail.com]
+
+* Correct docs for automatic layout assignment. #2610. [Charles M. Gerungan]
+
+* Always create new AR sessions rather than trying too hard to avoid database traffic. #2731 [Jeremy Kemper]
+
+* Update to Prototype 1.4.0_rc4. Closes #2943 (old Array.prototype.reverse behavior can be obtained by passing false as an argument). [Sam Stephenson]
+
+* Use Element.update('id', 'html') instead of $('id').innerHTML = 'html' in JavaScriptGenerator#replace_html so that script tags are evaluated. [Sam Stephenson]
+
+* Make rjs templates always implicitly skip out on layouts. [Marcel Molina Jr.]
+
+* Correct length for the truncate text helper. #2913 [Stefan Kaes]
+
+* Update to Prototype 1.4.0_rc3. Closes #1893, #2505, #2550, #2748, #2783. [Sam Stephenson]
+
+* Add support for new rjs templates which wrap an update_page block. [Marcel Molina Jr.]
+
+* Rename Version constant to VERSION. #2802 [Marcel Molina Jr.]
+
+* Correct time_zone_options_for_select docs. #2892 [pudeyo@rpi.com]
+
+* Remove the unused, slow response_dump and session_dump variables from error pages. #1222 [lmarlow@yahoo.com]
+
+* Performance tweaks: use Set instead of Array to speed up prototype helper include? calls. Avoid logging code if logger is nil. Inline commonly-called template presence checks. #2880, #2881, #2882, #2883 [Stefan Kaes]
+
+* MemCache store may be given multiple addresses. #2869 [Ryan Carver ]
+
+* Handle cookie parsing irregularity for certain Nokia phones. #2530 [zaitzow@gmail.com]
+
+* Added PrototypeHelper::JavaScriptGenerator and PrototypeHelper#update_page for easily modifying multiple elements in an Ajax response. [Sam Stephenson] Example:
+
+ update_page do |page|
+ page.insert_html :bottom, 'list', 'Last item '
+ page.visual_effect :highlight, 'list'
+ page.hide 'status-indicator', 'cancel-link'
+ end
+
+ generates the following JavaScript:
+
+ new Insertion.Bottom("list", "Last item ");
+ new Effect.Highlight("list");
+ ["status-indicator", "cancel-link"].each(Element.hide);
+
+* Refactored JavaScriptHelper into PrototypeHelper and ScriptaculousHelper [Sam Stephenson]
+
+* Update to latest script.aculo.us version (as of [3031])
+
+* Updated docs for in_place_editor, fixes a couple bugs and offers extended support for external controls [Justin Palmer]
+
+* Update documentation for render :file. #2858 [Tom Werner]
+
+* Only include builtin filters whose filenames match /^[a-z][a-z_]*_helper.rb$/ to avoid including operating system metadata such as ._foo_helper.rb. #2855 [court3nay@gmail.com]
+
+* Added FormHelper#form_for and FormHelper#fields_for that makes it easier to work with forms for single objects also if they don't reside in instance variables [DHH]. Examples:
+
+ <% form_for :person, @person, :url => { :action => "update" } do |f| %>
+ First name: <%= f.text_field :first_name %>
+ Last name : <%= f.text_field :last_name %>
+ Biography : <%= f.text_area :biography %>
+ Admin? : <%= f.check_box :admin %>
+ <% end %>
+
+ <% form_for :person, person, :url => { :action => "update" } do |person_form| %>
+ First name: <%= person_form.text_field :first_name %>
+ Last name : <%= person_form.text_field :last_name %>
+
+ <% fields_for :permission => person.permission do |permission_fields| %>
+ Admin? : <%= permission_fields.check_box :admin %>
+ <% end %>
+ <% end %>
+
+* options_for_select allows any objects which respond_to? :first and :last rather than restricting to Array and Range. #2824 [Jacob Robbins , Jeremy Kemper]
+
+* The auto_link text helper accepts an optional block to format the link text for each url and email address. Example: auto_link(post.body) { |text| truncate(text, 10) } [Jeremy Kemper]
+
+* assert_tag uses exact matches for string conditions, instead of partial matches. Use regex to do partial matches. #2799 [Jamis Buck]
+
+* CGI::Session::ActiveRecordStore.data_column_name = 'foobar' to use a different session data column than the 'data' default. [nbpwie102@sneakemail.com]
+
+* Do not raise an exception when default helper is missing; log a debug message instead. It's nice to delete empty helpers. [Jeremy Kemper]
+
+* Controllers with acronyms in their names (e.g. PDFController) require the correct default helper (PDFHelper in file pdf_helper.rb). #2262 [jeff@opendbms.com]
+
+
+*1.11.0* (November 7th, 2005)
+
+* Added request as instance method to views, so you can do <%= request.env["HTTP_REFERER"] %>, just like you can already access response, session, and the likes [DHH]
+
+* Fix conflict with assert_tag and Glue gem #2255 [david.felstead@gmail.com]
+
+* Add documentation to assert_tag indicating that it only works with well-formed XHTML #1937, #2570 [Jamis Buck]
+
+* Added action_pack.rb stub so that ActionPack::Version loads properly [Sam Stephenson]
+
+* Added short-hand to assert_tag so assert_tag :tag => "span" can be written as assert_tag "span" [DHH]
+
+* Added skip_before_filter/skip_after_filter for easier control of the filter chain in inheritance hierachies [DHH]. Example:
+
+ class ApplicationController < ActionController::Base
+ before_filter :authenticate
+ end
+
+ class WeblogController < ApplicationController
+ # will run the :authenticate filter
+ end
+
+ class SignupController < ActionController::Base
+ # will not run the :authenticate filter
+ skip_before_filter :authenticate
+ end
+
+* Added redirect_to :back as a short-hand for redirect_to(request.env["HTTP_REFERER"]) [DHH]
+
+* Change javascript_include_tag :defaults to not use script.aculo.us loader, which facilitates the use of plugins for future script.aculo.us and third party javascript extensions, and provide register_javascript_include_default for plugins to specify additional JavaScript files to load. Removed slider.js and builder.js from actionpack. [Thomas Fuchs]
+
+* Fix problem where redirecting components can cause an infinite loop [Rick Olson]
+
+* Added support for the queue option on visual_effect [Thomas Fuchs]
+
+* Update script.aculo.us to V1.5_rc4 [Thomas Fuchs]
+
+* Fix that render :text didn't interpolate instance variables #2629, #2626 [skaes]
+
+* Fix line number detection and escape RAILS_ROOT in backtrace Regexp [Nicholas Seckar]
+
+* Fixed document.getElementsByClassName from Prototype to be speedy again [Sam Stephenson]
+
+* Recognize ./#{RAILS_ROOT} as RAILS_ROOT in error traces [Nicholas Seckar]
+
+* Remove ARStore session fingerprinting [Nicholas Seckar]
+
+* Fix obscure bug in ARStore [Nicholas Seckar]
+
+* Added TextHelper#strip_tags for removing HTML tags from a string (using HTMLTokenizer) #2229 [marcin@junkheap.net]
+
+* Added a reader for flash.now, so it's possible to do stuff like flash.now[:alert] ||= 'New if not set' #2422 [Caio Chassot]
+
+
+*1.10.2* (October 26th, 2005)
+
+* Reset template variables after using render_to_string [skaes@web.de]
+
+* Expose the session model backing CGI::Session
+
+* Abbreviate RAILS_ROOT in traces
+
+
+*1.10.1* (October 19th, 2005)
+
+* Update error trace templates [Nicholas Seckar]
+
+* Stop showing generated routing code in application traces [Nicholas Seckar]
+
+
+*1.10.0* (October 16th, 2005)
+
+* Make string-keys locals assigns optional. Add documentation describing depreciated state [skaes@web.de]
+
+* Improve line number detection for template errors [Nicholas Seckar]
+
+* Update/clean up documentation (rdoc)
+
+* Upgrade to Prototype 1.4.0_rc0 [Sam Stephenson]
+
+* Added assert_vaild. Reports the proper AR error messages as fail message when the passed record is invalid [Tobias Luetke]
+
+* Add temporary support for passing locals to render using string keys [Nicholas Seckar]
+
+* Clean up error pages by providing better backtraces [Nicholas Seckar]
+
+* Raise an exception if an attempt is made to insert more session data into the ActiveRecordStore data column than the column can hold. #2234. [justin@textdrive.com]
+
+* Removed references to assertions.rb from actionpack assert's backtraces. Makes error reports in functional unit tests much less noisy. [Tobias Luetke]
+
+* Updated and clarified documentation for JavaScriptHelper to be more concise about the various options for including the JavaScript libs. [Thomas Fuchs]
+
+* Hide "Retry with Breakpoint" button on error pages until feature is functional. [DHH]
+
+* Fix Request#host_with_port to use the standard port when Rails is behind a proxy. [Nicholas Seckar]
+
+* Escape query strings in the href attribute of URLs created by url_helper. #2333 [Michael Schuerig ]
+
+* Improved line number reporting for template errors [Nicholas Seckar]
+
+* Added :locals support for render :inline #2463 [mdabney@cavoksolutions.com]
+
+* Unset the X-Requested-With header when using the xhr wrapper in functional tests so that future requests aren't accidentally xhr'ed #2352 [me@julik.nl, Sam Stephenson]
+
+* Unescape paths before writing cache to file system. #1877. [Damien Pollet]
+
+* Wrap javascript_tag contents in a CDATA section and add a cdata_section method to TagHelper #1691 [Michael Schuerig, Sam Stephenson]
+
+* Misc doc fixes (typos/grammar/etc). #2445. [coffee2code]
+
+* Speed improvement for session_options. #2287. [skaes@web.de]
+
+* Make cacheing binary files friendly with Windows. #1975. [Rich Olson]
+
+* Convert boolean form options form the tag_helper. #809. [Michael Schuerig ]
+
+* Fixed that an instance variable with the same name as a partial should be implicitly passed as the partial :object #2269 [court3nay]
+
+* Update Prototype to V1.4.0_pre11, script.aculo.us to [2502] [Thomas Fuchs]
+
+* Make assert_tag :children count appropriately. Closes #2181. [jamie@bravenet.com]
+
+* Forced newer versions of RedCloth to use hard breaks [DHH]
+
+* Added new scriptaculous options for auto_complete_field #2343 [m.stienstra@fngtps.com]
+
+* Don't prepend the asset host if the string is already a fully-qualified URL
+
+* Updated to script.aculo.us V1.5.0_rc2 and Prototype to V1.4.0_pre7 [Thomas Fuchs]
+
+* Undo condition change made in [2345] to prevent normal parameters arriving as StringIO.
+
+* Tolerate consecutive delimiters in query parameters. #2295 [darashi@gmail.com]
+
+* Streamline render process, code cleaning. Closes #2294. [skae]
+
+* Keep flash after components are rendered. #2291 [Rick Olson, Scott]
+
+* Shorten IE file upload path to filename only to match other browsers. #1507 [court3nay@gmail.com]
+
+* Fix open/save dialog in IE not opening files send with send_file/send_data, #2279 [Thomas Fuchs]
+
+* Fixed that auto_discovery_link_tag couldn't take a string as the URL [DHH]
+
+* Fixed problem with send_file and WEBrick using stdout #1812 [DHH]
+
+* Optimized tag_options to not sort keys, which is no longer necessary when assert_dom_equal and friend is available #1995 [skae]
+
+* Added assert_dom_equal and assert_dom_not_equal to compare tags generated by the helpers in an order-indifferent manner #1995 [skae]
+
+* Fixed that Request#domain caused an exception if the domain header wasn't set in the original http request #1795 [Michael Koziarski]
+
+* Make the truncate() helper multi-byte safe (assuming $KCODE has been set to something other than "NONE") #2103
+
+* Add routing tests from #1945 [ben@groovie.org]
+
+* Add a routing test case covering #2101 [Nicholas Seckar]
+
+* Cache relative_url_root for all webservers, not just Apache #2193 [skae]
+
+* Speed up cookie use by decreasing string copying #2194 [skae]
+
+* Fixed access to "Host" header with requests made by crappy old HTTP/1.0 clients #2124 [Marcel Molina]
+
+* Added easy assignment of fragment cache store through use of symbols for included stores (old way still works too)
+
+ Before:
+ ActionController::Base.fragment_cache_store =
+ ActionController::Base::Caching::Fragments::FileStore.new("/path/to/cache/directory")
+
+ After:
+ ActionController::Base.fragment_cache_store = :file_store, "/path/to/cache/directory"
+
+* Added ActionController::Base.session_store=, session_store, and session_options to make it easier to tweak the session options (instead of going straight to ActionController::CgiRequest::DEFAULT_SESSION_OPTIONS)
+
+* Added TextHelper#cycle to cycle over an array of values on each hit (useful for alternating row colors etc) #2154 [dave-ml@dribin.org]
+
+* Ensure that request.path never returns nil. Closes #1675 [Nicholas Seckar]
+
+* Add ability to specify Route Regexps for controllers. Closes #1917. [Sebastian Kanthak]
+
+* Provide Named Route's hash methods as helper methods. Closes #1744. [Nicholas Seckar, Steve Purcell]
+
+* Added :multipart option to ActiveRecordHelper#form to make it possible to add file input fields #2034 [jstirk@oobleyboo.com]
+
+* Moved auto-completion and in-place editing into the Macros module and their helper counterparts into JavaScriptMacrosHelper
+
+* Added in-place editing support in the spirit of auto complete with ActionController::Base.in_place_edit_for, JavascriptHelper#in_place_editor_field, and Javascript support from script.aculo.us #2038 [Jon Tirsen]
+
+* Added :disabled option to all data selects that'll make the elements inaccessible for change #2167, #253 [eigentone]
+
+* Fixed that TextHelper#auto_link_urls would include punctuation in the links #2166, #1671 [eigentone]
+
+* Fixed that number_to_currency(1000, {:precision => 0})) should return "$1,000", instead of "$1,000." #2122 [sd@notso.net]
+
+* Allow link_to_remote to use any DOM-element as the parent of the form elements to be submitted #2137 [erik@ruby-lang.nl]. Example:
+
+
+
+
+ <%= link_to_remote 'Save', :update => "row023",
+ :submit => "row023", :url => {:action => 'save_row'} %>
+
+
+* Fixed that render :partial would fail when :object was a Hash (due to backwards compatibility issues) #2148 [Sam Stephenson]
+
+* Fixed JavascriptHelper#auto_complete_for to only include unique items #2153 [Thomas Fuchs]
+
+* Fixed all AssetHelper methods to work with relative paths, such that javascript_include_tag('stdlib/standard') will look in /javascripts/stdlib/standard instead of '/stdlib/standard/' #1963
+
+* Avoid extending view instance with helper modules each request. Closes #1979
+
+* Performance improvements to CGI methods. Closes #1980 [Skaes]
+
+* Added :post option to UrlHelper#link_to that makes it possible to do POST requests through normal ahref links using Javascript
+
+* Fixed overwrite_params
+
+* Added ActionController::Base.benchmark and ActionController::Base.silence to allow for easy benchmarking and turning off the log
+
+* Updated vendor copy of html-scanner to support better xml parsing
+
+* Added :popup option to UrlHelper#link_to #1996 [gabriel.gironda@gmail.com]. Examples:
+
+ link_to "Help", { :action => "help" }, :popup => true
+ link_to "Busy loop", { :action => "busy" }, :popup => ['new_window', 'height=300,width=600']
+
+* Drop trailing \000 if present on RAW_POST_DATA (works around bug in Safari Ajax implementation) #918
+
+* Fix observe_field to fall back to event-based observation if frequency <= 0 #1916 [michael@schubert.cx]
+
+* Allow use of the :with option for submit_to_remote #1936 [jon@instance-design.co.uk]
+
+* AbstractRequest#domain returns nil when host is an ip address #2012 [kevin.clark@gmail.com]
+
+* ActionController documentation update #2051 [fbeausoleil@ftml.net]
+
+* Yield @content_for_ variables to templates #2058 [Sam Stephenson]
+
+* Make rendering an empty partial collection behave like :nothing => true #2080 [Sam Stephenson]
+
+* Add option to specify the singular name used by pagination.
+
+* Use string key to obtain action value. Allows indifferent hashes to be disabled.
+
+* Added ActionView::Base.cache_template_loading back.
+
+* Rewrote compiled templates to decrease code complexity. Removed template load caching in favour of compiled caching. Fixed template error messages. [Nicholas Seckar]
+
+* Fix Routing to handle :some_param => nil better. [Nicholas Seckar, Luminas]
+
+* Add support for :include with pagination (subject to existing constraints for :include with :limit and :offset) #1478 [michael@schubert.cx]
+
+* Prevent the benchmark module from blowing up if a non-HTTP/1.1 request is processed
+
+* Added :use_short_month option to select_month helper to show month names as abbreviations
+
+* Make link_to escape the javascript in the confirm option #1964 [nicolas.pouillard@gmail.com]
+
+* Make assert_redirected_to properly check URL's passed as strings #1910 [Scott Barron]
+
+* Make sure :layout => false is always used when rendering inside a layout
+
+* Use raise instead of assert_not_nil in Test::Unit::TestCase#process to ensure that the test variables (controller, request, response) have been set
+
+* Make sure assigns are built for every request when testing #1866
+
+* Allow remote_addr to be queried on TestRequest #1668
+
+* Fixed bug when a partial render was passing a local with the same name as the partial
+
+* Improved performance of test app req/sec with ~10% refactoring the render method #1823 [Stefan Kaes]
+
+* Improved performance of test app req/sec with 5-30% through a series of Action Pack optimizations #1811 [Stefan Kaes]
+
+* Changed caching/expiration/hit to report using the DEBUG log level and errors to use the ERROR log level instead of both using INFO
+
+* Added support for per-action session management #1763
+
+* Improved rendering speed on complicated templates by up to 100% (the more complex the templates, the higher the speedup) #1234 [Stephan Kaes]. This did necessasitate a change to the internals of ActionView#render_template that now has four parameters. Developers of custom view handlers (like Amrita) need to update for that.
+
+* Added options hash as third argument to FormHelper#input, so you can do input('person', 'zip', :size=>10) #1719 [jeremye@bsa.ca.gov]
+
+* Added Base#expires_in(seconds)/Base#expires_now to control HTTP content cache headers #1755 [Thomas Fuchs]
+
+* Fixed line number reporting for Builder template errors #1753 [piotr]
+
+* Fixed assert_routing so that testing controllers in modules works as expected [Nicholas Seckar, Rick Olson]
+
+* Fixed bug with :success/:failure callbacks for the JavaScriptHelper methods #1730 [court3nay/Thomas Fuchs]
+
+* Added named_route method to RouteSet instances so that RouteSet instance methods do not prevent certain names from being used. [Nicholas Seckar]
+
+* Fixed routes so that routes which do not specify :action in the path or in the requirements have a default of :action => 'index', In addition, fixed url generation so that :action => 'index' does not need to be provided for such urls. [Nicholas Seckar, Markjuh]
+
+* Worked around a Safari bug where it wouldn't pass headers through if the response was zero length by having render :nothing return ' ' instead of ''
+
+* Fixed Request#subdomains to handle "foo.foo.com" correctly
+
+
+*1.9.1* (11 July, 2005)
+
+* Fixed that auto_complete_for didn't force the input string to lower case even as the db comparison was
+
+* Fixed that Action View should always use the included Builder, never attempt to require the gem, to ensure compatibility
+
+* Added that nil options are not included in tags, so tag("p", :ignore => nil) now returns
not
but that tag("p", :ignore => "") still includes it #1465 [michael@schuerig.de]
+
+* Fixed that UrlHelper#link_to_unless/link_to_if used html_escape on the name if no link was to be applied. This is unnecessary and breaks its use with images #1649 [joergd@pobox.com]
+
+* Improved error message for DoubleRenderError
+
+* Fixed routing to allow for testing of *path components #1650 [Nicholas Seckar]
+
+* Added :handle as an option to sortable_element to restrict the drag handle to a given class #1642 [thejohnny]
+
+* Added a bunch of script.aculo.us features #1644, #1677, #1695 [Thomas Fuchs]
+ * Effect.ScrollTo, to smoothly scroll the page to an element
+ * Better Firefox flickering handling on SlideUp/SlideDown
+ * Removed a possible memory leak in IE with draggables
+ * Added support for cancelling dragging my hitting ESC
+ * Added capability to remove draggables/droppables and redeclare sortables in dragdrop.js (this makes it possible to call sortable_element on the same element more than once, e.g. in AJAX returns that modify the sortable element. all current sortable 'stuff' on the element will be discarded and the sortable will be rebuilt)
+ * Always reset background color on Effect.Highlight; this make change backwards-compatibility, to be sure include style="background-color:(target-color)" on your elements or else elements will fall back to their CSS rules (which is a good thing in most circumstances)
+ * Removed circular references from element to prevent memory leaks (still not completely gone in IE)
+ * Changes to class extension in effects.js
+ * Make Effect.Highlight restore any previously set background color when finishing (makes effect work with CSS classes that set a background color)
+ * Fixed myriads of memory leaks in IE and Gecko-based browsers [David Zülke]
+ * Added incremental and local autocompleting and loads of documentation to controls.js [Ivan Krstic]
+ * Extended the auto_complete_field helper to accept tokens option
+ * Changed object extension mechanism to favor Object.extend to make script.aculo.us easily adaptable to support 3rd party libs like IE7.js [David Zülke]
+
+* Fixed that named routes didn't use the default values for action and possible other parameters #1534 [Nicholas Seckar]
+
+* Fixed JavascriptHelper#visual_effect to use camelize such that :blind_up will work #1639 [pelletierm@eastmedia.net]
+
+* Fixed that a SessionRestoreError was thrown if a model object was placed in the session that wasn't available to all controllers. This means that it's no longer necessary to use the 'model :post' work-around in ApplicationController to have a Post model in your session.
+
+
+*1.9.0* (6 July, 2005)
+
+* Added logging of the request URI in the benchmark statement (makes it easy to grep for slow actions)
+
+* Added javascript_include_tag :defaults shortcut that'll include all the default javascripts included with Action Pack (prototype, effects, controls, dragdrop)
+
+* Cache several controller variables that are expensive to calculate #1229 [skaes@web.de]
+
+* The session class backing CGI::Session::ActiveRecordStore may be replaced with any class that duck-types with a subset of Active Record. See docs for details #1238 [skaes@web.de]
+
+* Fixed that hashes was not working properly when passed by GET to lighttpd #849 [Nicholas Seckar]
+
+* Fixed assert_template nil will be true when no template was rendered #1565 [maceywj@telus.net]
+
+* Added :prompt option to FormOptions#select (and the users of it, like FormOptions#select_country etc) to create "Please select" style descriptors #1181 [Michael Schuerig]
+
+* Added JavascriptHelper#update_element_function, which returns a Javascript function (or expression) that'll update a DOM element according to the options passed #933 [mortonda@dgrmm.net]. Examples:
+
+ <%= update_element_function("products", :action => :insert, :position => :bottom, :content => "New product!
") %>
+
+ <% update_element_function("products", :action => :replace, :binding => binding) do %>
+ Product 1
+ Product 2
+ <% end %>
+
+* Added :field_name option to DateHelper#select_(year|month|day) to deviate from the year/month/day defaults #1266 [Marcel Molina]
+
+* Added JavascriptHelper#draggable_element and JavascriptHelper#drop_receiving_element to facilitate easy dragging and dropping through the script.aculo.us libraries #1578 [Thomas Fuchs]
+
+* Added that UrlHelper#mail_to will now also encode the default link title #749 [f.svehla@gmail.com]
+
+* Removed the default option of wrap=virtual on FormHelper#text_area to ensure XHTML compatibility #1300 [thomas@columbus.rr.com]
+
+* Adds the ability to include XML CDATA tags using Builder #1563 [Josh Knowles]. Example:
+
+ xml.cdata! "some text" # =>
+
+* Added evaluation of
+ #
+ # javascript_include_tag "xmlhr.js" # =>
+ #
+ #
+ # javascript_include_tag "common.javascript", "/elsewhere/cools" # =>
+ #
+ #
+ #
+ # javascript_include_tag "http://www.railsapplication.com/xmlhr" # =>
+ #
+ #
+ # javascript_include_tag "http://www.railsapplication.com/xmlhr.js" # =>
+ #
+ #
+ # javascript_include_tag :defaults # =>
+ #
+ #
+ # ...
+ #
+ #
+ # * = The application.js file is only referenced if it exists
+ #
+ # Though it's not really recommended practice, if you need to extend the default JavaScript set for any reason
+ # (e.g., you're going to be using a certain .js file in every action), then take a look at the register_javascript_include_default method.
+ #
+ # You can also include all javascripts in the javascripts directory using :all as the source:
+ #
+ # javascript_include_tag :all # =>
+ #
+ #
+ # ...
+ #
+ #
+ #
+ #
+ # Note that the default javascript files will be included first. So Prototype and Scriptaculous are available to
+ # all subsequently included files.
+ #
+ # == Caching multiple javascripts into one
+ #
+ # You can also cache multiple javascripts into one file, which requires less HTTP connections to download and can better be
+ # compressed by gzip (leading to faster transfers). Caching will only happen if ActionController::Base.perform_caching
+ # is set to true (which is the case by default for the Rails production environment, but not for the development
+ # environment).
+ #
+ # ==== Examples
+ # javascript_include_tag :all, :cache => true # when ActionController::Base.perform_caching is false =>
+ #
+ #
+ # ...
+ #
+ #
+ #
+ #
+ # javascript_include_tag :all, :cache => true # when ActionController::Base.perform_caching is true =>
+ #
+ #
+ # javascript_include_tag "prototype", "cart", "checkout", :cache => "shop" # when ActionController::Base.perform_caching is false =>
+ #
+ #
+ #
+ #
+ # javascript_include_tag "prototype", "cart", "checkout", :cache => "shop" # when ActionController::Base.perform_caching is false =>
+ #
+ def javascript_include_tag(*sources)
+ options = sources.extract_options!.stringify_keys
+ cache = options.delete("cache")
+
+ if ActionController::Base.perform_caching && cache
+ joined_javascript_name = (cache == true ? "all" : cache) + ".js"
+ joined_javascript_path = File.join(JAVASCRIPTS_DIR, joined_javascript_name)
+
+ write_asset_file_contents(joined_javascript_path, compute_javascript_paths(sources))
+ javascript_src_tag(joined_javascript_name, options)
+ else
+ expand_javascript_sources(sources).collect { |source| javascript_src_tag(source, options) }.join("\n")
+ end
+ end
+
+ # Register one or more additional JavaScript files to be included when
+ # javascript_include_tag :defaults is called. This method is
+ # typically intended to be called from plugin initialization to register additional
+ # .js files that the plugin installed in public/javascripts .
+ def self.register_javascript_include_default(*sources)
+ @@javascript_default_sources.concat(sources)
+ end
+
+ def self.reset_javascript_include_default #:nodoc:
+ @@javascript_default_sources = JAVASCRIPT_DEFAULT_SOURCES.dup
+ end
+
+ # Computes the path to a stylesheet asset in the public stylesheets directory.
+ # If the +source+ filename has no extension, .css will be appended.
+ # Full paths from the document root will be passed through.
+ # Used internally by stylesheet_link_tag to build the stylesheet path.
+ #
+ # ==== Examples
+ # stylesheet_path "style" # => /stylesheets/style.css
+ # stylesheet_path "dir/style.css" # => /stylesheets/dir/style.css
+ # stylesheet_path "/dir/style.css" # => /dir/style.css
+ # stylesheet_path "http://www.railsapplication.com/css/style" # => http://www.railsapplication.com/css/style.css
+ # stylesheet_path "http://www.railsapplication.com/css/style.js" # => http://www.railsapplication.com/css/style.css
+ def stylesheet_path(source)
+ compute_public_path(source, 'stylesheets', 'css')
+ end
+ alias_method :path_to_stylesheet, :stylesheet_path # aliased to avoid conflicts with a stylesheet_path named route
+
+ # Returns a stylesheet link tag for the sources specified as arguments. If
+ # you don't specify an extension, .css will be appended automatically.
+ # You can modify the link attributes by passing a hash as the last argument.
+ #
+ # ==== Examples
+ # stylesheet_link_tag "style" # =>
+ #
+ #
+ # stylesheet_link_tag "style.css" # =>
+ #
+ #
+ # stylesheet_link_tag "http://www.railsapplication.com/style.css" # =>
+ #
+ #
+ # stylesheet_link_tag "style", :media => "all" # =>
+ #
+ #
+ # stylesheet_link_tag "style", :media => "print" # =>
+ #
+ #
+ # stylesheet_link_tag "random.styles", "/css/stylish" # =>
+ #
+ #
+ #
+ # You can also include all styles in the stylesheet directory using :all as the source:
+ #
+ # stylesheet_link_tag :all # =>
+ #
+ #
+ #
+ #
+ # == Caching multiple stylesheets into one
+ #
+ # You can also cache multiple stylesheets into one file, which requires less HTTP connections and can better be
+ # compressed by gzip (leading to faster transfers). Caching will only happen if ActionController::Base.perform_caching
+ # is set to true (which is the case by default for the Rails production environment, but not for the development
+ # environment). Examples:
+ #
+ # ==== Examples
+ # stylesheet_link_tag :all, :cache => true # when ActionController::Base.perform_caching is false =>
+ #
+ #
+ #
+ #
+ # stylesheet_link_tag :all, :cache => true # when ActionController::Base.perform_caching is true =>
+ #
+ #
+ # stylesheet_link_tag "shop", "cart", "checkout", :cache => "payment" # when ActionController::Base.perform_caching is false =>
+ #
+ #
+ #
+ #
+ # stylesheet_link_tag "shop", "cart", "checkout", :cache => "payment" # when ActionController::Base.perform_caching is true =>
+ #
+ def stylesheet_link_tag(*sources)
+ options = sources.extract_options!.stringify_keys
+ cache = options.delete("cache")
+
+ if ActionController::Base.perform_caching && cache
+ joined_stylesheet_name = (cache == true ? "all" : cache) + ".css"
+ joined_stylesheet_path = File.join(STYLESHEETS_DIR, joined_stylesheet_name)
+
+ write_asset_file_contents(joined_stylesheet_path, compute_stylesheet_paths(sources))
+ stylesheet_tag(joined_stylesheet_name, options)
+ else
+ expand_stylesheet_sources(sources).collect { |source| stylesheet_tag(source, options) }.join("\n")
+ end
+ end
+
+ # Computes the path to an image asset in the public images directory.
+ # Full paths from the document root will be passed through.
+ # Used internally by image_tag to build the image path.
+ #
+ # ==== Examples
+ # image_path("edit") # => /images/edit
+ # image_path("edit.png") # => /images/edit.png
+ # image_path("icons/edit.png") # => /images/icons/edit.png
+ # image_path("/icons/edit.png") # => /icons/edit.png
+ # image_path("http://www.railsapplication.com/img/edit.png") # => http://www.railsapplication.com/img/edit.png
+ def image_path(source)
+ compute_public_path(source, 'images')
+ end
+ alias_method :path_to_image, :image_path # aliased to avoid conflicts with an image_path named route
+
+ # Returns an html image tag for the +source+. The +source+ can be a full
+ # path or a file that exists in your public images directory.
+ #
+ # ==== Options
+ # You can add HTML attributes using the +options+. The +options+ supports
+ # three additional keys for convenience and conformance:
+ #
+ # * :alt - If no alt text is given, the file name part of the
+ # +source+ is used (capitalized and without the extension)
+ # * :size - Supplied as "{Width}x{Height}", so "30x45" becomes
+ # width="30" and height="45". :size will be ignored if the
+ # value is not in the correct format.
+ # * :mouseover - Set an alternate image to be used when the onmouseover
+ # event is fired, and sets the original image to be replaced onmouseout.
+ # This can be used to implement an easy image toggle that fires on onmouseover.
+ #
+ # ==== Examples
+ # image_tag("icon") # =>
+ #
+ # image_tag("icon.png") # =>
+ #
+ # image_tag("icon.png", :size => "16x10", :alt => "Edit Entry") # =>
+ #
+ # image_tag("/icons/icon.gif", :size => "16x16") # =>
+ #
+ # image_tag("/icons/icon.gif", :height => '32', :width => '32') # =>
+ #
+ # image_tag("/icons/icon.gif", :class => "menu_icon") # =>
+ #
+ # image_tag("mouse.png", :mouseover => "/images/mouse_over.png") # =>
+ #
+ # image_tag("mouse.png", :mouseover => image_path("mouse_over.png")) # =>
+ #
+ def image_tag(source, options = {})
+ options.symbolize_keys!
+
+ options[:src] = path_to_image(source)
+ options[:alt] ||= File.basename(options[:src], '.*').split('.').first.capitalize
+
+ if size = options.delete(:size)
+ options[:width], options[:height] = size.split("x") if size =~ %r{^\d+x\d+$}
+ end
+
+ if mouseover = options.delete(:mouseover)
+ options[:onmouseover] = "this.src='#{image_path(mouseover)}'"
+ options[:onmouseout] = "this.src='#{image_path(options[:src])}'"
+ end
+
+ tag("img", options)
+ end
+
+ private
+ def file_exist?(path)
+ @@file_exist_cache ||= {}
+ if !(@@file_exist_cache[path] ||= File.exist?(path))
+ @@file_exist_cache[path] = true
+ false
+ else
+ true
+ end
+ end
+
+ # Add the .ext if not present. Return full URLs otherwise untouched.
+ # Prefix with /dir/ if lacking a leading /. Account for relative URL
+ # roots. Rewrite the asset path for cache-busting asset ids. Include
+ # asset host, if configured, with the correct request protocol.
+ def compute_public_path(source, dir, ext = nil, include_host = true)
+ has_request = @controller.respond_to?(:request)
+
+ cache_key =
+ if has_request
+ [ @controller.request.protocol,
+ ActionController::Base.asset_host.to_s,
+ @controller.request.relative_url_root,
+ dir, source, ext, include_host ].join
+ else
+ [ ActionController::Base.asset_host.to_s,
+ dir, source, ext, include_host ].join
+ end
+
+ ActionView::Base.computed_public_paths[cache_key] ||=
+ begin
+ source += ".#{ext}" if File.extname(source).blank? && ext
+
+ if source =~ %r{^[-a-z]+://}
+ source
+ else
+ source = "/#{dir}/#{source}" unless source[0] == ?/
+ if has_request
+ source = "#{@controller.request.relative_url_root}#{source}"
+ end
+ rewrite_asset_path!(source)
+
+ if include_host
+ host = compute_asset_host(source)
+
+ if has_request && !host.blank? && host !~ %r{^[-a-z]+://}
+ host = "#{@controller.request.protocol}#{host}"
+ end
+
+ "#{host}#{source}"
+ else
+ source
+ end
+ end
+ end
+ end
+
+ # Pick an asset host for this source. Returns nil if no host is set,
+ # the host if no wildcard is set, the host interpolated with the
+ # numbers 0-3 if it contains %d (the number is the source hash mod 4),
+ # or the value returned from invoking the proc if it's a proc.
+ def compute_asset_host(source)
+ if host = ActionController::Base.asset_host
+ if host.is_a?(Proc)
+ host.call(source)
+ else
+ host % (source.hash % 4)
+ end
+ end
+ end
+
+ # Use the RAILS_ASSET_ID environment variable or the source's
+ # modification time as its cache-busting asset id.
+ def rails_asset_id(source)
+ if asset_id = ENV["RAILS_ASSET_ID"]
+ asset_id
+ else
+ path = File.join(ASSETS_DIR, source)
+
+ if File.exist?(path)
+ File.mtime(path).to_i.to_s
+ else
+ ''
+ end
+ end
+ end
+
+ # Break out the asset path rewrite so you wish to put the asset id
+ # someplace other than the query string.
+ def rewrite_asset_path!(source)
+ asset_id = rails_asset_id(source)
+ source << "?#{asset_id}" if !asset_id.blank?
+ end
+
+ def javascript_src_tag(source, options)
+ content_tag("script", "", { "type" => Mime::JS, "src" => path_to_javascript(source) }.merge(options))
+ end
+
+ def stylesheet_tag(source, options)
+ tag("link", { "rel" => "stylesheet", "type" => Mime::CSS, "media" => "screen", "href" => html_escape(path_to_stylesheet(source)) }.merge(options), false, false)
+ end
+
+ def compute_javascript_paths(sources)
+ expand_javascript_sources(sources).collect { |source| compute_public_path(source, 'javascripts', 'js', false) }
+ end
+
+ def compute_stylesheet_paths(sources)
+ expand_stylesheet_sources(sources).collect { |source| compute_public_path(source, 'stylesheets', 'css', false) }
+ end
+
+ def expand_javascript_sources(sources)
+ case
+ when sources.include?(:all)
+ all_javascript_files = Dir[File.join(JAVASCRIPTS_DIR, '*.js')].collect { |file| File.basename(file).split(".", 0).first }.sort
+ sources = ((@@javascript_default_sources.dup & all_javascript_files) + all_javascript_files).uniq
+
+ when sources.include?(:defaults)
+ sources = sources[0..(sources.index(:defaults))] +
+ @@javascript_default_sources.dup +
+ sources[(sources.index(:defaults) + 1)..sources.length]
+
+ sources.delete(:defaults)
+ sources << "application" if file_exist?(File.join(JAVASCRIPTS_DIR, "application.js"))
+ end
+
+ sources
+ end
+
+ def expand_stylesheet_sources(sources)
+ if sources.first == :all
+ @@all_stylesheet_sources ||= Dir[File.join(STYLESHEETS_DIR, '*.css')].collect { |file| File.basename(file).split(".", 1).first }.sort
+ else
+ sources
+ end
+ end
+
+ def join_asset_file_contents(paths)
+ paths.collect { |path| File.read(File.join(ASSETS_DIR, path.split("?").first)) }.join("\n\n")
+ end
+
+ def write_asset_file_contents(joined_asset_path, asset_paths)
+ unless file_exist?(joined_asset_path)
+ FileUtils.mkdir_p(File.dirname(joined_asset_path))
+ File.open(joined_asset_path, "w+") { |cache| cache.write(join_asset_file_contents(asset_paths)) }
+ end
+ end
+ end
+ end
+end
diff --git a/vendor/rails-2.0.2/actionpack/lib/action_view/helpers/atom_feed_helper.rb b/vendor/rails-2.0.2/actionpack/lib/action_view/helpers/atom_feed_helper.rb
new file mode 100644
index 000000000..c3ceecbf5
--- /dev/null
+++ b/vendor/rails-2.0.2/actionpack/lib/action_view/helpers/atom_feed_helper.rb
@@ -0,0 +1,111 @@
+# Adds easy defaults to writing Atom feeds with the Builder template engine (this does not work on ERb or any other
+# template languages).
+module ActionView
+ module Helpers #:nodoc:
+ module AtomFeedHelper
+ # Full usage example:
+ #
+ # config/routes.rb:
+ # ActionController::Routing::Routes.draw do |map|
+ # map.resources :posts
+ # map.root :controller => "posts"
+ # end
+ #
+ # app/controllers/posts_controller.rb:
+ # class PostsController < ApplicationController::Base
+ # # GET /posts.html
+ # # GET /posts.atom
+ # def index
+ # @posts = Post.find(:all)
+ #
+ # respond_to do |format|
+ # format.html
+ # format.atom
+ # end
+ # end
+ # end
+ #
+ # app/views/posts/index.atom.builder:
+ # atom_feed do |feed|
+ # feed.title("My great blog!")
+ # feed.updated((@posts.first.created_at))
+ #
+ # for post in @posts
+ # feed.entry(post) do |entry|
+ # entry.title(post.title)
+ # entry.content(post.body, :type => 'html')
+ #
+ # entry.author do |author|
+ # author.name("DHH")
+ # end
+ # end
+ # end
+ # end
+ #
+ # The options are for atom_feed are:
+ #
+ # * :language : Defaults to "en-US".
+ # * :root_url : The HTML alternative that this feed is doubling for. Defaults to / on the current host.
+ # * :url : The URL for this feed. Defaults to the current URL.
+ #
+ # atom_feed yields a AtomFeedBuilder instance.
+ def atom_feed(options = {}, &block)
+ xml = options[:xml] || eval("xml", block.binding)
+ xml.instruct!
+
+ xml.feed "xml:lang" => options[:language] || "en-US", "xmlns" => 'http://www.w3.org/2005/Atom' do
+ xml.id("tag:#{request.host}:#{request.request_uri.split(".")[0].gsub("/", "")}")
+ xml.link(:rel => 'alternate', :type => 'text/html', :href => options[:root_url] || (request.protocol + request.host_with_port))
+
+ if options[:url]
+ xml.link(:rel => 'self', :type => 'application/atom+xml', :href => options[:url] || request.url)
+ end
+
+ yield AtomFeedBuilder.new(xml, self)
+ end
+ end
+
+
+ class AtomFeedBuilder
+ def initialize(xml, view)
+ @xml, @view = xml, view
+ end
+
+ # Accepts a Date or Time object and inserts it in the proper format. If nil is passed, current time in UTC is used.
+ def updated(date_or_time = nil)
+ @xml.updated((date_or_time || Time.now.utc).xmlschema)
+ end
+
+ # Creates an entry tag for a specific record and prefills the id using class and id.
+ #
+ # Options:
+ #
+ # * :updated : Time of update. Defaults to the created_at attribute on the record if one such exists.
+ # * :published : Time first published. Defaults to the updated_at attribute on the record if one such exists.
+ # * :url : The URL for this entry. Defaults to the polymorphic_url for the record.
+ def entry(record, options = {})
+ @xml.entry do
+ @xml.id("tag:#{@view.request.host_with_port}:#{record.class}#{record.id}")
+
+ if options[:published] || (record.respond_to?(:created_at) && record.created_at)
+ @xml.published((options[:published] || record.created_at).xmlschema)
+ end
+
+ if options[:updated] || (record.respond_to?(:updated_at) && record.updated_at)
+ @xml.updated((options[:updated] || record.updated_at).xmlschema)
+ end
+
+ @xml.link(:rel => 'alternate', :type => 'text/html', :href => options[:url] || @view.polymorphic_url(record))
+
+ yield @xml
+ end
+ end
+
+ private
+ def method_missing(method, *arguments)
+ @xml.__send__(method, *arguments)
+ end
+ end
+ end
+ end
+end
\ No newline at end of file
diff --git a/vendor/rails-2.0.2/actionpack/lib/action_view/helpers/benchmark_helper.rb b/vendor/rails-2.0.2/actionpack/lib/action_view/helpers/benchmark_helper.rb
new file mode 100644
index 000000000..fefa28f4d
--- /dev/null
+++ b/vendor/rails-2.0.2/actionpack/lib/action_view/helpers/benchmark_helper.rb
@@ -0,0 +1,31 @@
+require 'benchmark'
+
+module ActionView
+ module Helpers
+ # This helper offers a method to measure the execution time of a block
+ # in a template.
+ module BenchmarkHelper
+ # Allows you to measure the execution time of a block
+ # in a template and records the result to the log. Wrap this block around
+ # expensive operations or possible bottlenecks to get a time reading
+ # for the operation. For example, let's say you thought your file
+ # processing method was taking too long; you could wrap it in a benchmark block.
+ #
+ # <% benchmark "Process data files" do %>
+ # <%= expensive_files_operation %>
+ # <% end %>
+ #
+ # That would add something like "Process data files (0.34523)" to the log,
+ # which you can then use to compare timings when optimizing your code.
+ #
+ # You may give an optional logger level as the second argument
+ # (:debug, :info, :warn, :error); the default value is :info.
+ def benchmark(message = "Benchmarking", level = :info)
+ if @logger
+ real = Benchmark.realtime { yield }
+ @logger.send level, "#{message} (#{'%.5f' % real})"
+ end
+ end
+ end
+ end
+end
diff --git a/vendor/rails-2.0.2/actionpack/lib/action_view/helpers/cache_helper.rb b/vendor/rails-2.0.2/actionpack/lib/action_view/helpers/cache_helper.rb
new file mode 100644
index 000000000..cf5420a35
--- /dev/null
+++ b/vendor/rails-2.0.2/actionpack/lib/action_view/helpers/cache_helper.rb
@@ -0,0 +1,39 @@
+module ActionView
+ module Helpers
+ # This helper to exposes a method for caching of view fragments.
+ # See ActionController::Caching::Fragments for usage instructions.
+ module CacheHelper
+ # A method for caching fragments of a view rather than an entire
+ # action or page. This technique is useful caching pieces like
+ # menus, lists of news topics, static HTML fragments, and so on.
+ # This method takes a block that contains the content you wish
+ # to cache. See ActionController::Caching::Fragments for more
+ # information.
+ #
+ # ==== Examples
+ # If you wanted to cache a navigation menu, you could do the
+ # following.
+ #
+ # <% cache do %>
+ # <%= render :partial => "menu" %>
+ # <% end %>
+ #
+ # You can also cache static content...
+ #
+ # <% cache do %>
+ # Hello users! Welcome to our website!
+ # <% end %>
+ #
+ # ...and static content mixed with RHTML content.
+ #
+ # <% cache do %>
+ # Topics:
+ # <%= render :partial => "topics", :collection => @topic_list %>
+ # Topics listed alphabetically
+ # <% end %>
+ def cache(name = {}, &block)
+ @controller.cache_erb_fragment(block, name)
+ end
+ end
+ end
+end
diff --git a/vendor/rails-2.0.2/actionpack/lib/action_view/helpers/capture_helper.rb b/vendor/rails-2.0.2/actionpack/lib/action_view/helpers/capture_helper.rb
new file mode 100644
index 000000000..fc8cd66d7
--- /dev/null
+++ b/vendor/rails-2.0.2/actionpack/lib/action_view/helpers/capture_helper.rb
@@ -0,0 +1,162 @@
+module ActionView
+ module Helpers
+ # CaptureHelper exposes methods to let you extract generated markup which
+ # can be used in other parts of a template or layout file.
+ # It provides a method to capture blocks into variables through capture and
+ # a way to capture a block of markup for use in a layout through content_for.
+ module CaptureHelper
+ # The capture method allows you to extract part of a template into a
+ # variable. You can then use this variable anywhere in your templates or layout.
+ #
+ # ==== Examples
+ # The capture method can be used in ERb templates...
+ #
+ # <% @greeting = capture do %>
+ # Welcome to my shiny new web page! The date and time is
+ # <%= Time.now %>
+ # <% end %>
+ #
+ # ...and Builder (RXML) templates.
+ #
+ # @timestamp = capture do
+ # "The current timestamp is #{Time.now}."
+ # end
+ #
+ # You can then use that variable anywhere else. For example:
+ #
+ #
+ # <%= @greeting %>
+ #
+ # <%= @greeting %>
+ #
+ #
+ def capture(*args, &block)
+ # execute the block
+ begin
+ buffer = eval(ActionView::Base.erb_variable, block.binding)
+ rescue
+ buffer = nil
+ end
+
+ if buffer.nil?
+ capture_block(*args, &block).to_s
+ else
+ capture_erb_with_buffer(buffer, *args, &block).to_s
+ end
+ end
+
+ # Calling content_for stores a block of markup in an identifier for later use.
+ # You can make subsequent calls to the stored content in other templates or the layout
+ # by passing the identifier as an argument to yield .
+ #
+ # ==== Examples
+ #
+ # <% content_for :not_authorized do %>
+ # alert('You are not authorized to do that!')
+ # <% end %>
+ #
+ # You can then use yield :not_authorized anywhere in your templates.
+ #
+ # <%= yield :not_authorized if current_user.nil? %>
+ #
+ # You can also use this syntax alongside an existing call to yield in a layout. For example:
+ #
+ # <%# This is the layout %>
+ #
+ #
+ # My Website
+ # <%= yield :script %>
+ #
+ #
+ # <%= yield %>
+ #
+ #
+ #
+ # And now, we'll create a view that has a content_for call that
+ # creates the script identifier.
+ #
+ # <%# This is our view %>
+ # Please login!
+ #
+ # <% content_for :script do %>
+ #
+ # <% end %>
+ #
+ # Then, in another view, you could to do something like this:
+ #
+ # <%= link_to_remote 'Logout', :action => 'logout' %>
+ #
+ # <% content_for :script do %>
+ # <%= javascript_include_tag :defaults %>
+ # <% end %>
+ #
+ # That will place '
+ end
+
+ # Escape carrier returns and single and double quotes for JavaScript segments.
+ def escape_javascript(javascript)
+ (javascript || '').gsub('\\','\0\0').gsub('','<\/').gsub(/\r\n|\n|\r/, "\\n").gsub(/["']/) { |m| "\\#{m}" }
+ end
+
+ # Returns a JavaScript tag with the +content+ inside. Example:
+ # javascript_tag "alert('All is good')"
+ #
+ # Returns:
+ #
+ #
+ # +html_options+ may be a hash of attributes for the
+ #
+ # Instead of passing the content as an argument, you can also use a block
+ # in which case, you pass your +html_options+ as the first parameter.
+ # <% javascript_tag :defer => 'defer' do -%>
+ # alert('All is good')
+ # <% end -%>
+ def javascript_tag(content_or_options_with_block = nil, html_options = {}, &block)
+ if block_given?
+ html_options = content_or_options_with_block if content_or_options_with_block.is_a?(Hash)
+ content = capture(&block)
+ else
+ content = content_or_options_with_block
+ end
+
+ javascript_tag = content_tag("script", javascript_cdata_section(content), html_options.merge(:type => Mime::JS))
+
+ if block_given? && block_is_within_action_view?(block)
+ concat(javascript_tag, block.binding)
+ else
+ javascript_tag
+ end
+ end
+
+ def javascript_cdata_section(content) #:nodoc:
+ "\n//#{cdata_section("\n#{content}\n//")}\n"
+ end
+
+ protected
+ def options_for_javascript(options)
+ '{' + options.map {|k, v| "#{k}:#{v}"}.sort.join(', ') + '}'
+ end
+
+ def array_or_string_for_javascript(option)
+ js_option = if option.kind_of?(Array)
+ "['#{option.join('\',\'')}']"
+ elsif !option.nil?
+ "'#{option}'"
+ end
+ js_option
+ end
+
+ private
+ def block_is_within_action_view?(block)
+ eval("defined? _erbout", block.binding)
+ end
+ end
+
+ JavascriptHelper = JavaScriptHelper unless const_defined? :JavascriptHelper
+ end
+end
diff --git a/vendor/rails-2.0.2/actionpack/lib/action_view/helpers/javascripts/controls.js b/vendor/rails-2.0.2/actionpack/lib/action_view/helpers/javascripts/controls.js
new file mode 100644
index 000000000..fbc4418b8
--- /dev/null
+++ b/vendor/rails-2.0.2/actionpack/lib/action_view/helpers/javascripts/controls.js
@@ -0,0 +1,963 @@
+// Copyright (c) 2005-2007 Thomas Fuchs (http://script.aculo.us, http://mir.aculo.us)
+// (c) 2005-2007 Ivan Krstic (http://blogs.law.harvard.edu/ivan)
+// (c) 2005-2007 Jon Tirsen (http://www.tirsen.com)
+// Contributors:
+// Richard Livsey
+// Rahul Bhargava
+// Rob Wills
+//
+// script.aculo.us is freely distributable under the terms of an MIT-style license.
+// For details, see the script.aculo.us web site: http://script.aculo.us/
+
+// Autocompleter.Base handles all the autocompletion functionality
+// that's independent of the data source for autocompletion. This
+// includes drawing the autocompletion menu, observing keyboard
+// and mouse events, and similar.
+//
+// Specific autocompleters need to provide, at the very least,
+// a getUpdatedChoices function that will be invoked every time
+// the text inside the monitored textbox changes. This method
+// should get the text for which to provide autocompletion by
+// invoking this.getToken(), NOT by directly accessing
+// this.element.value. This is to allow incremental tokenized
+// autocompletion. Specific auto-completion logic (AJAX, etc)
+// belongs in getUpdatedChoices.
+//
+// Tokenized incremental autocompletion is enabled automatically
+// when an autocompleter is instantiated with the 'tokens' option
+// in the options parameter, e.g.:
+// new Ajax.Autocompleter('id','upd', '/url/', { tokens: ',' });
+// will incrementally autocomplete with a comma as the token.
+// Additionally, ',' in the above example can be replaced with
+// a token array, e.g. { tokens: [',', '\n'] } which
+// enables autocompletion on multiple tokens. This is most
+// useful when one of the tokens is \n (a newline), as it
+// allows smart autocompletion after linebreaks.
+
+if(typeof Effect == 'undefined')
+ throw("controls.js requires including script.aculo.us' effects.js library");
+
+var Autocompleter = { }
+Autocompleter.Base = Class.create({
+ baseInitialize: function(element, update, options) {
+ element = $(element)
+ this.element = element;
+ this.update = $(update);
+ this.hasFocus = false;
+ this.changed = false;
+ this.active = false;
+ this.index = 0;
+ this.entryCount = 0;
+ this.oldElementValue = this.element.value;
+
+ if(this.setOptions)
+ this.setOptions(options);
+ else
+ this.options = options || { };
+
+ this.options.paramName = this.options.paramName || this.element.name;
+ this.options.tokens = this.options.tokens || [];
+ this.options.frequency = this.options.frequency || 0.4;
+ this.options.minChars = this.options.minChars || 1;
+ this.options.onShow = this.options.onShow ||
+ function(element, update){
+ if(!update.style.position || update.style.position=='absolute') {
+ update.style.position = 'absolute';
+ Position.clone(element, update, {
+ setHeight: false,
+ offsetTop: element.offsetHeight
+ });
+ }
+ Effect.Appear(update,{duration:0.15});
+ };
+ this.options.onHide = this.options.onHide ||
+ function(element, update){ new Effect.Fade(update,{duration:0.15}) };
+
+ if(typeof(this.options.tokens) == 'string')
+ this.options.tokens = new Array(this.options.tokens);
+ // Force carriage returns as token delimiters anyway
+ if (!this.options.tokens.include('\n'))
+ this.options.tokens.push('\n');
+
+ this.observer = null;
+
+ this.element.setAttribute('autocomplete','off');
+
+ Element.hide(this.update);
+
+ Event.observe(this.element, 'blur', this.onBlur.bindAsEventListener(this));
+ Event.observe(this.element, 'keydown', this.onKeyPress.bindAsEventListener(this));
+ },
+
+ show: function() {
+ if(Element.getStyle(this.update, 'display')=='none') this.options.onShow(this.element, this.update);
+ if(!this.iefix &&
+ (Prototype.Browser.IE) &&
+ (Element.getStyle(this.update, 'position')=='absolute')) {
+ new Insertion.After(this.update,
+ '');
+ this.iefix = $(this.update.id+'_iefix');
+ }
+ if(this.iefix) setTimeout(this.fixIEOverlapping.bind(this), 50);
+ },
+
+ fixIEOverlapping: function() {
+ Position.clone(this.update, this.iefix, {setTop:(!this.update.style.height)});
+ this.iefix.style.zIndex = 1;
+ this.update.style.zIndex = 2;
+ Element.show(this.iefix);
+ },
+
+ hide: function() {
+ this.stopIndicator();
+ if(Element.getStyle(this.update, 'display')!='none') this.options.onHide(this.element, this.update);
+ if(this.iefix) Element.hide(this.iefix);
+ },
+
+ startIndicator: function() {
+ if(this.options.indicator) Element.show(this.options.indicator);
+ },
+
+ stopIndicator: function() {
+ if(this.options.indicator) Element.hide(this.options.indicator);
+ },
+
+ onKeyPress: function(event) {
+ if(this.active)
+ switch(event.keyCode) {
+ case Event.KEY_TAB:
+ case Event.KEY_RETURN:
+ this.selectEntry();
+ Event.stop(event);
+ case Event.KEY_ESC:
+ this.hide();
+ this.active = false;
+ Event.stop(event);
+ return;
+ case Event.KEY_LEFT:
+ case Event.KEY_RIGHT:
+ return;
+ case Event.KEY_UP:
+ this.markPrevious();
+ this.render();
+ Event.stop(event);
+ return;
+ case Event.KEY_DOWN:
+ this.markNext();
+ this.render();
+ Event.stop(event);
+ return;
+ }
+ else
+ if(event.keyCode==Event.KEY_TAB || event.keyCode==Event.KEY_RETURN ||
+ (Prototype.Browser.WebKit > 0 && event.keyCode == 0)) return;
+
+ this.changed = true;
+ this.hasFocus = true;
+
+ if(this.observer) clearTimeout(this.observer);
+ this.observer =
+ setTimeout(this.onObserverEvent.bind(this), this.options.frequency*1000);
+ },
+
+ activate: function() {
+ this.changed = false;
+ this.hasFocus = true;
+ this.getUpdatedChoices();
+ },
+
+ onHover: function(event) {
+ var element = Event.findElement(event, 'LI');
+ if(this.index != element.autocompleteIndex)
+ {
+ this.index = element.autocompleteIndex;
+ this.render();
+ }
+ Event.stop(event);
+ },
+
+ onClick: function(event) {
+ var element = Event.findElement(event, 'LI');
+ this.index = element.autocompleteIndex;
+ this.selectEntry();
+ this.hide();
+ },
+
+ onBlur: function(event) {
+ // needed to make click events working
+ setTimeout(this.hide.bind(this), 250);
+ this.hasFocus = false;
+ this.active = false;
+ },
+
+ render: function() {
+ if(this.entryCount > 0) {
+ for (var i = 0; i < this.entryCount; i++)
+ this.index==i ?
+ Element.addClassName(this.getEntry(i),"selected") :
+ Element.removeClassName(this.getEntry(i),"selected");
+ if(this.hasFocus) {
+ this.show();
+ this.active = true;
+ }
+ } else {
+ this.active = false;
+ this.hide();
+ }
+ },
+
+ markPrevious: function() {
+ if(this.index > 0) this.index--
+ else this.index = this.entryCount-1;
+ this.getEntry(this.index).scrollIntoView(true);
+ },
+
+ markNext: function() {
+ if(this.index < this.entryCount-1) this.index++
+ else this.index = 0;
+ this.getEntry(this.index).scrollIntoView(false);
+ },
+
+ getEntry: function(index) {
+ return this.update.firstChild.childNodes[index];
+ },
+
+ getCurrentEntry: function() {
+ return this.getEntry(this.index);
+ },
+
+ selectEntry: function() {
+ this.active = false;
+ this.updateElement(this.getCurrentEntry());
+ },
+
+ updateElement: function(selectedElement) {
+ if (this.options.updateElement) {
+ this.options.updateElement(selectedElement);
+ return;
+ }
+ var value = '';
+ if (this.options.select) {
+ var nodes = $(selectedElement).select('.' + this.options.select) || [];
+ if(nodes.length>0) value = Element.collectTextNodes(nodes[0], this.options.select);
+ } else
+ value = Element.collectTextNodesIgnoreClass(selectedElement, 'informal');
+
+ var bounds = this.getTokenBounds();
+ if (bounds[0] != -1) {
+ var newValue = this.element.value.substr(0, bounds[0]);
+ var whitespace = this.element.value.substr(bounds[0]).match(/^\s+/);
+ if (whitespace)
+ newValue += whitespace[0];
+ this.element.value = newValue + value + this.element.value.substr(bounds[1]);
+ } else {
+ this.element.value = value;
+ }
+ this.oldElementValue = this.element.value;
+ this.element.focus();
+
+ if (this.options.afterUpdateElement)
+ this.options.afterUpdateElement(this.element, selectedElement);
+ },
+
+ updateChoices: function(choices) {
+ if(!this.changed && this.hasFocus) {
+ this.update.innerHTML = choices;
+ Element.cleanWhitespace(this.update);
+ Element.cleanWhitespace(this.update.down());
+
+ if(this.update.firstChild && this.update.down().childNodes) {
+ this.entryCount =
+ this.update.down().childNodes.length;
+ for (var i = 0; i < this.entryCount; i++) {
+ var entry = this.getEntry(i);
+ entry.autocompleteIndex = i;
+ this.addObservers(entry);
+ }
+ } else {
+ this.entryCount = 0;
+ }
+
+ this.stopIndicator();
+ this.index = 0;
+
+ if(this.entryCount==1 && this.options.autoSelect) {
+ this.selectEntry();
+ this.hide();
+ } else {
+ this.render();
+ }
+ }
+ },
+
+ addObservers: function(element) {
+ Event.observe(element, "mouseover", this.onHover.bindAsEventListener(this));
+ Event.observe(element, "click", this.onClick.bindAsEventListener(this));
+ },
+
+ onObserverEvent: function() {
+ this.changed = false;
+ this.tokenBounds = null;
+ if(this.getToken().length>=this.options.minChars) {
+ this.getUpdatedChoices();
+ } else {
+ this.active = false;
+ this.hide();
+ }
+ this.oldElementValue = this.element.value;
+ },
+
+ getToken: function() {
+ var bounds = this.getTokenBounds();
+ return this.element.value.substring(bounds[0], bounds[1]).strip();
+ },
+
+ getTokenBounds: function() {
+ if (null != this.tokenBounds) return this.tokenBounds;
+ var value = this.element.value;
+ if (value.strip().empty()) return [-1, 0];
+ var diff = arguments.callee.getFirstDifferencePos(value, this.oldElementValue);
+ var offset = (diff == this.oldElementValue.length ? 1 : 0);
+ var prevTokenPos = -1, nextTokenPos = value.length;
+ var tp;
+ for (var index = 0, l = this.options.tokens.length; index < l; ++index) {
+ tp = value.lastIndexOf(this.options.tokens[index], diff + offset - 1);
+ if (tp > prevTokenPos) prevTokenPos = tp;
+ tp = value.indexOf(this.options.tokens[index], diff + offset);
+ if (-1 != tp && tp < nextTokenPos) nextTokenPos = tp;
+ }
+ return (this.tokenBounds = [prevTokenPos + 1, nextTokenPos]);
+ }
+});
+
+Autocompleter.Base.prototype.getTokenBounds.getFirstDifferencePos = function(newS, oldS) {
+ var boundary = Math.min(newS.length, oldS.length);
+ for (var index = 0; index < boundary; ++index)
+ if (newS[index] != oldS[index])
+ return index;
+ return boundary;
+};
+
+Ajax.Autocompleter = Class.create(Autocompleter.Base, {
+ initialize: function(element, update, url, options) {
+ this.baseInitialize(element, update, options);
+ this.options.asynchronous = true;
+ this.options.onComplete = this.onComplete.bind(this);
+ this.options.defaultParams = this.options.parameters || null;
+ this.url = url;
+ },
+
+ getUpdatedChoices: function() {
+ this.startIndicator();
+
+ var entry = encodeURIComponent(this.options.paramName) + '=' +
+ encodeURIComponent(this.getToken());
+
+ this.options.parameters = this.options.callback ?
+ this.options.callback(this.element, entry) : entry;
+
+ if(this.options.defaultParams)
+ this.options.parameters += '&' + this.options.defaultParams;
+
+ new Ajax.Request(this.url, this.options);
+ },
+
+ onComplete: function(request) {
+ this.updateChoices(request.responseText);
+ }
+});
+
+// The local array autocompleter. Used when you'd prefer to
+// inject an array of autocompletion options into the page, rather
+// than sending out Ajax queries, which can be quite slow sometimes.
+//
+// The constructor takes four parameters. The first two are, as usual,
+// the id of the monitored textbox, and id of the autocompletion menu.
+// The third is the array you want to autocomplete from, and the fourth
+// is the options block.
+//
+// Extra local autocompletion options:
+// - choices - How many autocompletion choices to offer
+//
+// - partialSearch - If false, the autocompleter will match entered
+// text only at the beginning of strings in the
+// autocomplete array. Defaults to true, which will
+// match text at the beginning of any *word* in the
+// strings in the autocomplete array. If you want to
+// search anywhere in the string, additionally set
+// the option fullSearch to true (default: off).
+//
+// - fullSsearch - Search anywhere in autocomplete array strings.
+//
+// - partialChars - How many characters to enter before triggering
+// a partial match (unlike minChars, which defines
+// how many characters are required to do any match
+// at all). Defaults to 2.
+//
+// - ignoreCase - Whether to ignore case when autocompleting.
+// Defaults to true.
+//
+// It's possible to pass in a custom function as the 'selector'
+// option, if you prefer to write your own autocompletion logic.
+// In that case, the other options above will not apply unless
+// you support them.
+
+Autocompleter.Local = Class.create(Autocompleter.Base, {
+ initialize: function(element, update, array, options) {
+ this.baseInitialize(element, update, options);
+ this.options.array = array;
+ },
+
+ getUpdatedChoices: function() {
+ this.updateChoices(this.options.selector(this));
+ },
+
+ setOptions: function(options) {
+ this.options = Object.extend({
+ choices: 10,
+ partialSearch: true,
+ partialChars: 2,
+ ignoreCase: true,
+ fullSearch: false,
+ selector: function(instance) {
+ var ret = []; // Beginning matches
+ var partial = []; // Inside matches
+ var entry = instance.getToken();
+ var count = 0;
+
+ for (var i = 0; i < instance.options.array.length &&
+ ret.length < instance.options.choices ; i++) {
+
+ var elem = instance.options.array[i];
+ var foundPos = instance.options.ignoreCase ?
+ elem.toLowerCase().indexOf(entry.toLowerCase()) :
+ elem.indexOf(entry);
+
+ while (foundPos != -1) {
+ if (foundPos == 0 && elem.length != entry.length) {
+ ret.push("" + elem.substr(0, entry.length) + " " +
+ elem.substr(entry.length) + " ");
+ break;
+ } else if (entry.length >= instance.options.partialChars &&
+ instance.options.partialSearch && foundPos != -1) {
+ if (instance.options.fullSearch || /\s/.test(elem.substr(foundPos-1,1))) {
+ partial.push("" + elem.substr(0, foundPos) + "" +
+ elem.substr(foundPos, entry.length) + " " + elem.substr(
+ foundPos + entry.length) + " ");
+ break;
+ }
+ }
+
+ foundPos = instance.options.ignoreCase ?
+ elem.toLowerCase().indexOf(entry.toLowerCase(), foundPos + 1) :
+ elem.indexOf(entry, foundPos + 1);
+
+ }
+ }
+ if (partial.length)
+ ret = ret.concat(partial.slice(0, instance.options.choices - ret.length))
+ return "";
+ }
+ }, options || { });
+ }
+});
+
+// AJAX in-place editor and collection editor
+// Full rewrite by Christophe Porteneuve (April 2007).
+
+// Use this if you notice weird scrolling problems on some browsers,
+// the DOM might be a bit confused when this gets called so do this
+// waits 1 ms (with setTimeout) until it does the activation
+Field.scrollFreeActivate = function(field) {
+ setTimeout(function() {
+ Field.activate(field);
+ }, 1);
+}
+
+Ajax.InPlaceEditor = Class.create({
+ initialize: function(element, url, options) {
+ this.url = url;
+ this.element = element = $(element);
+ this.prepareOptions();
+ this._controls = { };
+ arguments.callee.dealWithDeprecatedOptions(options); // DEPRECATION LAYER!!!
+ Object.extend(this.options, options || { });
+ if (!this.options.formId && this.element.id) {
+ this.options.formId = this.element.id + '-inplaceeditor';
+ if ($(this.options.formId))
+ this.options.formId = '';
+ }
+ if (this.options.externalControl)
+ this.options.externalControl = $(this.options.externalControl);
+ if (!this.options.externalControl)
+ this.options.externalControlOnly = false;
+ this._originalBackground = this.element.getStyle('background-color') || 'transparent';
+ this.element.title = this.options.clickToEditText;
+ this._boundCancelHandler = this.handleFormCancellation.bind(this);
+ this._boundComplete = (this.options.onComplete || Prototype.emptyFunction).bind(this);
+ this._boundFailureHandler = this.handleAJAXFailure.bind(this);
+ this._boundSubmitHandler = this.handleFormSubmission.bind(this);
+ this._boundWrapperHandler = this.wrapUp.bind(this);
+ this.registerListeners();
+ },
+ checkForEscapeOrReturn: function(e) {
+ if (!this._editing || e.ctrlKey || e.altKey || e.shiftKey) return;
+ if (Event.KEY_ESC == e.keyCode)
+ this.handleFormCancellation(e);
+ else if (Event.KEY_RETURN == e.keyCode)
+ this.handleFormSubmission(e);
+ },
+ createControl: function(mode, handler, extraClasses) {
+ var control = this.options[mode + 'Control'];
+ var text = this.options[mode + 'Text'];
+ if ('button' == control) {
+ var btn = document.createElement('input');
+ btn.type = 'submit';
+ btn.value = text;
+ btn.className = 'editor_' + mode + '_button';
+ if ('cancel' == mode)
+ btn.onclick = this._boundCancelHandler;
+ this._form.appendChild(btn);
+ this._controls[mode] = btn;
+ } else if ('link' == control) {
+ var link = document.createElement('a');
+ link.href = '#';
+ link.appendChild(document.createTextNode(text));
+ link.onclick = 'cancel' == mode ? this._boundCancelHandler : this._boundSubmitHandler;
+ link.className = 'editor_' + mode + '_link';
+ if (extraClasses)
+ link.className += ' ' + extraClasses;
+ this._form.appendChild(link);
+ this._controls[mode] = link;
+ }
+ },
+ createEditField: function() {
+ var text = (this.options.loadTextURL ? this.options.loadingText : this.getText());
+ var fld;
+ if (1 >= this.options.rows && !/\r|\n/.test(this.getText())) {
+ fld = document.createElement('input');
+ fld.type = 'text';
+ var size = this.options.size || this.options.cols || 0;
+ if (0 < size) fld.size = size;
+ } else {
+ fld = document.createElement('textarea');
+ fld.rows = (1 >= this.options.rows ? this.options.autoRows : this.options.rows);
+ fld.cols = this.options.cols || 40;
+ }
+ fld.name = this.options.paramName;
+ fld.value = text; // No HTML breaks conversion anymore
+ fld.className = 'editor_field';
+ if (this.options.submitOnBlur)
+ fld.onblur = this._boundSubmitHandler;
+ this._controls.editor = fld;
+ if (this.options.loadTextURL)
+ this.loadExternalText();
+ this._form.appendChild(this._controls.editor);
+ },
+ createForm: function() {
+ var ipe = this;
+ function addText(mode, condition) {
+ var text = ipe.options['text' + mode + 'Controls'];
+ if (!text || condition === false) return;
+ ipe._form.appendChild(document.createTextNode(text));
+ };
+ this._form = $(document.createElement('form'));
+ this._form.id = this.options.formId;
+ this._form.addClassName(this.options.formClassName);
+ this._form.onsubmit = this._boundSubmitHandler;
+ this.createEditField();
+ if ('textarea' == this._controls.editor.tagName.toLowerCase())
+ this._form.appendChild(document.createElement('br'));
+ if (this.options.onFormCustomization)
+ this.options.onFormCustomization(this, this._form);
+ addText('Before', this.options.okControl || this.options.cancelControl);
+ this.createControl('ok', this._boundSubmitHandler);
+ addText('Between', this.options.okControl && this.options.cancelControl);
+ this.createControl('cancel', this._boundCancelHandler, 'editor_cancel');
+ addText('After', this.options.okControl || this.options.cancelControl);
+ },
+ destroy: function() {
+ if (this._oldInnerHTML)
+ this.element.innerHTML = this._oldInnerHTML;
+ this.leaveEditMode();
+ this.unregisterListeners();
+ },
+ enterEditMode: function(e) {
+ if (this._saving || this._editing) return;
+ this._editing = true;
+ this.triggerCallback('onEnterEditMode');
+ if (this.options.externalControl)
+ this.options.externalControl.hide();
+ this.element.hide();
+ this.createForm();
+ this.element.parentNode.insertBefore(this._form, this.element);
+ if (!this.options.loadTextURL)
+ this.postProcessEditField();
+ if (e) Event.stop(e);
+ },
+ enterHover: function(e) {
+ if (this.options.hoverClassName)
+ this.element.addClassName(this.options.hoverClassName);
+ if (this._saving) return;
+ this.triggerCallback('onEnterHover');
+ },
+ getText: function() {
+ return this.element.innerHTML;
+ },
+ handleAJAXFailure: function(transport) {
+ this.triggerCallback('onFailure', transport);
+ if (this._oldInnerHTML) {
+ this.element.innerHTML = this._oldInnerHTML;
+ this._oldInnerHTML = null;
+ }
+ },
+ handleFormCancellation: function(e) {
+ this.wrapUp();
+ if (e) Event.stop(e);
+ },
+ handleFormSubmission: function(e) {
+ var form = this._form;
+ var value = $F(this._controls.editor);
+ this.prepareSubmission();
+ var params = this.options.callback(form, value) || '';
+ if (Object.isString(params))
+ params = params.toQueryParams();
+ params.editorId = this.element.id;
+ if (this.options.htmlResponse) {
+ var options = Object.extend({ evalScripts: true }, this.options.ajaxOptions);
+ Object.extend(options, {
+ parameters: params,
+ onComplete: this._boundWrapperHandler,
+ onFailure: this._boundFailureHandler
+ });
+ new Ajax.Updater({ success: this.element }, this.url, options);
+ } else {
+ var options = Object.extend({ method: 'get' }, this.options.ajaxOptions);
+ Object.extend(options, {
+ parameters: params,
+ onComplete: this._boundWrapperHandler,
+ onFailure: this._boundFailureHandler
+ });
+ new Ajax.Request(this.url, options);
+ }
+ if (e) Event.stop(e);
+ },
+ leaveEditMode: function() {
+ this.element.removeClassName(this.options.savingClassName);
+ this.removeForm();
+ this.leaveHover();
+ this.element.style.backgroundColor = this._originalBackground;
+ this.element.show();
+ if (this.options.externalControl)
+ this.options.externalControl.show();
+ this._saving = false;
+ this._editing = false;
+ this._oldInnerHTML = null;
+ this.triggerCallback('onLeaveEditMode');
+ },
+ leaveHover: function(e) {
+ if (this.options.hoverClassName)
+ this.element.removeClassName(this.options.hoverClassName);
+ if (this._saving) return;
+ this.triggerCallback('onLeaveHover');
+ },
+ loadExternalText: function() {
+ this._form.addClassName(this.options.loadingClassName);
+ this._controls.editor.disabled = true;
+ var options = Object.extend({ method: 'get' }, this.options.ajaxOptions);
+ Object.extend(options, {
+ parameters: 'editorId=' + encodeURIComponent(this.element.id),
+ onComplete: Prototype.emptyFunction,
+ onSuccess: function(transport) {
+ this._form.removeClassName(this.options.loadingClassName);
+ var text = transport.responseText;
+ if (this.options.stripLoadedTextTags)
+ text = text.stripTags();
+ this._controls.editor.value = text;
+ this._controls.editor.disabled = false;
+ this.postProcessEditField();
+ }.bind(this),
+ onFailure: this._boundFailureHandler
+ });
+ new Ajax.Request(this.options.loadTextURL, options);
+ },
+ postProcessEditField: function() {
+ var fpc = this.options.fieldPostCreation;
+ if (fpc)
+ $(this._controls.editor)['focus' == fpc ? 'focus' : 'activate']();
+ },
+ prepareOptions: function() {
+ this.options = Object.clone(Ajax.InPlaceEditor.DefaultOptions);
+ Object.extend(this.options, Ajax.InPlaceEditor.DefaultCallbacks);
+ [this._extraDefaultOptions].flatten().compact().each(function(defs) {
+ Object.extend(this.options, defs);
+ }.bind(this));
+ },
+ prepareSubmission: function() {
+ this._saving = true;
+ this.removeForm();
+ this.leaveHover();
+ this.showSaving();
+ },
+ registerListeners: function() {
+ this._listeners = { };
+ var listener;
+ $H(Ajax.InPlaceEditor.Listeners).each(function(pair) {
+ listener = this[pair.value].bind(this);
+ this._listeners[pair.key] = listener;
+ if (!this.options.externalControlOnly)
+ this.element.observe(pair.key, listener);
+ if (this.options.externalControl)
+ this.options.externalControl.observe(pair.key, listener);
+ }.bind(this));
+ },
+ removeForm: function() {
+ if (!this._form) return;
+ this._form.remove();
+ this._form = null;
+ this._controls = { };
+ },
+ showSaving: function() {
+ this._oldInnerHTML = this.element.innerHTML;
+ this.element.innerHTML = this.options.savingText;
+ this.element.addClassName(this.options.savingClassName);
+ this.element.style.backgroundColor = this._originalBackground;
+ this.element.show();
+ },
+ triggerCallback: function(cbName, arg) {
+ if ('function' == typeof this.options[cbName]) {
+ this.options[cbName](this, arg);
+ }
+ },
+ unregisterListeners: function() {
+ $H(this._listeners).each(function(pair) {
+ if (!this.options.externalControlOnly)
+ this.element.stopObserving(pair.key, pair.value);
+ if (this.options.externalControl)
+ this.options.externalControl.stopObserving(pair.key, pair.value);
+ }.bind(this));
+ },
+ wrapUp: function(transport) {
+ this.leaveEditMode();
+ // Can't use triggerCallback due to backward compatibility: requires
+ // binding + direct element
+ this._boundComplete(transport, this.element);
+ }
+});
+
+Object.extend(Ajax.InPlaceEditor.prototype, {
+ dispose: Ajax.InPlaceEditor.prototype.destroy
+});
+
+Ajax.InPlaceCollectionEditor = Class.create(Ajax.InPlaceEditor, {
+ initialize: function($super, element, url, options) {
+ this._extraDefaultOptions = Ajax.InPlaceCollectionEditor.DefaultOptions;
+ $super(element, url, options);
+ },
+
+ createEditField: function() {
+ var list = document.createElement('select');
+ list.name = this.options.paramName;
+ list.size = 1;
+ this._controls.editor = list;
+ this._collection = this.options.collection || [];
+ if (this.options.loadCollectionURL)
+ this.loadCollection();
+ else
+ this.checkForExternalText();
+ this._form.appendChild(this._controls.editor);
+ },
+
+ loadCollection: function() {
+ this._form.addClassName(this.options.loadingClassName);
+ this.showLoadingText(this.options.loadingCollectionText);
+ var options = Object.extend({ method: 'get' }, this.options.ajaxOptions);
+ Object.extend(options, {
+ parameters: 'editorId=' + encodeURIComponent(this.element.id),
+ onComplete: Prototype.emptyFunction,
+ onSuccess: function(transport) {
+ var js = transport.responseText.strip();
+ if (!/^\[.*\]$/.test(js)) // TODO: improve sanity check
+ throw 'Server returned an invalid collection representation.';
+ this._collection = eval(js);
+ this.checkForExternalText();
+ }.bind(this),
+ onFailure: this.onFailure
+ });
+ new Ajax.Request(this.options.loadCollectionURL, options);
+ },
+
+ showLoadingText: function(text) {
+ this._controls.editor.disabled = true;
+ var tempOption = this._controls.editor.firstChild;
+ if (!tempOption) {
+ tempOption = document.createElement('option');
+ tempOption.value = '';
+ this._controls.editor.appendChild(tempOption);
+ tempOption.selected = true;
+ }
+ tempOption.update((text || '').stripScripts().stripTags());
+ },
+
+ checkForExternalText: function() {
+ this._text = this.getText();
+ if (this.options.loadTextURL)
+ this.loadExternalText();
+ else
+ this.buildOptionList();
+ },
+
+ loadExternalText: function() {
+ this.showLoadingText(this.options.loadingText);
+ var options = Object.extend({ method: 'get' }, this.options.ajaxOptions);
+ Object.extend(options, {
+ parameters: 'editorId=' + encodeURIComponent(this.element.id),
+ onComplete: Prototype.emptyFunction,
+ onSuccess: function(transport) {
+ this._text = transport.responseText.strip();
+ this.buildOptionList();
+ }.bind(this),
+ onFailure: this.onFailure
+ });
+ new Ajax.Request(this.options.loadTextURL, options);
+ },
+
+ buildOptionList: function() {
+ this._form.removeClassName(this.options.loadingClassName);
+ this._collection = this._collection.map(function(entry) {
+ return 2 === entry.length ? entry : [entry, entry].flatten();
+ });
+ var marker = ('value' in this.options) ? this.options.value : this._text;
+ var textFound = this._collection.any(function(entry) {
+ return entry[0] == marker;
+ }.bind(this));
+ this._controls.editor.update('');
+ var option;
+ this._collection.each(function(entry, index) {
+ option = document.createElement('option');
+ option.value = entry[0];
+ option.selected = textFound ? entry[0] == marker : 0 == index;
+ option.appendChild(document.createTextNode(entry[1]));
+ this._controls.editor.appendChild(option);
+ }.bind(this));
+ this._controls.editor.disabled = false;
+ Field.scrollFreeActivate(this._controls.editor);
+ }
+});
+
+//**** DEPRECATION LAYER FOR InPlace[Collection]Editor! ****
+//**** This only exists for a while, in order to let ****
+//**** users adapt to the new API. Read up on the new ****
+//**** API and convert your code to it ASAP! ****
+
+Ajax.InPlaceEditor.prototype.initialize.dealWithDeprecatedOptions = function(options) {
+ if (!options) return;
+ function fallback(name, expr) {
+ if (name in options || expr === undefined) return;
+ options[name] = expr;
+ };
+ fallback('cancelControl', (options.cancelLink ? 'link' : (options.cancelButton ? 'button' :
+ options.cancelLink == options.cancelButton == false ? false : undefined)));
+ fallback('okControl', (options.okLink ? 'link' : (options.okButton ? 'button' :
+ options.okLink == options.okButton == false ? false : undefined)));
+ fallback('highlightColor', options.highlightcolor);
+ fallback('highlightEndColor', options.highlightendcolor);
+};
+
+Object.extend(Ajax.InPlaceEditor, {
+ DefaultOptions: {
+ ajaxOptions: { },
+ autoRows: 3, // Use when multi-line w/ rows == 1
+ cancelControl: 'link', // 'link'|'button'|false
+ cancelText: 'cancel',
+ clickToEditText: 'Click to edit',
+ externalControl: null, // id|elt
+ externalControlOnly: false,
+ fieldPostCreation: 'activate', // 'activate'|'focus'|false
+ formClassName: 'inplaceeditor-form',
+ formId: null, // id|elt
+ highlightColor: '#ffff99',
+ highlightEndColor: '#ffffff',
+ hoverClassName: '',
+ htmlResponse: true,
+ loadingClassName: 'inplaceeditor-loading',
+ loadingText: 'Loading...',
+ okControl: 'button', // 'link'|'button'|false
+ okText: 'ok',
+ paramName: 'value',
+ rows: 1, // If 1 and multi-line, uses autoRows
+ savingClassName: 'inplaceeditor-saving',
+ savingText: 'Saving...',
+ size: 0,
+ stripLoadedTextTags: false,
+ submitOnBlur: false,
+ textAfterControls: '',
+ textBeforeControls: '',
+ textBetweenControls: ''
+ },
+ DefaultCallbacks: {
+ callback: function(form) {
+ return Form.serialize(form);
+ },
+ onComplete: function(transport, element) {
+ // For backward compatibility, this one is bound to the IPE, and passes
+ // the element directly. It was too often customized, so we don't break it.
+ new Effect.Highlight(element, {
+ startcolor: this.options.highlightColor, keepBackgroundImage: true });
+ },
+ onEnterEditMode: null,
+ onEnterHover: function(ipe) {
+ ipe.element.style.backgroundColor = ipe.options.highlightColor;
+ if (ipe._effect)
+ ipe._effect.cancel();
+ },
+ onFailure: function(transport, ipe) {
+ alert('Error communication with the server: ' + transport.responseText.stripTags());
+ },
+ onFormCustomization: null, // Takes the IPE and its generated form, after editor, before controls.
+ onLeaveEditMode: null,
+ onLeaveHover: function(ipe) {
+ ipe._effect = new Effect.Highlight(ipe.element, {
+ startcolor: ipe.options.highlightColor, endcolor: ipe.options.highlightEndColor,
+ restorecolor: ipe._originalBackground, keepBackgroundImage: true
+ });
+ }
+ },
+ Listeners: {
+ click: 'enterEditMode',
+ keydown: 'checkForEscapeOrReturn',
+ mouseover: 'enterHover',
+ mouseout: 'leaveHover'
+ }
+});
+
+Ajax.InPlaceCollectionEditor.DefaultOptions = {
+ loadingCollectionText: 'Loading options...'
+};
+
+// Delayed observer, like Form.Element.Observer,
+// but waits for delay after last key input
+// Ideal for live-search fields
+
+Form.Element.DelayedObserver = Class.create({
+ initialize: function(element, delay, callback) {
+ this.delay = delay || 0.5;
+ this.element = $(element);
+ this.callback = callback;
+ this.timer = null;
+ this.lastValue = $F(this.element);
+ Event.observe(this.element,'keyup',this.delayedListener.bindAsEventListener(this));
+ },
+ delayedListener: function(event) {
+ if(this.lastValue == $F(this.element)) return;
+ if(this.timer) clearTimeout(this.timer);
+ this.timer = setTimeout(this.onTimerEvent.bind(this), this.delay * 1000);
+ this.lastValue = $F(this.element);
+ },
+ onTimerEvent: function() {
+ this.timer = null;
+ this.callback(this.element, $F(this.element));
+ }
+});
diff --git a/vendor/rails-2.0.2/actionpack/lib/action_view/helpers/javascripts/dragdrop.js b/vendor/rails-2.0.2/actionpack/lib/action_view/helpers/javascripts/dragdrop.js
new file mode 100644
index 000000000..ccf4a1e45
--- /dev/null
+++ b/vendor/rails-2.0.2/actionpack/lib/action_view/helpers/javascripts/dragdrop.js
@@ -0,0 +1,972 @@
+// Copyright (c) 2005-2007 Thomas Fuchs (http://script.aculo.us, http://mir.aculo.us)
+// (c) 2005-2007 Sammi Williams (http://www.oriontransfer.co.nz, sammi@oriontransfer.co.nz)
+//
+// script.aculo.us is freely distributable under the terms of an MIT-style license.
+// For details, see the script.aculo.us web site: http://script.aculo.us/
+
+if(Object.isUndefined(Effect))
+ throw("dragdrop.js requires including script.aculo.us' effects.js library");
+
+var Droppables = {
+ drops: [],
+
+ remove: function(element) {
+ this.drops = this.drops.reject(function(d) { return d.element==$(element) });
+ },
+
+ add: function(element) {
+ element = $(element);
+ var options = Object.extend({
+ greedy: true,
+ hoverclass: null,
+ tree: false
+ }, arguments[1] || { });
+
+ // cache containers
+ if(options.containment) {
+ options._containers = [];
+ var containment = options.containment;
+ if(Object.isArray(containment)) {
+ containment.each( function(c) { options._containers.push($(c)) });
+ } else {
+ options._containers.push($(containment));
+ }
+ }
+
+ if(options.accept) options.accept = [options.accept].flatten();
+
+ Element.makePositioned(element); // fix IE
+ options.element = element;
+
+ this.drops.push(options);
+ },
+
+ findDeepestChild: function(drops) {
+ deepest = drops[0];
+
+ for (i = 1; i < drops.length; ++i)
+ if (Element.isParent(drops[i].element, deepest.element))
+ deepest = drops[i];
+
+ return deepest;
+ },
+
+ isContained: function(element, drop) {
+ var containmentNode;
+ if(drop.tree) {
+ containmentNode = element.treeNode;
+ } else {
+ containmentNode = element.parentNode;
+ }
+ return drop._containers.detect(function(c) { return containmentNode == c });
+ },
+
+ isAffected: function(point, element, drop) {
+ return (
+ (drop.element!=element) &&
+ ((!drop._containers) ||
+ this.isContained(element, drop)) &&
+ ((!drop.accept) ||
+ (Element.classNames(element).detect(
+ function(v) { return drop.accept.include(v) } ) )) &&
+ Position.within(drop.element, point[0], point[1]) );
+ },
+
+ deactivate: function(drop) {
+ if(drop.hoverclass)
+ Element.removeClassName(drop.element, drop.hoverclass);
+ this.last_active = null;
+ },
+
+ activate: function(drop) {
+ if(drop.hoverclass)
+ Element.addClassName(drop.element, drop.hoverclass);
+ this.last_active = drop;
+ },
+
+ show: function(point, element) {
+ if(!this.drops.length) return;
+ var drop, affected = [];
+
+ this.drops.each( function(drop) {
+ if(Droppables.isAffected(point, element, drop))
+ affected.push(drop);
+ });
+
+ if(affected.length>0)
+ drop = Droppables.findDeepestChild(affected);
+
+ if(this.last_active && this.last_active != drop) this.deactivate(this.last_active);
+ if (drop) {
+ Position.within(drop.element, point[0], point[1]);
+ if(drop.onHover)
+ drop.onHover(element, drop.element, Position.overlap(drop.overlap, drop.element));
+
+ if (drop != this.last_active) Droppables.activate(drop);
+ }
+ },
+
+ fire: function(event, element) {
+ if(!this.last_active) return;
+ Position.prepare();
+
+ if (this.isAffected([Event.pointerX(event), Event.pointerY(event)], element, this.last_active))
+ if (this.last_active.onDrop) {
+ this.last_active.onDrop(element, this.last_active.element, event);
+ return true;
+ }
+ },
+
+ reset: function() {
+ if(this.last_active)
+ this.deactivate(this.last_active);
+ }
+}
+
+var Draggables = {
+ drags: [],
+ observers: [],
+
+ register: function(draggable) {
+ if(this.drags.length == 0) {
+ this.eventMouseUp = this.endDrag.bindAsEventListener(this);
+ this.eventMouseMove = this.updateDrag.bindAsEventListener(this);
+ this.eventKeypress = this.keyPress.bindAsEventListener(this);
+
+ Event.observe(document, "mouseup", this.eventMouseUp);
+ Event.observe(document, "mousemove", this.eventMouseMove);
+ Event.observe(document, "keypress", this.eventKeypress);
+ }
+ this.drags.push(draggable);
+ },
+
+ unregister: function(draggable) {
+ this.drags = this.drags.reject(function(d) { return d==draggable });
+ if(this.drags.length == 0) {
+ Event.stopObserving(document, "mouseup", this.eventMouseUp);
+ Event.stopObserving(document, "mousemove", this.eventMouseMove);
+ Event.stopObserving(document, "keypress", this.eventKeypress);
+ }
+ },
+
+ activate: function(draggable) {
+ if(draggable.options.delay) {
+ this._timeout = setTimeout(function() {
+ Draggables._timeout = null;
+ window.focus();
+ Draggables.activeDraggable = draggable;
+ }.bind(this), draggable.options.delay);
+ } else {
+ window.focus(); // allows keypress events if window isn't currently focused, fails for Safari
+ this.activeDraggable = draggable;
+ }
+ },
+
+ deactivate: function() {
+ this.activeDraggable = null;
+ },
+
+ updateDrag: function(event) {
+ if(!this.activeDraggable) return;
+ var pointer = [Event.pointerX(event), Event.pointerY(event)];
+ // Mozilla-based browsers fire successive mousemove events with
+ // the same coordinates, prevent needless redrawing (moz bug?)
+ if(this._lastPointer && (this._lastPointer.inspect() == pointer.inspect())) return;
+ this._lastPointer = pointer;
+
+ this.activeDraggable.updateDrag(event, pointer);
+ },
+
+ endDrag: function(event) {
+ if(this._timeout) {
+ clearTimeout(this._timeout);
+ this._timeout = null;
+ }
+ if(!this.activeDraggable) return;
+ this._lastPointer = null;
+ this.activeDraggable.endDrag(event);
+ this.activeDraggable = null;
+ },
+
+ keyPress: function(event) {
+ if(this.activeDraggable)
+ this.activeDraggable.keyPress(event);
+ },
+
+ addObserver: function(observer) {
+ this.observers.push(observer);
+ this._cacheObserverCallbacks();
+ },
+
+ removeObserver: function(element) { // element instead of observer fixes mem leaks
+ this.observers = this.observers.reject( function(o) { return o.element==element });
+ this._cacheObserverCallbacks();
+ },
+
+ notify: function(eventName, draggable, event) { // 'onStart', 'onEnd', 'onDrag'
+ if(this[eventName+'Count'] > 0)
+ this.observers.each( function(o) {
+ if(o[eventName]) o[eventName](eventName, draggable, event);
+ });
+ if(draggable.options[eventName]) draggable.options[eventName](draggable, event);
+ },
+
+ _cacheObserverCallbacks: function() {
+ ['onStart','onEnd','onDrag'].each( function(eventName) {
+ Draggables[eventName+'Count'] = Draggables.observers.select(
+ function(o) { return o[eventName]; }
+ ).length;
+ });
+ }
+}
+
+/*--------------------------------------------------------------------------*/
+
+var Draggable = Class.create({
+ initialize: function(element) {
+ var defaults = {
+ handle: false,
+ reverteffect: function(element, top_offset, left_offset) {
+ var dur = Math.sqrt(Math.abs(top_offset^2)+Math.abs(left_offset^2))*0.02;
+ new Effect.Move(element, { x: -left_offset, y: -top_offset, duration: dur,
+ queue: {scope:'_draggable', position:'end'}
+ });
+ },
+ endeffect: function(element) {
+ var toOpacity = Object.isNumber(element._opacity) ? element._opacity : 1.0;
+ new Effect.Opacity(element, {duration:0.2, from:0.7, to:toOpacity,
+ queue: {scope:'_draggable', position:'end'},
+ afterFinish: function(){
+ Draggable._dragging[element] = false
+ }
+ });
+ },
+ zindex: 1000,
+ revert: false,
+ quiet: false,
+ scroll: false,
+ scrollSensitivity: 20,
+ scrollSpeed: 15,
+ snap: false, // false, or xy or [x,y] or function(x,y){ return [x,y] }
+ delay: 0
+ };
+
+ if(!arguments[1] || Object.isUndefined(arguments[1].endeffect))
+ Object.extend(defaults, {
+ starteffect: function(element) {
+ element._opacity = Element.getOpacity(element);
+ Draggable._dragging[element] = true;
+ new Effect.Opacity(element, {duration:0.2, from:element._opacity, to:0.7});
+ }
+ });
+
+ var options = Object.extend(defaults, arguments[1] || { });
+
+ this.element = $(element);
+
+ if(options.handle && Object.isString(options.handle))
+ this.handle = this.element.down('.'+options.handle, 0);
+
+ if(!this.handle) this.handle = $(options.handle);
+ if(!this.handle) this.handle = this.element;
+
+ if(options.scroll && !options.scroll.scrollTo && !options.scroll.outerHTML) {
+ options.scroll = $(options.scroll);
+ this._isScrollChild = Element.childOf(this.element, options.scroll);
+ }
+
+ Element.makePositioned(this.element); // fix IE
+
+ this.options = options;
+ this.dragging = false;
+
+ this.eventMouseDown = this.initDrag.bindAsEventListener(this);
+ Event.observe(this.handle, "mousedown", this.eventMouseDown);
+
+ Draggables.register(this);
+ },
+
+ destroy: function() {
+ Event.stopObserving(this.handle, "mousedown", this.eventMouseDown);
+ Draggables.unregister(this);
+ },
+
+ currentDelta: function() {
+ return([
+ parseInt(Element.getStyle(this.element,'left') || '0'),
+ parseInt(Element.getStyle(this.element,'top') || '0')]);
+ },
+
+ initDrag: function(event) {
+ if(!Object.isUndefined(Draggable._dragging[this.element]) &&
+ Draggable._dragging[this.element]) return;
+ if(Event.isLeftClick(event)) {
+ // abort on form elements, fixes a Firefox issue
+ var src = Event.element(event);
+ if((tag_name = src.tagName.toUpperCase()) && (
+ tag_name=='INPUT' ||
+ tag_name=='SELECT' ||
+ tag_name=='OPTION' ||
+ tag_name=='BUTTON' ||
+ tag_name=='TEXTAREA')) return;
+
+ var pointer = [Event.pointerX(event), Event.pointerY(event)];
+ var pos = Position.cumulativeOffset(this.element);
+ this.offset = [0,1].map( function(i) { return (pointer[i] - pos[i]) });
+
+ Draggables.activate(this);
+ Event.stop(event);
+ }
+ },
+
+ startDrag: function(event) {
+ this.dragging = true;
+ if(!this.delta)
+ this.delta = this.currentDelta();
+
+ if(this.options.zindex) {
+ this.originalZ = parseInt(Element.getStyle(this.element,'z-index') || 0);
+ this.element.style.zIndex = this.options.zindex;
+ }
+
+ if(this.options.ghosting) {
+ this._clone = this.element.cloneNode(true);
+ this.element._originallyAbsolute = (this.element.getStyle('position') == 'absolute');
+ if (!this.element._originallyAbsolute)
+ Position.absolutize(this.element);
+ this.element.parentNode.insertBefore(this._clone, this.element);
+ }
+
+ if(this.options.scroll) {
+ if (this.options.scroll == window) {
+ var where = this._getWindowScroll(this.options.scroll);
+ this.originalScrollLeft = where.left;
+ this.originalScrollTop = where.top;
+ } else {
+ this.originalScrollLeft = this.options.scroll.scrollLeft;
+ this.originalScrollTop = this.options.scroll.scrollTop;
+ }
+ }
+
+ Draggables.notify('onStart', this, event);
+
+ if(this.options.starteffect) this.options.starteffect(this.element);
+ },
+
+ updateDrag: function(event, pointer) {
+ if(!this.dragging) this.startDrag(event);
+
+ if(!this.options.quiet){
+ Position.prepare();
+ Droppables.show(pointer, this.element);
+ }
+
+ Draggables.notify('onDrag', this, event);
+
+ this.draw(pointer);
+ if(this.options.change) this.options.change(this);
+
+ if(this.options.scroll) {
+ this.stopScrolling();
+
+ var p;
+ if (this.options.scroll == window) {
+ with(this._getWindowScroll(this.options.scroll)) { p = [ left, top, left+width, top+height ]; }
+ } else {
+ p = Position.page(this.options.scroll);
+ p[0] += this.options.scroll.scrollLeft + Position.deltaX;
+ p[1] += this.options.scroll.scrollTop + Position.deltaY;
+ p.push(p[0]+this.options.scroll.offsetWidth);
+ p.push(p[1]+this.options.scroll.offsetHeight);
+ }
+ var speed = [0,0];
+ if(pointer[0] < (p[0]+this.options.scrollSensitivity)) speed[0] = pointer[0]-(p[0]+this.options.scrollSensitivity);
+ if(pointer[1] < (p[1]+this.options.scrollSensitivity)) speed[1] = pointer[1]-(p[1]+this.options.scrollSensitivity);
+ if(pointer[0] > (p[2]-this.options.scrollSensitivity)) speed[0] = pointer[0]-(p[2]-this.options.scrollSensitivity);
+ if(pointer[1] > (p[3]-this.options.scrollSensitivity)) speed[1] = pointer[1]-(p[3]-this.options.scrollSensitivity);
+ this.startScrolling(speed);
+ }
+
+ // fix AppleWebKit rendering
+ if(Prototype.Browser.WebKit) window.scrollBy(0,0);
+
+ Event.stop(event);
+ },
+
+ finishDrag: function(event, success) {
+ this.dragging = false;
+
+ if(this.options.quiet){
+ Position.prepare();
+ var pointer = [Event.pointerX(event), Event.pointerY(event)];
+ Droppables.show(pointer, this.element);
+ }
+
+ if(this.options.ghosting) {
+ if (!this.element._originallyAbsolute)
+ Position.relativize(this.element);
+ delete this.element._originallyAbsolute;
+ Element.remove(this._clone);
+ this._clone = null;
+ }
+
+ var dropped = false;
+ if(success) {
+ dropped = Droppables.fire(event, this.element);
+ if (!dropped) dropped = false;
+ }
+ if(dropped && this.options.onDropped) this.options.onDropped(this.element);
+ Draggables.notify('onEnd', this, event);
+
+ var revert = this.options.revert;
+ if(revert && Object.isFunction(revert)) revert = revert(this.element);
+
+ var d = this.currentDelta();
+ if(revert && this.options.reverteffect) {
+ if (dropped == 0 || revert != 'failure')
+ this.options.reverteffect(this.element,
+ d[1]-this.delta[1], d[0]-this.delta[0]);
+ } else {
+ this.delta = d;
+ }
+
+ if(this.options.zindex)
+ this.element.style.zIndex = this.originalZ;
+
+ if(this.options.endeffect)
+ this.options.endeffect(this.element);
+
+ Draggables.deactivate(this);
+ Droppables.reset();
+ },
+
+ keyPress: function(event) {
+ if(event.keyCode!=Event.KEY_ESC) return;
+ this.finishDrag(event, false);
+ Event.stop(event);
+ },
+
+ endDrag: function(event) {
+ if(!this.dragging) return;
+ this.stopScrolling();
+ this.finishDrag(event, true);
+ Event.stop(event);
+ },
+
+ draw: function(point) {
+ var pos = Position.cumulativeOffset(this.element);
+ if(this.options.ghosting) {
+ var r = Position.realOffset(this.element);
+ pos[0] += r[0] - Position.deltaX; pos[1] += r[1] - Position.deltaY;
+ }
+
+ var d = this.currentDelta();
+ pos[0] -= d[0]; pos[1] -= d[1];
+
+ if(this.options.scroll && (this.options.scroll != window && this._isScrollChild)) {
+ pos[0] -= this.options.scroll.scrollLeft-this.originalScrollLeft;
+ pos[1] -= this.options.scroll.scrollTop-this.originalScrollTop;
+ }
+
+ var p = [0,1].map(function(i){
+ return (point[i]-pos[i]-this.offset[i])
+ }.bind(this));
+
+ if(this.options.snap) {
+ if(Object.isFunction(this.options.snap)) {
+ p = this.options.snap(p[0],p[1],this);
+ } else {
+ if(Object.isArray(this.options.snap)) {
+ p = p.map( function(v, i) {
+ return (v/this.options.snap[i]).round()*this.options.snap[i] }.bind(this))
+ } else {
+ p = p.map( function(v) {
+ return (v/this.options.snap).round()*this.options.snap }.bind(this))
+ }
+ }}
+
+ var style = this.element.style;
+ if((!this.options.constraint) || (this.options.constraint=='horizontal'))
+ style.left = p[0] + "px";
+ if((!this.options.constraint) || (this.options.constraint=='vertical'))
+ style.top = p[1] + "px";
+
+ if(style.visibility=="hidden") style.visibility = ""; // fix gecko rendering
+ },
+
+ stopScrolling: function() {
+ if(this.scrollInterval) {
+ clearInterval(this.scrollInterval);
+ this.scrollInterval = null;
+ Draggables._lastScrollPointer = null;
+ }
+ },
+
+ startScrolling: function(speed) {
+ if(!(speed[0] || speed[1])) return;
+ this.scrollSpeed = [speed[0]*this.options.scrollSpeed,speed[1]*this.options.scrollSpeed];
+ this.lastScrolled = new Date();
+ this.scrollInterval = setInterval(this.scroll.bind(this), 10);
+ },
+
+ scroll: function() {
+ var current = new Date();
+ var delta = current - this.lastScrolled;
+ this.lastScrolled = current;
+ if(this.options.scroll == window) {
+ with (this._getWindowScroll(this.options.scroll)) {
+ if (this.scrollSpeed[0] || this.scrollSpeed[1]) {
+ var d = delta / 1000;
+ this.options.scroll.scrollTo( left + d*this.scrollSpeed[0], top + d*this.scrollSpeed[1] );
+ }
+ }
+ } else {
+ this.options.scroll.scrollLeft += this.scrollSpeed[0] * delta / 1000;
+ this.options.scroll.scrollTop += this.scrollSpeed[1] * delta / 1000;
+ }
+
+ Position.prepare();
+ Droppables.show(Draggables._lastPointer, this.element);
+ Draggables.notify('onDrag', this);
+ if (this._isScrollChild) {
+ Draggables._lastScrollPointer = Draggables._lastScrollPointer || $A(Draggables._lastPointer);
+ Draggables._lastScrollPointer[0] += this.scrollSpeed[0] * delta / 1000;
+ Draggables._lastScrollPointer[1] += this.scrollSpeed[1] * delta / 1000;
+ if (Draggables._lastScrollPointer[0] < 0)
+ Draggables._lastScrollPointer[0] = 0;
+ if (Draggables._lastScrollPointer[1] < 0)
+ Draggables._lastScrollPointer[1] = 0;
+ this.draw(Draggables._lastScrollPointer);
+ }
+
+ if(this.options.change) this.options.change(this);
+ },
+
+ _getWindowScroll: function(w) {
+ var T, L, W, H;
+ with (w.document) {
+ if (w.document.documentElement && documentElement.scrollTop) {
+ T = documentElement.scrollTop;
+ L = documentElement.scrollLeft;
+ } else if (w.document.body) {
+ T = body.scrollTop;
+ L = body.scrollLeft;
+ }
+ if (w.innerWidth) {
+ W = w.innerWidth;
+ H = w.innerHeight;
+ } else if (w.document.documentElement && documentElement.clientWidth) {
+ W = documentElement.clientWidth;
+ H = documentElement.clientHeight;
+ } else {
+ W = body.offsetWidth;
+ H = body.offsetHeight
+ }
+ }
+ return { top: T, left: L, width: W, height: H };
+ }
+});
+
+Draggable._dragging = { };
+
+/*--------------------------------------------------------------------------*/
+
+var SortableObserver = Class.create({
+ initialize: function(element, observer) {
+ this.element = $(element);
+ this.observer = observer;
+ this.lastValue = Sortable.serialize(this.element);
+ },
+
+ onStart: function() {
+ this.lastValue = Sortable.serialize(this.element);
+ },
+
+ onEnd: function() {
+ Sortable.unmark();
+ if(this.lastValue != Sortable.serialize(this.element))
+ this.observer(this.element)
+ }
+});
+
+var Sortable = {
+ SERIALIZE_RULE: /^[^_\-](?:[A-Za-z0-9\-\_]*)[_](.*)$/,
+
+ sortables: { },
+
+ _findRootElement: function(element) {
+ while (element.tagName.toUpperCase() != "BODY") {
+ if(element.id && Sortable.sortables[element.id]) return element;
+ element = element.parentNode;
+ }
+ },
+
+ options: function(element) {
+ element = Sortable._findRootElement($(element));
+ if(!element) return;
+ return Sortable.sortables[element.id];
+ },
+
+ destroy: function(element){
+ var s = Sortable.options(element);
+
+ if(s) {
+ Draggables.removeObserver(s.element);
+ s.droppables.each(function(d){ Droppables.remove(d) });
+ s.draggables.invoke('destroy');
+
+ delete Sortable.sortables[s.element.id];
+ }
+ },
+
+ create: function(element) {
+ element = $(element);
+ var options = Object.extend({
+ element: element,
+ tag: 'li', // assumes li children, override with tag: 'tagname'
+ dropOnEmpty: false,
+ tree: false,
+ treeTag: 'ul',
+ overlap: 'vertical', // one of 'vertical', 'horizontal'
+ constraint: 'vertical', // one of 'vertical', 'horizontal', false
+ containment: element, // also takes array of elements (or id's); or false
+ handle: false, // or a CSS class
+ only: false,
+ delay: 0,
+ hoverclass: null,
+ ghosting: false,
+ quiet: false,
+ scroll: false,
+ scrollSensitivity: 20,
+ scrollSpeed: 15,
+ format: this.SERIALIZE_RULE,
+
+ // these take arrays of elements or ids and can be
+ // used for better initialization performance
+ elements: false,
+ handles: false,
+
+ onChange: Prototype.emptyFunction,
+ onUpdate: Prototype.emptyFunction
+ }, arguments[1] || { });
+
+ // clear any old sortable with same element
+ this.destroy(element);
+
+ // build options for the draggables
+ var options_for_draggable = {
+ revert: true,
+ quiet: options.quiet,
+ scroll: options.scroll,
+ scrollSpeed: options.scrollSpeed,
+ scrollSensitivity: options.scrollSensitivity,
+ delay: options.delay,
+ ghosting: options.ghosting,
+ constraint: options.constraint,
+ handle: options.handle };
+
+ if(options.starteffect)
+ options_for_draggable.starteffect = options.starteffect;
+
+ if(options.reverteffect)
+ options_for_draggable.reverteffect = options.reverteffect;
+ else
+ if(options.ghosting) options_for_draggable.reverteffect = function(element) {
+ element.style.top = 0;
+ element.style.left = 0;
+ };
+
+ if(options.endeffect)
+ options_for_draggable.endeffect = options.endeffect;
+
+ if(options.zindex)
+ options_for_draggable.zindex = options.zindex;
+
+ // build options for the droppables
+ var options_for_droppable = {
+ overlap: options.overlap,
+ containment: options.containment,
+ tree: options.tree,
+ hoverclass: options.hoverclass,
+ onHover: Sortable.onHover
+ }
+
+ var options_for_tree = {
+ onHover: Sortable.onEmptyHover,
+ overlap: options.overlap,
+ containment: options.containment,
+ hoverclass: options.hoverclass
+ }
+
+ // fix for gecko engine
+ Element.cleanWhitespace(element);
+
+ options.draggables = [];
+ options.droppables = [];
+
+ // drop on empty handling
+ if(options.dropOnEmpty || options.tree) {
+ Droppables.add(element, options_for_tree);
+ options.droppables.push(element);
+ }
+
+ (options.elements || this.findElements(element, options) || []).each( function(e,i) {
+ var handle = options.handles ? $(options.handles[i]) :
+ (options.handle ? $(e).select('.' + options.handle)[0] : e);
+ options.draggables.push(
+ new Draggable(e, Object.extend(options_for_draggable, { handle: handle })));
+ Droppables.add(e, options_for_droppable);
+ if(options.tree) e.treeNode = element;
+ options.droppables.push(e);
+ });
+
+ if(options.tree) {
+ (Sortable.findTreeElements(element, options) || []).each( function(e) {
+ Droppables.add(e, options_for_tree);
+ e.treeNode = element;
+ options.droppables.push(e);
+ });
+ }
+
+ // keep reference
+ this.sortables[element.id] = options;
+
+ // for onupdate
+ Draggables.addObserver(new SortableObserver(element, options.onUpdate));
+
+ },
+
+ // return all suitable-for-sortable elements in a guaranteed order
+ findElements: function(element, options) {
+ return Element.findChildren(
+ element, options.only, options.tree ? true : false, options.tag);
+ },
+
+ findTreeElements: function(element, options) {
+ return Element.findChildren(
+ element, options.only, options.tree ? true : false, options.treeTag);
+ },
+
+ onHover: function(element, dropon, overlap) {
+ if(Element.isParent(dropon, element)) return;
+
+ if(overlap > .33 && overlap < .66 && Sortable.options(dropon).tree) {
+ return;
+ } else if(overlap>0.5) {
+ Sortable.mark(dropon, 'before');
+ if(dropon.previousSibling != element) {
+ var oldParentNode = element.parentNode;
+ element.style.visibility = "hidden"; // fix gecko rendering
+ dropon.parentNode.insertBefore(element, dropon);
+ if(dropon.parentNode!=oldParentNode)
+ Sortable.options(oldParentNode).onChange(element);
+ Sortable.options(dropon.parentNode).onChange(element);
+ }
+ } else {
+ Sortable.mark(dropon, 'after');
+ var nextElement = dropon.nextSibling || null;
+ if(nextElement != element) {
+ var oldParentNode = element.parentNode;
+ element.style.visibility = "hidden"; // fix gecko rendering
+ dropon.parentNode.insertBefore(element, nextElement);
+ if(dropon.parentNode!=oldParentNode)
+ Sortable.options(oldParentNode).onChange(element);
+ Sortable.options(dropon.parentNode).onChange(element);
+ }
+ }
+ },
+
+ onEmptyHover: function(element, dropon, overlap) {
+ var oldParentNode = element.parentNode;
+ var droponOptions = Sortable.options(dropon);
+
+ if(!Element.isParent(dropon, element)) {
+ var index;
+
+ var children = Sortable.findElements(dropon, {tag: droponOptions.tag, only: droponOptions.only});
+ var child = null;
+
+ if(children) {
+ var offset = Element.offsetSize(dropon, droponOptions.overlap) * (1.0 - overlap);
+
+ for (index = 0; index < children.length; index += 1) {
+ if (offset - Element.offsetSize (children[index], droponOptions.overlap) >= 0) {
+ offset -= Element.offsetSize (children[index], droponOptions.overlap);
+ } else if (offset - (Element.offsetSize (children[index], droponOptions.overlap) / 2) >= 0) {
+ child = index + 1 < children.length ? children[index + 1] : null;
+ break;
+ } else {
+ child = children[index];
+ break;
+ }
+ }
+ }
+
+ dropon.insertBefore(element, child);
+
+ Sortable.options(oldParentNode).onChange(element);
+ droponOptions.onChange(element);
+ }
+ },
+
+ unmark: function() {
+ if(Sortable._marker) Sortable._marker.hide();
+ },
+
+ mark: function(dropon, position) {
+ // mark on ghosting only
+ var sortable = Sortable.options(dropon.parentNode);
+ if(sortable && !sortable.ghosting) return;
+
+ if(!Sortable._marker) {
+ Sortable._marker =
+ ($('dropmarker') || Element.extend(document.createElement('DIV'))).
+ hide().addClassName('dropmarker').setStyle({position:'absolute'});
+ document.getElementsByTagName("body").item(0).appendChild(Sortable._marker);
+ }
+ var offsets = Position.cumulativeOffset(dropon);
+ Sortable._marker.setStyle({left: offsets[0]+'px', top: offsets[1] + 'px'});
+
+ if(position=='after')
+ if(sortable.overlap == 'horizontal')
+ Sortable._marker.setStyle({left: (offsets[0]+dropon.clientWidth) + 'px'});
+ else
+ Sortable._marker.setStyle({top: (offsets[1]+dropon.clientHeight) + 'px'});
+
+ Sortable._marker.show();
+ },
+
+ _tree: function(element, options, parent) {
+ var children = Sortable.findElements(element, options) || [];
+
+ for (var i = 0; i < children.length; ++i) {
+ var match = children[i].id.match(options.format);
+
+ if (!match) continue;
+
+ var child = {
+ id: encodeURIComponent(match ? match[1] : null),
+ element: element,
+ parent: parent,
+ children: [],
+ position: parent.children.length,
+ container: $(children[i]).down(options.treeTag)
+ }
+
+ /* Get the element containing the children and recurse over it */
+ if (child.container)
+ this._tree(child.container, options, child)
+
+ parent.children.push (child);
+ }
+
+ return parent;
+ },
+
+ tree: function(element) {
+ element = $(element);
+ var sortableOptions = this.options(element);
+ var options = Object.extend({
+ tag: sortableOptions.tag,
+ treeTag: sortableOptions.treeTag,
+ only: sortableOptions.only,
+ name: element.id,
+ format: sortableOptions.format
+ }, arguments[1] || { });
+
+ var root = {
+ id: null,
+ parent: null,
+ children: [],
+ container: element,
+ position: 0
+ }
+
+ return Sortable._tree(element, options, root);
+ },
+
+ /* Construct a [i] index for a particular node */
+ _constructIndex: function(node) {
+ var index = '';
+ do {
+ if (node.id) index = '[' + node.position + ']' + index;
+ } while ((node = node.parent) != null);
+ return index;
+ },
+
+ sequence: function(element) {
+ element = $(element);
+ var options = Object.extend(this.options(element), arguments[1] || { });
+
+ return $(this.findElements(element, options) || []).map( function(item) {
+ return item.id.match(options.format) ? item.id.match(options.format)[1] : '';
+ });
+ },
+
+ setSequence: function(element, new_sequence) {
+ element = $(element);
+ var options = Object.extend(this.options(element), arguments[2] || { });
+
+ var nodeMap = { };
+ this.findElements(element, options).each( function(n) {
+ if (n.id.match(options.format))
+ nodeMap[n.id.match(options.format)[1]] = [n, n.parentNode];
+ n.parentNode.removeChild(n);
+ });
+
+ new_sequence.each(function(ident) {
+ var n = nodeMap[ident];
+ if (n) {
+ n[1].appendChild(n[0]);
+ delete nodeMap[ident];
+ }
+ });
+ },
+
+ serialize: function(element) {
+ element = $(element);
+ var options = Object.extend(Sortable.options(element), arguments[1] || { });
+ var name = encodeURIComponent(
+ (arguments[1] && arguments[1].name) ? arguments[1].name : element.id);
+
+ if (options.tree) {
+ return Sortable.tree(element, arguments[1]).children.map( function (item) {
+ return [name + Sortable._constructIndex(item) + "[id]=" +
+ encodeURIComponent(item.id)].concat(item.children.map(arguments.callee));
+ }).flatten().join('&');
+ } else {
+ return Sortable.sequence(element, arguments[1]).map( function(item) {
+ return name + "[]=" + encodeURIComponent(item);
+ }).join('&');
+ }
+ }
+}
+
+// Returns true if child is contained within element
+Element.isParent = function(child, element) {
+ if (!child.parentNode || child == element) return false;
+ if (child.parentNode == element) return true;
+ return Element.isParent(child.parentNode, element);
+}
+
+Element.findChildren = function(element, only, recursive, tagName) {
+ if(!element.hasChildNodes()) return null;
+ tagName = tagName.toUpperCase();
+ if(only) only = [only].flatten();
+ var elements = [];
+ $A(element.childNodes).each( function(e) {
+ if(e.tagName && e.tagName.toUpperCase()==tagName &&
+ (!only || (Element.classNames(e).detect(function(v) { return only.include(v) }))))
+ elements.push(e);
+ if(recursive) {
+ var grandchildren = Element.findChildren(e, only, recursive, tagName);
+ if(grandchildren) elements.push(grandchildren);
+ }
+ });
+
+ return (elements.length>0 ? elements.flatten() : []);
+}
+
+Element.offsetSize = function (element, type) {
+ return element['offset' + ((type=='vertical' || type=='height') ? 'Height' : 'Width')];
+}
diff --git a/vendor/rails-2.0.2/actionpack/lib/action_view/helpers/javascripts/effects.js b/vendor/rails-2.0.2/actionpack/lib/action_view/helpers/javascripts/effects.js
new file mode 100644
index 000000000..65aed2395
--- /dev/null
+++ b/vendor/rails-2.0.2/actionpack/lib/action_view/helpers/javascripts/effects.js
@@ -0,0 +1,1120 @@
+// Copyright (c) 2005-2007 Thomas Fuchs (http://script.aculo.us, http://mir.aculo.us)
+// Contributors:
+// Justin Palmer (http://encytemedia.com/)
+// Mark Pilgrim (http://diveintomark.org/)
+// Martin Bialasinki
+//
+// script.aculo.us is freely distributable under the terms of an MIT-style license.
+// For details, see the script.aculo.us web site: http://script.aculo.us/
+
+// converts rgb() and #xxx to #xxxxxx format,
+// returns self (or first argument) if not convertable
+String.prototype.parseColor = function() {
+ var color = '#';
+ if (this.slice(0,4) == 'rgb(') {
+ var cols = this.slice(4,this.length-1).split(',');
+ var i=0; do { color += parseInt(cols[i]).toColorPart() } while (++i<3);
+ } else {
+ if (this.slice(0,1) == '#') {
+ if (this.length==4) for(var i=1;i<4;i++) color += (this.charAt(i) + this.charAt(i)).toLowerCase();
+ if (this.length==7) color = this.toLowerCase();
+ }
+ }
+ return (color.length==7 ? color : (arguments[0] || this));
+};
+
+/*--------------------------------------------------------------------------*/
+
+Element.collectTextNodes = function(element) {
+ return $A($(element).childNodes).collect( function(node) {
+ return (node.nodeType==3 ? node.nodeValue :
+ (node.hasChildNodes() ? Element.collectTextNodes(node) : ''));
+ }).flatten().join('');
+};
+
+Element.collectTextNodesIgnoreClass = function(element, className) {
+ return $A($(element).childNodes).collect( function(node) {
+ return (node.nodeType==3 ? node.nodeValue :
+ ((node.hasChildNodes() && !Element.hasClassName(node,className)) ?
+ Element.collectTextNodesIgnoreClass(node, className) : ''));
+ }).flatten().join('');
+};
+
+Element.setContentZoom = function(element, percent) {
+ element = $(element);
+ element.setStyle({fontSize: (percent/100) + 'em'});
+ if (Prototype.Browser.WebKit) window.scrollBy(0,0);
+ return element;
+};
+
+Element.getInlineOpacity = function(element){
+ return $(element).style.opacity || '';
+};
+
+Element.forceRerendering = function(element) {
+ try {
+ element = $(element);
+ var n = document.createTextNode(' ');
+ element.appendChild(n);
+ element.removeChild(n);
+ } catch(e) { }
+};
+
+/*--------------------------------------------------------------------------*/
+
+var Effect = {
+ _elementDoesNotExistError: {
+ name: 'ElementDoesNotExistError',
+ message: 'The specified DOM element does not exist, but is required for this effect to operate'
+ },
+ Transitions: {
+ linear: Prototype.K,
+ sinoidal: function(pos) {
+ return (-Math.cos(pos*Math.PI)/2) + 0.5;
+ },
+ reverse: function(pos) {
+ return 1-pos;
+ },
+ flicker: function(pos) {
+ var pos = ((-Math.cos(pos*Math.PI)/4) + 0.75) + Math.random()/4;
+ return pos > 1 ? 1 : pos;
+ },
+ wobble: function(pos) {
+ return (-Math.cos(pos*Math.PI*(9*pos))/2) + 0.5;
+ },
+ pulse: function(pos, pulses) {
+ pulses = pulses || 5;
+ return (
+ ((pos % (1/pulses)) * pulses).round() == 0 ?
+ ((pos * pulses * 2) - (pos * pulses * 2).floor()) :
+ 1 - ((pos * pulses * 2) - (pos * pulses * 2).floor())
+ );
+ },
+ spring: function(pos) {
+ return 1 - (Math.cos(pos * 4.5 * Math.PI) * Math.exp(-pos * 6));
+ },
+ none: function(pos) {
+ return 0;
+ },
+ full: function(pos) {
+ return 1;
+ }
+ },
+ DefaultOptions: {
+ duration: 1.0, // seconds
+ fps: 100, // 100= assume 66fps max.
+ sync: false, // true for combining
+ from: 0.0,
+ to: 1.0,
+ delay: 0.0,
+ queue: 'parallel'
+ },
+ tagifyText: function(element) {
+ var tagifyStyle = 'position:relative';
+ if (Prototype.Browser.IE) tagifyStyle += ';zoom:1';
+
+ element = $(element);
+ $A(element.childNodes).each( function(child) {
+ if (child.nodeType==3) {
+ child.nodeValue.toArray().each( function(character) {
+ element.insertBefore(
+ new Element('span', {style: tagifyStyle}).update(
+ character == ' ' ? String.fromCharCode(160) : character),
+ child);
+ });
+ Element.remove(child);
+ }
+ });
+ },
+ multiple: function(element, effect) {
+ var elements;
+ if (((typeof element == 'object') ||
+ Object.isFunction(element)) &&
+ (element.length))
+ elements = element;
+ else
+ elements = $(element).childNodes;
+
+ var options = Object.extend({
+ speed: 0.1,
+ delay: 0.0
+ }, arguments[2] || { });
+ var masterDelay = options.delay;
+
+ $A(elements).each( function(element, index) {
+ new effect(element, Object.extend(options, { delay: index * options.speed + masterDelay }));
+ });
+ },
+ PAIRS: {
+ 'slide': ['SlideDown','SlideUp'],
+ 'blind': ['BlindDown','BlindUp'],
+ 'appear': ['Appear','Fade']
+ },
+ toggle: function(element, effect) {
+ element = $(element);
+ effect = (effect || 'appear').toLowerCase();
+ var options = Object.extend({
+ queue: { position:'end', scope:(element.id || 'global'), limit: 1 }
+ }, arguments[2] || { });
+ Effect[element.visible() ?
+ Effect.PAIRS[effect][1] : Effect.PAIRS[effect][0]](element, options);
+ }
+};
+
+Effect.DefaultOptions.transition = Effect.Transitions.sinoidal;
+
+/* ------------- core effects ------------- */
+
+Effect.ScopedQueue = Class.create(Enumerable, {
+ initialize: function() {
+ this.effects = [];
+ this.interval = null;
+ },
+ _each: function(iterator) {
+ this.effects._each(iterator);
+ },
+ add: function(effect) {
+ var timestamp = new Date().getTime();
+
+ var position = Object.isString(effect.options.queue) ?
+ effect.options.queue : effect.options.queue.position;
+
+ switch(position) {
+ case 'front':
+ // move unstarted effects after this effect
+ this.effects.findAll(function(e){ return e.state=='idle' }).each( function(e) {
+ e.startOn += effect.finishOn;
+ e.finishOn += effect.finishOn;
+ });
+ break;
+ case 'with-last':
+ timestamp = this.effects.pluck('startOn').max() || timestamp;
+ break;
+ case 'end':
+ // start effect after last queued effect has finished
+ timestamp = this.effects.pluck('finishOn').max() || timestamp;
+ break;
+ }
+
+ effect.startOn += timestamp;
+ effect.finishOn += timestamp;
+
+ if (!effect.options.queue.limit || (this.effects.length < effect.options.queue.limit))
+ this.effects.push(effect);
+
+ if (!this.interval)
+ this.interval = setInterval(this.loop.bind(this), 15);
+ },
+ remove: function(effect) {
+ this.effects = this.effects.reject(function(e) { return e==effect });
+ if (this.effects.length == 0) {
+ clearInterval(this.interval);
+ this.interval = null;
+ }
+ },
+ loop: function() {
+ var timePos = new Date().getTime();
+ for(var i=0, len=this.effects.length;i= this.startOn) {
+ if (timePos >= this.finishOn) {
+ this.render(1.0);
+ this.cancel();
+ this.event('beforeFinish');
+ if (this.finish) this.finish();
+ this.event('afterFinish');
+ return;
+ }
+ var pos = (timePos - this.startOn) / this.totalTime,
+ frame = (pos * this.totalFrames).round();
+ if (frame > this.currentFrame) {
+ this.render(pos);
+ this.currentFrame = frame;
+ }
+ }
+ },
+ cancel: function() {
+ if (!this.options.sync)
+ Effect.Queues.get(Object.isString(this.options.queue) ?
+ 'global' : this.options.queue.scope).remove(this);
+ this.state = 'finished';
+ },
+ event: function(eventName) {
+ if (this.options[eventName + 'Internal']) this.options[eventName + 'Internal'](this);
+ if (this.options[eventName]) this.options[eventName](this);
+ },
+ inspect: function() {
+ var data = $H();
+ for(property in this)
+ if (!Object.isFunction(this[property])) data.set(property, this[property]);
+ return '#';
+ }
+});
+
+Effect.Parallel = Class.create(Effect.Base, {
+ initialize: function(effects) {
+ this.effects = effects || [];
+ this.start(arguments[1]);
+ },
+ update: function(position) {
+ this.effects.invoke('render', position);
+ },
+ finish: function(position) {
+ this.effects.each( function(effect) {
+ effect.render(1.0);
+ effect.cancel();
+ effect.event('beforeFinish');
+ if (effect.finish) effect.finish(position);
+ effect.event('afterFinish');
+ });
+ }
+});
+
+Effect.Tween = Class.create(Effect.Base, {
+ initialize: function(object, from, to) {
+ object = Object.isString(object) ? $(object) : object;
+ var args = $A(arguments), method = args.last(),
+ options = args.length == 5 ? args[3] : null;
+ this.method = Object.isFunction(method) ? method.bind(object) :
+ Object.isFunction(object[method]) ? object[method].bind(object) :
+ function(value) { object[method] = value };
+ this.start(Object.extend({ from: from, to: to }, options || { }));
+ },
+ update: function(position) {
+ this.method(position);
+ }
+});
+
+Effect.Event = Class.create(Effect.Base, {
+ initialize: function() {
+ this.start(Object.extend({ duration: 0 }, arguments[0] || { }));
+ },
+ update: Prototype.emptyFunction
+});
+
+Effect.Opacity = Class.create(Effect.Base, {
+ initialize: function(element) {
+ this.element = $(element);
+ if (!this.element) throw(Effect._elementDoesNotExistError);
+ // make this work on IE on elements without 'layout'
+ if (Prototype.Browser.IE && (!this.element.currentStyle.hasLayout))
+ this.element.setStyle({zoom: 1});
+ var options = Object.extend({
+ from: this.element.getOpacity() || 0.0,
+ to: 1.0
+ }, arguments[1] || { });
+ this.start(options);
+ },
+ update: function(position) {
+ this.element.setOpacity(position);
+ }
+});
+
+Effect.Move = Class.create(Effect.Base, {
+ initialize: function(element) {
+ this.element = $(element);
+ if (!this.element) throw(Effect._elementDoesNotExistError);
+ var options = Object.extend({
+ x: 0,
+ y: 0,
+ mode: 'relative'
+ }, arguments[1] || { });
+ this.start(options);
+ },
+ setup: function() {
+ this.element.makePositioned();
+ this.originalLeft = parseFloat(this.element.getStyle('left') || '0');
+ this.originalTop = parseFloat(this.element.getStyle('top') || '0');
+ if (this.options.mode == 'absolute') {
+ this.options.x = this.options.x - this.originalLeft;
+ this.options.y = this.options.y - this.originalTop;
+ }
+ },
+ update: function(position) {
+ this.element.setStyle({
+ left: (this.options.x * position + this.originalLeft).round() + 'px',
+ top: (this.options.y * position + this.originalTop).round() + 'px'
+ });
+ }
+});
+
+// for backwards compatibility
+Effect.MoveBy = function(element, toTop, toLeft) {
+ return new Effect.Move(element,
+ Object.extend({ x: toLeft, y: toTop }, arguments[3] || { }));
+};
+
+Effect.Scale = Class.create(Effect.Base, {
+ initialize: function(element, percent) {
+ this.element = $(element);
+ if (!this.element) throw(Effect._elementDoesNotExistError);
+ var options = Object.extend({
+ scaleX: true,
+ scaleY: true,
+ scaleContent: true,
+ scaleFromCenter: false,
+ scaleMode: 'box', // 'box' or 'contents' or { } with provided values
+ scaleFrom: 100.0,
+ scaleTo: percent
+ }, arguments[2] || { });
+ this.start(options);
+ },
+ setup: function() {
+ this.restoreAfterFinish = this.options.restoreAfterFinish || false;
+ this.elementPositioning = this.element.getStyle('position');
+
+ this.originalStyle = { };
+ ['top','left','width','height','fontSize'].each( function(k) {
+ this.originalStyle[k] = this.element.style[k];
+ }.bind(this));
+
+ this.originalTop = this.element.offsetTop;
+ this.originalLeft = this.element.offsetLeft;
+
+ var fontSize = this.element.getStyle('font-size') || '100%';
+ ['em','px','%','pt'].each( function(fontSizeType) {
+ if (fontSize.indexOf(fontSizeType)>0) {
+ this.fontSize = parseFloat(fontSize);
+ this.fontSizeType = fontSizeType;
+ }
+ }.bind(this));
+
+ this.factor = (this.options.scaleTo - this.options.scaleFrom)/100;
+
+ this.dims = null;
+ if (this.options.scaleMode=='box')
+ this.dims = [this.element.offsetHeight, this.element.offsetWidth];
+ if (/^content/.test(this.options.scaleMode))
+ this.dims = [this.element.scrollHeight, this.element.scrollWidth];
+ if (!this.dims)
+ this.dims = [this.options.scaleMode.originalHeight,
+ this.options.scaleMode.originalWidth];
+ },
+ update: function(position) {
+ var currentScale = (this.options.scaleFrom/100.0) + (this.factor * position);
+ if (this.options.scaleContent && this.fontSize)
+ this.element.setStyle({fontSize: this.fontSize * currentScale + this.fontSizeType });
+ this.setDimensions(this.dims[0] * currentScale, this.dims[1] * currentScale);
+ },
+ finish: function(position) {
+ if (this.restoreAfterFinish) this.element.setStyle(this.originalStyle);
+ },
+ setDimensions: function(height, width) {
+ var d = { };
+ if (this.options.scaleX) d.width = width.round() + 'px';
+ if (this.options.scaleY) d.height = height.round() + 'px';
+ if (this.options.scaleFromCenter) {
+ var topd = (height - this.dims[0])/2;
+ var leftd = (width - this.dims[1])/2;
+ if (this.elementPositioning == 'absolute') {
+ if (this.options.scaleY) d.top = this.originalTop-topd + 'px';
+ if (this.options.scaleX) d.left = this.originalLeft-leftd + 'px';
+ } else {
+ if (this.options.scaleY) d.top = -topd + 'px';
+ if (this.options.scaleX) d.left = -leftd + 'px';
+ }
+ }
+ this.element.setStyle(d);
+ }
+});
+
+Effect.Highlight = Class.create(Effect.Base, {
+ initialize: function(element) {
+ this.element = $(element);
+ if (!this.element) throw(Effect._elementDoesNotExistError);
+ var options = Object.extend({ startcolor: '#ffff99' }, arguments[1] || { });
+ this.start(options);
+ },
+ setup: function() {
+ // Prevent executing on elements not in the layout flow
+ if (this.element.getStyle('display')=='none') { this.cancel(); return; }
+ // Disable background image during the effect
+ this.oldStyle = { };
+ if (!this.options.keepBackgroundImage) {
+ this.oldStyle.backgroundImage = this.element.getStyle('background-image');
+ this.element.setStyle({backgroundImage: 'none'});
+ }
+ if (!this.options.endcolor)
+ this.options.endcolor = this.element.getStyle('background-color').parseColor('#ffffff');
+ if (!this.options.restorecolor)
+ this.options.restorecolor = this.element.getStyle('background-color');
+ // init color calculations
+ this._base = $R(0,2).map(function(i){ return parseInt(this.options.startcolor.slice(i*2+1,i*2+3),16) }.bind(this));
+ this._delta = $R(0,2).map(function(i){ return parseInt(this.options.endcolor.slice(i*2+1,i*2+3),16)-this._base[i] }.bind(this));
+ },
+ update: function(position) {
+ this.element.setStyle({backgroundColor: $R(0,2).inject('#',function(m,v,i){
+ return m+((this._base[i]+(this._delta[i]*position)).round().toColorPart()); }.bind(this)) });
+ },
+ finish: function() {
+ this.element.setStyle(Object.extend(this.oldStyle, {
+ backgroundColor: this.options.restorecolor
+ }));
+ }
+});
+
+Effect.ScrollTo = function(element) {
+ var options = arguments[1] || { },
+ scrollOffsets = document.viewport.getScrollOffsets(),
+ elementOffsets = $(element).cumulativeOffset(),
+ max = (window.height || document.body.scrollHeight) - document.viewport.getHeight();
+
+ if (options.offset) elementOffsets[1] += options.offset;
+
+ return new Effect.Tween(null,
+ scrollOffsets.top,
+ elementOffsets[1] > max ? max : elementOffsets[1],
+ options,
+ function(p){ scrollTo(scrollOffsets.left, p.round()) }
+ );
+};
+
+/* ------------- combination effects ------------- */
+
+Effect.Fade = function(element) {
+ element = $(element);
+ var oldOpacity = element.getInlineOpacity();
+ var options = Object.extend({
+ from: element.getOpacity() || 1.0,
+ to: 0.0,
+ afterFinishInternal: function(effect) {
+ if (effect.options.to!=0) return;
+ effect.element.hide().setStyle({opacity: oldOpacity});
+ }
+ }, arguments[1] || { });
+ return new Effect.Opacity(element,options);
+};
+
+Effect.Appear = function(element) {
+ element = $(element);
+ var options = Object.extend({
+ from: (element.getStyle('display') == 'none' ? 0.0 : element.getOpacity() || 0.0),
+ to: 1.0,
+ // force Safari to render floated elements properly
+ afterFinishInternal: function(effect) {
+ effect.element.forceRerendering();
+ },
+ beforeSetup: function(effect) {
+ effect.element.setOpacity(effect.options.from).show();
+ }}, arguments[1] || { });
+ return new Effect.Opacity(element,options);
+};
+
+Effect.Puff = function(element) {
+ element = $(element);
+ var oldStyle = {
+ opacity: element.getInlineOpacity(),
+ position: element.getStyle('position'),
+ top: element.style.top,
+ left: element.style.left,
+ width: element.style.width,
+ height: element.style.height
+ };
+ return new Effect.Parallel(
+ [ new Effect.Scale(element, 200,
+ { sync: true, scaleFromCenter: true, scaleContent: true, restoreAfterFinish: true }),
+ new Effect.Opacity(element, { sync: true, to: 0.0 } ) ],
+ Object.extend({ duration: 1.0,
+ beforeSetupInternal: function(effect) {
+ Position.absolutize(effect.effects[0].element)
+ },
+ afterFinishInternal: function(effect) {
+ effect.effects[0].element.hide().setStyle(oldStyle); }
+ }, arguments[1] || { })
+ );
+};
+
+Effect.BlindUp = function(element) {
+ element = $(element);
+ element.makeClipping();
+ return new Effect.Scale(element, 0,
+ Object.extend({ scaleContent: false,
+ scaleX: false,
+ restoreAfterFinish: true,
+ afterFinishInternal: function(effect) {
+ effect.element.hide().undoClipping();
+ }
+ }, arguments[1] || { })
+ );
+};
+
+Effect.BlindDown = function(element) {
+ element = $(element);
+ var elementDimensions = element.getDimensions();
+ return new Effect.Scale(element, 100, Object.extend({
+ scaleContent: false,
+ scaleX: false,
+ scaleFrom: 0,
+ scaleMode: {originalHeight: elementDimensions.height, originalWidth: elementDimensions.width},
+ restoreAfterFinish: true,
+ afterSetup: function(effect) {
+ effect.element.makeClipping().setStyle({height: '0px'}).show();
+ },
+ afterFinishInternal: function(effect) {
+ effect.element.undoClipping();
+ }
+ }, arguments[1] || { }));
+};
+
+Effect.SwitchOff = function(element) {
+ element = $(element);
+ var oldOpacity = element.getInlineOpacity();
+ return new Effect.Appear(element, Object.extend({
+ duration: 0.4,
+ from: 0,
+ transition: Effect.Transitions.flicker,
+ afterFinishInternal: function(effect) {
+ new Effect.Scale(effect.element, 1, {
+ duration: 0.3, scaleFromCenter: true,
+ scaleX: false, scaleContent: false, restoreAfterFinish: true,
+ beforeSetup: function(effect) {
+ effect.element.makePositioned().makeClipping();
+ },
+ afterFinishInternal: function(effect) {
+ effect.element.hide().undoClipping().undoPositioned().setStyle({opacity: oldOpacity});
+ }
+ })
+ }
+ }, arguments[1] || { }));
+};
+
+Effect.DropOut = function(element) {
+ element = $(element);
+ var oldStyle = {
+ top: element.getStyle('top'),
+ left: element.getStyle('left'),
+ opacity: element.getInlineOpacity() };
+ return new Effect.Parallel(
+ [ new Effect.Move(element, {x: 0, y: 100, sync: true }),
+ new Effect.Opacity(element, { sync: true, to: 0.0 }) ],
+ Object.extend(
+ { duration: 0.5,
+ beforeSetup: function(effect) {
+ effect.effects[0].element.makePositioned();
+ },
+ afterFinishInternal: function(effect) {
+ effect.effects[0].element.hide().undoPositioned().setStyle(oldStyle);
+ }
+ }, arguments[1] || { }));
+};
+
+Effect.Shake = function(element) {
+ element = $(element);
+ var options = Object.extend({
+ distance: 20,
+ duration: 0.5
+ }, arguments[1] || {});
+ var distance = parseFloat(options.distance);
+ var split = parseFloat(options.duration) / 10.0;
+ var oldStyle = {
+ top: element.getStyle('top'),
+ left: element.getStyle('left') };
+ return new Effect.Move(element,
+ { x: distance, y: 0, duration: split, afterFinishInternal: function(effect) {
+ new Effect.Move(effect.element,
+ { x: -distance*2, y: 0, duration: split*2, afterFinishInternal: function(effect) {
+ new Effect.Move(effect.element,
+ { x: distance*2, y: 0, duration: split*2, afterFinishInternal: function(effect) {
+ new Effect.Move(effect.element,
+ { x: -distance*2, y: 0, duration: split*2, afterFinishInternal: function(effect) {
+ new Effect.Move(effect.element,
+ { x: distance*2, y: 0, duration: split*2, afterFinishInternal: function(effect) {
+ new Effect.Move(effect.element,
+ { x: -distance, y: 0, duration: split, afterFinishInternal: function(effect) {
+ effect.element.undoPositioned().setStyle(oldStyle);
+ }}) }}) }}) }}) }}) }});
+};
+
+Effect.SlideDown = function(element) {
+ element = $(element).cleanWhitespace();
+ // SlideDown need to have the content of the element wrapped in a container element with fixed height!
+ var oldInnerBottom = element.down().getStyle('bottom');
+ var elementDimensions = element.getDimensions();
+ return new Effect.Scale(element, 100, Object.extend({
+ scaleContent: false,
+ scaleX: false,
+ scaleFrom: window.opera ? 0 : 1,
+ scaleMode: {originalHeight: elementDimensions.height, originalWidth: elementDimensions.width},
+ restoreAfterFinish: true,
+ afterSetup: function(effect) {
+ effect.element.makePositioned();
+ effect.element.down().makePositioned();
+ if (window.opera) effect.element.setStyle({top: ''});
+ effect.element.makeClipping().setStyle({height: '0px'}).show();
+ },
+ afterUpdateInternal: function(effect) {
+ effect.element.down().setStyle({bottom:
+ (effect.dims[0] - effect.element.clientHeight) + 'px' });
+ },
+ afterFinishInternal: function(effect) {
+ effect.element.undoClipping().undoPositioned();
+ effect.element.down().undoPositioned().setStyle({bottom: oldInnerBottom}); }
+ }, arguments[1] || { })
+ );
+};
+
+Effect.SlideUp = function(element) {
+ element = $(element).cleanWhitespace();
+ var oldInnerBottom = element.down().getStyle('bottom');
+ var elementDimensions = element.getDimensions();
+ return new Effect.Scale(element, window.opera ? 0 : 1,
+ Object.extend({ scaleContent: false,
+ scaleX: false,
+ scaleMode: 'box',
+ scaleFrom: 100,
+ scaleMode: {originalHeight: elementDimensions.height, originalWidth: elementDimensions.width},
+ restoreAfterFinish: true,
+ afterSetup: function(effect) {
+ effect.element.makePositioned();
+ effect.element.down().makePositioned();
+ if (window.opera) effect.element.setStyle({top: ''});
+ effect.element.makeClipping().show();
+ },
+ afterUpdateInternal: function(effect) {
+ effect.element.down().setStyle({bottom:
+ (effect.dims[0] - effect.element.clientHeight) + 'px' });
+ },
+ afterFinishInternal: function(effect) {
+ effect.element.hide().undoClipping().undoPositioned();
+ effect.element.down().undoPositioned().setStyle({bottom: oldInnerBottom});
+ }
+ }, arguments[1] || { })
+ );
+};
+
+// Bug in opera makes the TD containing this element expand for a instance after finish
+Effect.Squish = function(element) {
+ return new Effect.Scale(element, window.opera ? 1 : 0, {
+ restoreAfterFinish: true,
+ beforeSetup: function(effect) {
+ effect.element.makeClipping();
+ },
+ afterFinishInternal: function(effect) {
+ effect.element.hide().undoClipping();
+ }
+ });
+};
+
+Effect.Grow = function(element) {
+ element = $(element);
+ var options = Object.extend({
+ direction: 'center',
+ moveTransition: Effect.Transitions.sinoidal,
+ scaleTransition: Effect.Transitions.sinoidal,
+ opacityTransition: Effect.Transitions.full
+ }, arguments[1] || { });
+ var oldStyle = {
+ top: element.style.top,
+ left: element.style.left,
+ height: element.style.height,
+ width: element.style.width,
+ opacity: element.getInlineOpacity() };
+
+ var dims = element.getDimensions();
+ var initialMoveX, initialMoveY;
+ var moveX, moveY;
+
+ switch (options.direction) {
+ case 'top-left':
+ initialMoveX = initialMoveY = moveX = moveY = 0;
+ break;
+ case 'top-right':
+ initialMoveX = dims.width;
+ initialMoveY = moveY = 0;
+ moveX = -dims.width;
+ break;
+ case 'bottom-left':
+ initialMoveX = moveX = 0;
+ initialMoveY = dims.height;
+ moveY = -dims.height;
+ break;
+ case 'bottom-right':
+ initialMoveX = dims.width;
+ initialMoveY = dims.height;
+ moveX = -dims.width;
+ moveY = -dims.height;
+ break;
+ case 'center':
+ initialMoveX = dims.width / 2;
+ initialMoveY = dims.height / 2;
+ moveX = -dims.width / 2;
+ moveY = -dims.height / 2;
+ break;
+ }
+
+ return new Effect.Move(element, {
+ x: initialMoveX,
+ y: initialMoveY,
+ duration: 0.01,
+ beforeSetup: function(effect) {
+ effect.element.hide().makeClipping().makePositioned();
+ },
+ afterFinishInternal: function(effect) {
+ new Effect.Parallel(
+ [ new Effect.Opacity(effect.element, { sync: true, to: 1.0, from: 0.0, transition: options.opacityTransition }),
+ new Effect.Move(effect.element, { x: moveX, y: moveY, sync: true, transition: options.moveTransition }),
+ new Effect.Scale(effect.element, 100, {
+ scaleMode: { originalHeight: dims.height, originalWidth: dims.width },
+ sync: true, scaleFrom: window.opera ? 1 : 0, transition: options.scaleTransition, restoreAfterFinish: true})
+ ], Object.extend({
+ beforeSetup: function(effect) {
+ effect.effects[0].element.setStyle({height: '0px'}).show();
+ },
+ afterFinishInternal: function(effect) {
+ effect.effects[0].element.undoClipping().undoPositioned().setStyle(oldStyle);
+ }
+ }, options)
+ )
+ }
+ });
+};
+
+Effect.Shrink = function(element) {
+ element = $(element);
+ var options = Object.extend({
+ direction: 'center',
+ moveTransition: Effect.Transitions.sinoidal,
+ scaleTransition: Effect.Transitions.sinoidal,
+ opacityTransition: Effect.Transitions.none
+ }, arguments[1] || { });
+ var oldStyle = {
+ top: element.style.top,
+ left: element.style.left,
+ height: element.style.height,
+ width: element.style.width,
+ opacity: element.getInlineOpacity() };
+
+ var dims = element.getDimensions();
+ var moveX, moveY;
+
+ switch (options.direction) {
+ case 'top-left':
+ moveX = moveY = 0;
+ break;
+ case 'top-right':
+ moveX = dims.width;
+ moveY = 0;
+ break;
+ case 'bottom-left':
+ moveX = 0;
+ moveY = dims.height;
+ break;
+ case 'bottom-right':
+ moveX = dims.width;
+ moveY = dims.height;
+ break;
+ case 'center':
+ moveX = dims.width / 2;
+ moveY = dims.height / 2;
+ break;
+ }
+
+ return new Effect.Parallel(
+ [ new Effect.Opacity(element, { sync: true, to: 0.0, from: 1.0, transition: options.opacityTransition }),
+ new Effect.Scale(element, window.opera ? 1 : 0, { sync: true, transition: options.scaleTransition, restoreAfterFinish: true}),
+ new Effect.Move(element, { x: moveX, y: moveY, sync: true, transition: options.moveTransition })
+ ], Object.extend({
+ beforeStartInternal: function(effect) {
+ effect.effects[0].element.makePositioned().makeClipping();
+ },
+ afterFinishInternal: function(effect) {
+ effect.effects[0].element.hide().undoClipping().undoPositioned().setStyle(oldStyle); }
+ }, options)
+ );
+};
+
+Effect.Pulsate = function(element) {
+ element = $(element);
+ var options = arguments[1] || { };
+ var oldOpacity = element.getInlineOpacity();
+ var transition = options.transition || Effect.Transitions.sinoidal;
+ var reverser = function(pos){ return transition(1-Effect.Transitions.pulse(pos, options.pulses)) };
+ reverser.bind(transition);
+ return new Effect.Opacity(element,
+ Object.extend(Object.extend({ duration: 2.0, from: 0,
+ afterFinishInternal: function(effect) { effect.element.setStyle({opacity: oldOpacity}); }
+ }, options), {transition: reverser}));
+};
+
+Effect.Fold = function(element) {
+ element = $(element);
+ var oldStyle = {
+ top: element.style.top,
+ left: element.style.left,
+ width: element.style.width,
+ height: element.style.height };
+ element.makeClipping();
+ return new Effect.Scale(element, 5, Object.extend({
+ scaleContent: false,
+ scaleX: false,
+ afterFinishInternal: function(effect) {
+ new Effect.Scale(element, 1, {
+ scaleContent: false,
+ scaleY: false,
+ afterFinishInternal: function(effect) {
+ effect.element.hide().undoClipping().setStyle(oldStyle);
+ } });
+ }}, arguments[1] || { }));
+};
+
+Effect.Morph = Class.create(Effect.Base, {
+ initialize: function(element) {
+ this.element = $(element);
+ if (!this.element) throw(Effect._elementDoesNotExistError);
+ var options = Object.extend({
+ style: { }
+ }, arguments[1] || { });
+
+ if (!Object.isString(options.style)) this.style = $H(options.style);
+ else {
+ if (options.style.include(':'))
+ this.style = options.style.parseStyle();
+ else {
+ this.element.addClassName(options.style);
+ this.style = $H(this.element.getStyles());
+ this.element.removeClassName(options.style);
+ var css = this.element.getStyles();
+ this.style = this.style.reject(function(style) {
+ return style.value == css[style.key];
+ });
+ options.afterFinishInternal = function(effect) {
+ effect.element.addClassName(effect.options.style);
+ effect.transforms.each(function(transform) {
+ effect.element.style[transform.style] = '';
+ });
+ }
+ }
+ }
+ this.start(options);
+ },
+
+ setup: function(){
+ function parseColor(color){
+ if (!color || ['rgba(0, 0, 0, 0)','transparent'].include(color)) color = '#ffffff';
+ color = color.parseColor();
+ return $R(0,2).map(function(i){
+ return parseInt( color.slice(i*2+1,i*2+3), 16 )
+ });
+ }
+ this.transforms = this.style.map(function(pair){
+ var property = pair[0], value = pair[1], unit = null;
+
+ if (value.parseColor('#zzzzzz') != '#zzzzzz') {
+ value = value.parseColor();
+ unit = 'color';
+ } else if (property == 'opacity') {
+ value = parseFloat(value);
+ if (Prototype.Browser.IE && (!this.element.currentStyle.hasLayout))
+ this.element.setStyle({zoom: 1});
+ } else if (Element.CSS_LENGTH.test(value)) {
+ var components = value.match(/^([\+\-]?[0-9\.]+)(.*)$/);
+ value = parseFloat(components[1]);
+ unit = (components.length == 3) ? components[2] : null;
+ }
+
+ var originalValue = this.element.getStyle(property);
+ return {
+ style: property.camelize(),
+ originalValue: unit=='color' ? parseColor(originalValue) : parseFloat(originalValue || 0),
+ targetValue: unit=='color' ? parseColor(value) : value,
+ unit: unit
+ };
+ }.bind(this)).reject(function(transform){
+ return (
+ (transform.originalValue == transform.targetValue) ||
+ (
+ transform.unit != 'color' &&
+ (isNaN(transform.originalValue) || isNaN(transform.targetValue))
+ )
+ )
+ });
+ },
+ update: function(position) {
+ var style = { }, transform, i = this.transforms.length;
+ while(i--)
+ style[(transform = this.transforms[i]).style] =
+ transform.unit=='color' ? '#'+
+ (Math.round(transform.originalValue[0]+
+ (transform.targetValue[0]-transform.originalValue[0])*position)).toColorPart() +
+ (Math.round(transform.originalValue[1]+
+ (transform.targetValue[1]-transform.originalValue[1])*position)).toColorPart() +
+ (Math.round(transform.originalValue[2]+
+ (transform.targetValue[2]-transform.originalValue[2])*position)).toColorPart() :
+ (transform.originalValue +
+ (transform.targetValue - transform.originalValue) * position).toFixed(3) +
+ (transform.unit === null ? '' : transform.unit);
+ this.element.setStyle(style, true);
+ }
+});
+
+Effect.Transform = Class.create({
+ initialize: function(tracks){
+ this.tracks = [];
+ this.options = arguments[1] || { };
+ this.addTracks(tracks);
+ },
+ addTracks: function(tracks){
+ tracks.each(function(track){
+ track = $H(track);
+ var data = track.values().first();
+ this.tracks.push($H({
+ ids: track.keys().first(),
+ effect: Effect.Morph,
+ options: { style: data }
+ }));
+ }.bind(this));
+ return this;
+ },
+ play: function(){
+ return new Effect.Parallel(
+ this.tracks.map(function(track){
+ var ids = track.get('ids'), effect = track.get('effect'), options = track.get('options');
+ var elements = [$(ids) || $$(ids)].flatten();
+ return elements.map(function(e){ return new effect(e, Object.extend({ sync:true }, options)) });
+ }).flatten(),
+ this.options
+ );
+ }
+});
+
+Element.CSS_PROPERTIES = $w(
+ 'backgroundColor backgroundPosition borderBottomColor borderBottomStyle ' +
+ 'borderBottomWidth borderLeftColor borderLeftStyle borderLeftWidth ' +
+ 'borderRightColor borderRightStyle borderRightWidth borderSpacing ' +
+ 'borderTopColor borderTopStyle borderTopWidth bottom clip color ' +
+ 'fontSize fontWeight height left letterSpacing lineHeight ' +
+ 'marginBottom marginLeft marginRight marginTop markerOffset maxHeight '+
+ 'maxWidth minHeight minWidth opacity outlineColor outlineOffset ' +
+ 'outlineWidth paddingBottom paddingLeft paddingRight paddingTop ' +
+ 'right textIndent top width wordSpacing zIndex');
+
+Element.CSS_LENGTH = /^(([\+\-]?[0-9\.]+)(em|ex|px|in|cm|mm|pt|pc|\%))|0$/;
+
+String.__parseStyleElement = document.createElement('div');
+String.prototype.parseStyle = function(){
+ var style, styleRules = $H();
+ if (Prototype.Browser.WebKit)
+ style = new Element('div',{style:this}).style;
+ else {
+ String.__parseStyleElement.innerHTML = '
';
+ style = String.__parseStyleElement.childNodes[0].style;
+ }
+
+ Element.CSS_PROPERTIES.each(function(property){
+ if (style[property]) styleRules.set(property, style[property]);
+ });
+
+ if (Prototype.Browser.IE && this.include('opacity'))
+ styleRules.set('opacity', this.match(/opacity:\s*((?:0|1)?(?:\.\d*)?)/)[1]);
+
+ return styleRules;
+};
+
+if (document.defaultView && document.defaultView.getComputedStyle) {
+ Element.getStyles = function(element) {
+ var css = document.defaultView.getComputedStyle($(element), null);
+ return Element.CSS_PROPERTIES.inject({ }, function(styles, property) {
+ styles[property] = css[property];
+ return styles;
+ });
+ };
+} else {
+ Element.getStyles = function(element) {
+ element = $(element);
+ var css = element.currentStyle, styles;
+ styles = Element.CSS_PROPERTIES.inject({ }, function(hash, property) {
+ hash.set(property, css[property]);
+ return hash;
+ });
+ if (!styles.opacity) styles.set('opacity', element.getOpacity());
+ return styles;
+ };
+};
+
+Effect.Methods = {
+ morph: function(element, style) {
+ element = $(element);
+ new Effect.Morph(element, Object.extend({ style: style }, arguments[2] || { }));
+ return element;
+ },
+ visualEffect: function(element, effect, options) {
+ element = $(element)
+ var s = effect.dasherize().camelize(), klass = s.charAt(0).toUpperCase() + s.substring(1);
+ new Effect[klass](element, options);
+ return element;
+ },
+ highlight: function(element, options) {
+ element = $(element);
+ new Effect.Highlight(element, options);
+ return element;
+ }
+};
+
+$w('fade appear grow shrink fold blindUp blindDown slideUp slideDown '+
+ 'pulsate shake puff squish switchOff dropOut').each(
+ function(effect) {
+ Effect.Methods[effect] = function(element, options){
+ element = $(element);
+ Effect[effect.charAt(0).toUpperCase() + effect.substring(1)](element, options);
+ return element;
+ }
+ }
+);
+
+$w('getInlineOpacity forceRerendering setContentZoom collectTextNodes collectTextNodesIgnoreClass getStyles').each(
+ function(f) { Effect.Methods[f] = Element[f]; }
+);
+
+Element.addMethods(Effect.Methods);
diff --git a/vendor/rails-2.0.2/actionpack/lib/action_view/helpers/javascripts/prototype.js b/vendor/rails-2.0.2/actionpack/lib/action_view/helpers/javascripts/prototype.js
new file mode 100644
index 000000000..546f9fe44
--- /dev/null
+++ b/vendor/rails-2.0.2/actionpack/lib/action_view/helpers/javascripts/prototype.js
@@ -0,0 +1,4225 @@
+/* Prototype JavaScript framework, version 1.6.0.1
+ * (c) 2005-2007 Sam Stephenson
+ *
+ * Prototype is freely distributable under the terms of an MIT-style license.
+ * For details, see the Prototype web site: http://www.prototypejs.org/
+ *
+ *--------------------------------------------------------------------------*/
+
+var Prototype = {
+ Version: '1.6.0.1',
+
+ Browser: {
+ IE: !!(window.attachEvent && !window.opera),
+ Opera: !!window.opera,
+ WebKit: navigator.userAgent.indexOf('AppleWebKit/') > -1,
+ Gecko: navigator.userAgent.indexOf('Gecko') > -1 && navigator.userAgent.indexOf('KHTML') == -1,
+ MobileSafari: !!navigator.userAgent.match(/Apple.*Mobile.*Safari/)
+ },
+
+ BrowserFeatures: {
+ XPath: !!document.evaluate,
+ ElementExtensions: !!window.HTMLElement,
+ SpecificElementExtensions:
+ document.createElement('div').__proto__ &&
+ document.createElement('div').__proto__ !==
+ document.createElement('form').__proto__
+ },
+
+ ScriptFragment: '
+ #
+ # mail_to "me@domain.com", "My email", :encode => "hex"
+ # # => My email
+ #
+ # mail_to "me@domain.com", nil, :replace_at => "_at_", :replace_dot => "_dot_", :class => "email"
+ # # => me_at_domain_dot_com
+ #
+ # mail_to "me@domain.com", "My email", :cc => "ccaddress@domain.com",
+ # :subject => "This is an example email"
+ # # => My email
+ def mail_to(email_address, name = nil, html_options = {})
+ html_options = html_options.stringify_keys
+ encode = html_options.delete("encode").to_s
+ cc, bcc, subject, body = html_options.delete("cc"), html_options.delete("bcc"), html_options.delete("subject"), html_options.delete("body")
+
+ string = ''
+ extras = ''
+ extras << "cc=#{CGI.escape(cc).gsub("+", "%20")}&" unless cc.nil?
+ extras << "bcc=#{CGI.escape(bcc).gsub("+", "%20")}&" unless bcc.nil?
+ extras << "body=#{CGI.escape(body).gsub("+", "%20")}&" unless body.nil?
+ extras << "subject=#{CGI.escape(subject).gsub("+", "%20")}&" unless subject.nil?
+ extras = "?" << extras.gsub!(/&?$/,"") unless extras.empty?
+
+ email_address = email_address.to_s
+
+ email_address_obfuscated = email_address.dup
+ email_address_obfuscated.gsub!(/@/, html_options.delete("replace_at")) if html_options.has_key?("replace_at")
+ email_address_obfuscated.gsub!(/\./, html_options.delete("replace_dot")) if html_options.has_key?("replace_dot")
+
+ if encode == "javascript"
+ tmp = "document.write('#{content_tag("a", name || email_address, html_options.merge({ "href" => "mailto:"+email_address+extras }))}');"
+ for i in 0...tmp.length
+ string << sprintf("%%%x",tmp[i])
+ end
+ ""
+ elsif encode == "hex"
+ email_address_encoded = ''
+ email_address_obfuscated.each_byte do |c|
+ email_address_encoded << sprintf("%d;", c)
+ end
+
+ protocol = 'mailto:'
+ protocol.each_byte { |c| string << sprintf("%d;", c) }
+
+ for i in 0...email_address.length
+ if email_address[i,1] =~ /\w/
+ string << sprintf("%%%x",email_address[i])
+ else
+ string << email_address[i,1]
+ end
+ end
+ content_tag "a", name || email_address_encoded, html_options.merge({ "href" => "#{string}#{extras}" })
+ else
+ content_tag "a", name || email_address_obfuscated, html_options.merge({ "href" => "mailto:#{email_address}#{extras}" })
+ end
+ end
+
+ # True if the current request URI was generated by the given +options+.
+ #
+ # ==== Examples
+ # Let's say we're in the /shop/checkout action.
+ #
+ # current_page?(:action => 'process')
+ # # => false
+ #
+ # current_page?(:controller => 'shop', :action => 'checkout')
+ # # => true
+ #
+ # current_page?(:action => 'checkout')
+ # # => true
+ #
+ # current_page?(:controller => 'library', :action => 'checkout')
+ # # => false
+ def current_page?(options)
+ url_string = CGI.escapeHTML(url_for(options))
+ request = @controller.request
+ if url_string =~ /^\w+:\/\//
+ url_string == "#{request.protocol}#{request.host_with_port}#{request.request_uri}"
+ else
+ url_string == request.request_uri
+ end
+ end
+
+ private
+ def convert_options_to_javascript!(html_options, url = '')
+ confirm, popup = html_options.delete("confirm"), html_options.delete("popup")
+
+ method, href = html_options.delete("method"), html_options['href']
+
+ html_options["onclick"] = case
+ when popup && method
+ raise ActionView::ActionViewError, "You can't use :popup and :method in the same link"
+ when confirm && popup
+ "if (#{confirm_javascript_function(confirm)}) { #{popup_javascript_function(popup)} };return false;"
+ when confirm && method
+ "if (#{confirm_javascript_function(confirm)}) { #{method_javascript_function(method)} };return false;"
+ when confirm
+ "return #{confirm_javascript_function(confirm)};"
+ when method
+ "#{method_javascript_function(method, url, href)}return false;"
+ when popup
+ popup_javascript_function(popup) + 'return false;'
+ else
+ html_options["onclick"]
+ end
+ end
+
+ def confirm_javascript_function(confirm)
+ "confirm('#{escape_javascript(confirm)}')"
+ end
+
+ def popup_javascript_function(popup)
+ popup.is_a?(Array) ? "window.open(this.href,'#{popup.first}','#{popup.last}');" : "window.open(this.href);"
+ end
+
+ def method_javascript_function(method, url = '', href = nil)
+ action = (href && url.size > 0) ? "'#{url}'" : 'this.href'
+ submit_function =
+ "var f = document.createElement('form'); f.style.display = 'none'; " +
+ "this.parentNode.appendChild(f); f.method = 'POST'; f.action = #{action};"
+
+ unless method == :post
+ submit_function << "var m = document.createElement('input'); m.setAttribute('type', 'hidden'); "
+ submit_function << "m.setAttribute('name', '_method'); m.setAttribute('value', '#{method}'); f.appendChild(m);"
+ end
+
+ if protect_against_forgery?
+ submit_function << "var s = document.createElement('input'); s.setAttribute('type', 'hidden'); "
+ submit_function << "s.setAttribute('name', '#{request_forgery_protection_token}'); s.setAttribute('value', '#{escape_javascript form_authenticity_token}'); f.appendChild(s);"
+ end
+ submit_function << "f.submit();"
+ end
+
+ # Processes the _html_options_ hash, converting the boolean
+ # attributes from true/false form into the form required by
+ # HTML/XHTML. (An attribute is considered to be boolean if
+ # its name is listed in the given _bool_attrs_ array.)
+ #
+ # More specifically, for each boolean attribute in _html_options_
+ # given as:
+ #
+ # "attr" => bool_value
+ #
+ # if the associated _bool_value_ evaluates to true, it is
+ # replaced with the attribute's name; otherwise the attribute is
+ # removed from the _html_options_ hash. (See the XHTML 1.0 spec,
+ # section 4.5 "Attribute Minimization" for more:
+ # http://www.w3.org/TR/xhtml1/#h-4.5)
+ #
+ # Returns the updated _html_options_ hash, which is also modified
+ # in place.
+ #
+ # Example:
+ #
+ # convert_boolean_attributes!( html_options,
+ # %w( checked disabled readonly ) )
+ def convert_boolean_attributes!(html_options, bool_attrs)
+ bool_attrs.each { |x| html_options[x] = x if html_options.delete(x) }
+ html_options
+ end
+ end
+ end
+end
diff --git a/vendor/rails-2.0.2/actionpack/lib/action_view/partials.rb b/vendor/rails-2.0.2/actionpack/lib/action_view/partials.rb
new file mode 100644
index 000000000..0795b8ec5
--- /dev/null
+++ b/vendor/rails-2.0.2/actionpack/lib/action_view/partials.rb
@@ -0,0 +1,200 @@
+module ActionView
+ # There's also a convenience method for rendering sub templates within the current controller that depends on a single object
+ # (we call this kind of sub templates for partials). It relies on the fact that partials should follow the naming convention of being
+ # prefixed with an underscore -- as to separate them from regular templates that could be rendered on their own.
+ #
+ # In a template for Advertiser#account:
+ #
+ # <%= render :partial => "account" %>
+ #
+ # This would render "advertiser/_account.erb" and pass the instance variable @account in as a local variable +account+ to
+ # the template for display.
+ #
+ # In another template for Advertiser#buy, we could have:
+ #
+ # <%= render :partial => "account", :locals => { :account => @buyer } %>
+ #
+ # <% for ad in @advertisements %>
+ # <%= render :partial => "ad", :locals => { :ad => ad } %>
+ # <% end %>
+ #
+ # This would first render "advertiser/_account.erb" with @buyer passed in as the local variable +account+, then render
+ # "advertiser/_ad.erb" and pass the local variable +ad+ to the template for display.
+ #
+ # == Rendering a collection of partials
+ #
+ # The example of partial use describes a familiar pattern where a template needs to iterate over an array and render a sub
+ # template for each of the elements. This pattern has been implemented as a single method that accepts an array and renders
+ # a partial by the same name as the elements contained within. So the three-lined example in "Using partials" can be rewritten
+ # with a single line:
+ #
+ # <%= render :partial => "ad", :collection => @advertisements %>
+ #
+ # This will render "advertiser/_ad.erb" and pass the local variable +ad+ to the template for display. An iteration counter
+ # will automatically be made available to the template with a name of the form +partial_name_counter+. In the case of the
+ # example above, the template would be fed +ad_counter+.
+ #
+ # NOTE: Due to backwards compatibility concerns, the collection can't be one of hashes. Normally you'd also just keep domain objects,
+ # like Active Records, in there.
+ #
+ # == Rendering shared partials
+ #
+ # Two controllers can share a set of partials and render them like this:
+ #
+ # <%= render :partial => "advertisement/ad", :locals => { :ad => @advertisement } %>
+ #
+ # This will render the partial "advertisement/_ad.erb" regardless of which controller this is being called from.
+ #
+ # == Rendering partials with layouts
+ #
+ # Partials can have their own layouts applied to them. These layouts are different than the ones that are specified globally
+ # for the entire action, but they work in a similar fashion. Imagine a list with two types of users:
+ #
+ # <%# app/views/users/index.html.erb &>
+ # Here's the administrator:
+ # <%= render :partial => "user", :layout => "administrator", :locals => { :user => administrator } %>
+ #
+ # Here's the editor:
+ # <%= render :partial => "user", :layout => "editor", :locals => { :user => editor } %>
+ #
+ # <%# app/views/users/_user.html.erb &>
+ # Name: <%= user.name %>
+ #
+ # <%# app/views/users/_administrator.html.erb &>
+ #
+ # Budget: $<%= user.budget %>
+ # <%= yield %>
+ #
+ #
+ # <%# app/views/users/_editor.html.erb &>
+ #
+ # Deadline: $<%= user.deadline %>
+ # <%= yield %>
+ #
+ #
+ # ...this will return:
+ #
+ # Here's the administrator:
+ #
+ # Budget: $<%= user.budget %>
+ # Name: <%= user.name %>
+ #
+ #
+ # Here's the editor:
+ #
+ # Deadline: $<%= user.deadline %>
+ # Name: <%= user.name %>
+ #
+ #
+ # You can also apply a layout to a block within any template:
+ #
+ # <%# app/views/users/_chief.html.erb &>
+ # <% render(:layout => "administrator", :locals => { :user => chief }) do %>
+ # Title: <%= chief.title %>
+ # <% end %>
+ #
+ # ...this will return:
+ #
+ #
+ # Budget: $<%= user.budget %>
+ # Title: <%= chief.name %>
+ #
+ #
+ # As you can see, the :locals hash is shared between both the partial and its layout.
+ module Partials
+ private
+ def render_partial(partial_path, object_assigns = nil, local_assigns = nil) #:nodoc:
+ case partial_path
+ when String, Symbol, NilClass
+ path, partial_name = partial_pieces(partial_path)
+ object = extracting_object(partial_name, object_assigns)
+ local_assigns = local_assigns ? local_assigns.clone : {}
+ add_counter_to_local_assigns!(partial_name, local_assigns)
+ add_object_to_local_assigns!(partial_name, local_assigns, object)
+
+ if logger && logger.debug?
+ ActionController::Base.benchmark("Rendered #{path}/_#{partial_name}", Logger::DEBUG, false) do
+ render("#{path}/_#{partial_name}", local_assigns)
+ end
+ else
+ render("#{path}/_#{partial_name}", local_assigns)
+ end
+ when Array, ActiveRecord::Associations::AssociationCollection, ActiveRecord::Associations::HasManyThroughAssociation
+ if partial_path.any?
+ path = ActionController::RecordIdentifier.partial_path(partial_path.first)
+ collection = partial_path
+ render_partial_collection(path, collection, nil, object_assigns.value)
+ else
+ ""
+ end
+ else
+ render_partial(
+ ActionController::RecordIdentifier.partial_path(partial_path),
+ object_assigns, local_assigns)
+ end
+ end
+
+ def render_partial_collection(partial_name, collection, partial_spacer_template = nil, local_assigns = nil) #:nodoc:
+ collection_of_partials = Array.new
+ counter_name = partial_counter_name(partial_name)
+ local_assigns = local_assigns ? local_assigns.clone : {}
+ collection.each_with_index do |element, counter|
+ local_assigns[counter_name] = counter
+ collection_of_partials.push(render_partial(partial_name, element, local_assigns))
+ end
+
+ return " " if collection_of_partials.empty?
+
+ if partial_spacer_template
+ spacer_path, spacer_name = partial_pieces(partial_spacer_template)
+ collection_of_partials.join(render("#{spacer_path}/_#{spacer_name}"))
+ else
+ collection_of_partials.join
+ end
+ end
+
+ alias_method :render_collection_of_partials, :render_partial_collection
+
+ def partial_pieces(partial_path)
+ if partial_path.include?('/')
+ return File.dirname(partial_path), File.basename(partial_path)
+ else
+ return controller.class.controller_path, partial_path
+ end
+ end
+
+ def partial_counter_name(partial_name)
+ "#{partial_variable_name(partial_name)}_counter".intern
+ end
+
+ def partial_variable_name(partial_name)
+ partial_name.split('/').last.split('.').first.intern
+ end
+
+ def extracting_object(partial_name, object_assigns)
+ variable_name = partial_variable_name(partial_name)
+ if object_assigns.nil?
+ controller.instance_variable_get("@#{variable_name}")
+ else
+ object_assigns
+ end
+ end
+
+ def add_counter_to_local_assigns!(partial_name, local_assigns)
+ counter_name = partial_counter_name(partial_name)
+ local_assigns[counter_name] = 1 unless local_assigns.has_key?(counter_name)
+ end
+
+ def add_object_to_local_assigns!(partial_name, local_assigns, object)
+ variable_name = partial_variable_name(partial_name)
+
+ local_assigns[:object] ||=
+ local_assigns[variable_name] ||=
+ if object.is_a?(ActionView::Base::ObjectWrapper)
+ object.value
+ else
+ object
+ end || controller.instance_variable_get("@#{variable_name}")
+ end
+ end
+end
diff --git a/vendor/rails-2.0.2/actionpack/lib/action_view/template_error.rb b/vendor/rails-2.0.2/actionpack/lib/action_view/template_error.rb
new file mode 100644
index 000000000..01b4b1555
--- /dev/null
+++ b/vendor/rails-2.0.2/actionpack/lib/action_view/template_error.rb
@@ -0,0 +1,102 @@
+module ActionView
+ # The TemplateError exception is raised when the compilation of the template fails. This exception then gathers a
+ # bunch of intimate details and uses it to report a very precise exception message.
+ class TemplateError < ActionViewError #:nodoc:
+ SOURCE_CODE_RADIUS = 3
+
+ attr_reader :original_exception
+
+ def initialize(base_path, file_path, assigns, source, original_exception)
+ @base_path, @assigns, @source, @original_exception =
+ base_path, assigns.dup, source, original_exception
+ @file_path = file_path
+ end
+
+ def message
+ ActiveSupport::Deprecation.silence { original_exception.message }
+ end
+
+ def clean_backtrace
+ original_exception.clean_backtrace
+ end
+
+ def sub_template_message
+ if @sub_templates
+ "Trace of template inclusion: " +
+ @sub_templates.collect { |template| strip_base_path(template) }.join(", ")
+ else
+ ""
+ end
+ end
+
+ def source_extract(indentation = 0)
+ return unless num = line_number
+ num = num.to_i
+
+ source_code = IO.readlines(@file_path)
+
+ start_on_line = [ num - SOURCE_CODE_RADIUS - 1, 0 ].max
+ end_on_line = [ num + SOURCE_CODE_RADIUS - 1, source_code.length].min
+
+ indent = ' ' * indentation
+ line_counter = start_on_line
+
+ source_code[start_on_line..end_on_line].sum do |line|
+ line_counter += 1
+ "#{indent}#{line_counter}: #{line}"
+ end
+ end
+
+ def sub_template_of(template_path)
+ @sub_templates ||= []
+ @sub_templates << template_path
+ end
+
+ def line_number
+ @line_number ||=
+ if file_name
+ regexp = /#{Regexp.escape File.basename(file_name)}:(\d+)/
+
+ $1 if message =~ regexp or clean_backtrace.find { |line| line =~ regexp }
+ end
+ end
+
+ def file_name
+ stripped = strip_base_path(@file_path)
+ stripped.slice!(0,1) if stripped[0] == ?/
+ stripped
+ end
+
+ def to_s
+ "\n\n#{self.class} (#{message}) #{source_location}:\n" +
+ "#{source_extract}\n #{clean_backtrace.join("\n ")}\n\n"
+ end
+
+ def backtrace
+ [
+ "#{source_location.capitalize}\n\n#{source_extract(4)}\n " +
+ clean_backtrace.join("\n ")
+ ]
+ end
+
+ private
+ def strip_base_path(path)
+ stripped_path = File.expand_path(path).gsub(@base_path, "")
+ stripped_path.gsub!(/^#{Regexp.escape File.expand_path(RAILS_ROOT)}/, '') if defined?(RAILS_ROOT)
+ stripped_path
+ end
+
+ def source_location
+ if line_number
+ "on line ##{line_number} of "
+ else
+ 'in '
+ end + file_name
+ end
+ end
+end
+
+if defined?(Exception::TraceSubstitutions)
+ Exception::TraceSubstitutions << [/:in\s+`_run_(html|xml).*'\s*$/, '']
+ Exception::TraceSubstitutions << [%r{^\s*#{Regexp.escape RAILS_ROOT}/}, ''] if defined?(RAILS_ROOT)
+end
diff --git a/vendor/rails-2.0.2/actionpack/lib/action_view/template_handler.rb b/vendor/rails-2.0.2/actionpack/lib/action_view/template_handler.rb
new file mode 100644
index 000000000..b9f4330a2
--- /dev/null
+++ b/vendor/rails-2.0.2/actionpack/lib/action_view/template_handler.rb
@@ -0,0 +1,17 @@
+module ActionView
+ class TemplateHandler
+ def self.line_offset
+ 0
+ end
+
+ def initialize(view)
+ @view = view
+ end
+
+ def render(template, local_assigns)
+ end
+
+ def compile(template)
+ end
+ end
+end
diff --git a/vendor/rails-2.0.2/actionpack/lib/action_view/template_handlers/builder.rb b/vendor/rails-2.0.2/actionpack/lib/action_view/template_handlers/builder.rb
new file mode 100644
index 000000000..0f49d6ab3
--- /dev/null
+++ b/vendor/rails-2.0.2/actionpack/lib/action_view/template_handlers/builder.rb
@@ -0,0 +1,19 @@
+require 'builder'
+
+module ActionView
+ module TemplateHandlers
+ class Builder < TemplateHandler
+ def self.line_offset
+ 2
+ end
+
+ def compile(template)
+ content_type_handler = (@view.send!(:controller).respond_to?(:response) ? "controller.response" : "controller")
+ "#{content_type_handler}.content_type ||= Mime::XML\n" +
+ "xml = Builder::XmlMarkup.new(:indent => 2)\n" +
+ template +
+ "\nxml.target!\n"
+ end
+ end
+ end
+end
diff --git a/vendor/rails-2.0.2/actionpack/lib/action_view/template_handlers/erb.rb b/vendor/rails-2.0.2/actionpack/lib/action_view/template_handlers/erb.rb
new file mode 100644
index 000000000..022fc362e
--- /dev/null
+++ b/vendor/rails-2.0.2/actionpack/lib/action_view/template_handlers/erb.rb
@@ -0,0 +1,21 @@
+require 'erb'
+
+class ERB
+ module Util
+ HTML_ESCAPE = { '&' => '&', '"' => '"', '>' => '>', '<' => '<' }
+
+ def html_escape(s)
+ s.to_s.gsub(/[&"><]/) { |special| HTML_ESCAPE[special] }
+ end
+ end
+end
+
+module ActionView
+ module TemplateHandlers
+ class ERB < TemplateHandler
+ def compile(template)
+ ::ERB.new(template, nil, @view.erb_trim_mode).src
+ end
+ end
+ end
+end
diff --git a/vendor/rails-2.0.2/actionpack/lib/action_view/template_handlers/rjs.rb b/vendor/rails-2.0.2/actionpack/lib/action_view/template_handlers/rjs.rb
new file mode 100644
index 000000000..4ca9fc327
--- /dev/null
+++ b/vendor/rails-2.0.2/actionpack/lib/action_view/template_handlers/rjs.rb
@@ -0,0 +1,14 @@
+module ActionView
+ module TemplateHandlers
+ class RJS < TemplateHandler
+ def self.line_offset
+ 2
+ end
+
+ def compile(template)
+ "controller.response.content_type ||= Mime::JS\n" +
+ "update_page do |page|\n#{template}\nend"
+ end
+ end
+ end
+end
diff --git a/vendor/rails-2.0.2/actionpack/lib/actionpack.rb b/vendor/rails-2.0.2/actionpack/lib/actionpack.rb
new file mode 100644
index 000000000..2fe2832f8
--- /dev/null
+++ b/vendor/rails-2.0.2/actionpack/lib/actionpack.rb
@@ -0,0 +1 @@
+require 'action_pack'
diff --git a/vendor/rails-2.0.2/actionpack/test/abstract_unit.rb b/vendor/rails-2.0.2/actionpack/test/abstract_unit.rb
new file mode 100644
index 000000000..700bc1f5e
--- /dev/null
+++ b/vendor/rails-2.0.2/actionpack/test/abstract_unit.rb
@@ -0,0 +1,36 @@
+$:.unshift(File.dirname(__FILE__) + '/../lib')
+$:.unshift(File.dirname(__FILE__) + '/../../activesupport/lib/active_support')
+$:.unshift(File.dirname(__FILE__) + '/fixtures/helpers')
+
+require 'yaml'
+require 'stringio'
+require 'test/unit'
+require 'action_controller'
+require 'action_controller/cgi_ext'
+require 'action_controller/test_process'
+
+begin
+ require 'ruby-debug'
+rescue LoadError
+ # Debugging disabled. `gem install ruby-debug` to enable.
+end
+
+# Show backtraces for deprecated behavior for quicker cleanup.
+ActiveSupport::Deprecation.debug = true
+
+ActionController::Base.logger = nil
+ActionController::Base.ignore_missing_templates = false
+ActionController::Routing::Routes.reload rescue nil
+
+
+# Wrap tests that use Mocha and skip if unavailable.
+def uses_mocha(test_name)
+ unless Object.const_defined?(:Mocha)
+ require 'mocha'
+ require 'stubba'
+ end
+ yield
+rescue LoadError => load_error
+ raise unless load_error.message =~ /mocha/i
+ $stderr.puts "Skipping #{test_name} tests. `gem install mocha` and try again."
+end
diff --git a/vendor/rails-2.0.2/actionpack/test/action_view_test.rb b/vendor/rails-2.0.2/actionpack/test/action_view_test.rb
new file mode 100644
index 000000000..a69ff36f9
--- /dev/null
+++ b/vendor/rails-2.0.2/actionpack/test/action_view_test.rb
@@ -0,0 +1,44 @@
+require File.dirname(__FILE__) + '/abstract_unit'
+require 'test/unit'
+
+class ActionViewTests < Test::Unit::TestCase
+ def test_find_template_extension_from_first_render
+ base = ActionView::Base.new
+
+ assert_nil base.send(:find_template_extension_from_first_render)
+
+ {
+ nil => nil,
+ '' => nil,
+ 'foo' => nil,
+ '/foo' => nil,
+ 'foo.rb' => 'rb',
+ 'foo.bar.rb' => 'bar.rb',
+ 'baz/foo.rb' => 'rb',
+ 'baz/foo.bar.rb' => 'bar.rb',
+ 'baz/foo.o/foo.rb' => 'rb',
+ 'baz/foo.o/foo.bar.rb' => 'bar.rb',
+ }.each do |input,expectation|
+ base.instance_variable_set('@first_render', input)
+ assert_equal expectation, base.send(:find_template_extension_from_first_render)
+ end
+ end
+
+ def test_should_report_file_exists_correctly
+ base = ActionView::Base.new
+
+ assert_nil base.send(:find_template_extension_from_first_render)
+
+ assert_equal false, base.send(:file_exists?, 'test.rhtml')
+ assert_equal false, base.send(:file_exists?, 'test.rb')
+
+ base.instance_variable_set('@first_render', 'foo.rb')
+
+ assert_equal 'rb', base.send(:find_template_extension_from_first_render)
+
+ assert_equal false, base.send(:file_exists?, 'baz')
+ assert_equal false, base.send(:file_exists?, 'baz.rb')
+
+ end
+
+end
diff --git a/vendor/rails-2.0.2/actionpack/test/active_record_unit.rb b/vendor/rails-2.0.2/actionpack/test/active_record_unit.rb
new file mode 100644
index 000000000..5f2745b59
--- /dev/null
+++ b/vendor/rails-2.0.2/actionpack/test/active_record_unit.rb
@@ -0,0 +1,108 @@
+require File.dirname(__FILE__) + '/abstract_unit'
+
+# Define the essentials
+class ActiveRecordTestConnector
+ cattr_accessor :able_to_connect
+ cattr_accessor :connected
+
+ # Set our defaults
+ self.connected = false
+ self.able_to_connect = true
+end
+
+# Try to grab AR
+if defined?(ActiveRecord) && defined?(Fixtures)
+ $stderr.puts 'Active Record is already loaded, running tests'
+else
+ $stderr.print 'Attempting to load Active Record... '
+ begin
+ PATH_TO_AR = "#{File.dirname(__FILE__)}/../../activerecord/lib"
+ raise LoadError, "#{PATH_TO_AR} doesn't exist" unless File.directory?(PATH_TO_AR)
+ $LOAD_PATH.unshift PATH_TO_AR
+ require 'active_record'
+ require 'active_record/fixtures'
+ $stderr.puts 'success'
+ rescue LoadError => e
+ $stderr.print "failed. Skipping Active Record assertion tests: #{e}"
+ ActiveRecordTestConnector.able_to_connect = false
+ end
+end
+$stderr.flush
+
+
+
+# Define the rest of the connector
+class ActiveRecordTestConnector
+ class << self
+ def setup
+ unless self.connected || !self.able_to_connect
+ setup_connection
+ load_schema
+ require_fixture_models
+ self.connected = true
+ end
+ rescue Exception => e # errors from ActiveRecord setup
+ $stderr.puts "\nSkipping ActiveRecord assertion tests: #{e}"
+ #$stderr.puts " #{e.backtrace.join("\n ")}\n"
+ self.able_to_connect = false
+ end
+
+ private
+
+ def setup_connection
+ if Object.const_defined?(:ActiveRecord)
+ defaults = { :database => ':memory:' }
+ begin
+ options = defaults.merge :adapter => 'sqlite3', :timeout => 500
+ ActiveRecord::Base.establish_connection(options)
+ ActiveRecord::Base.configurations = { 'sqlite3_ar_integration' => options }
+ ActiveRecord::Base.connection
+ rescue Exception # errors from establishing a connection
+ $stderr.puts 'SQLite 3 unavailable; trying SQLite 2.'
+ options = defaults.merge :adapter => 'sqlite'
+ ActiveRecord::Base.establish_connection(options)
+ ActiveRecord::Base.configurations = { 'sqlite2_ar_integration' => options }
+ ActiveRecord::Base.connection
+ end
+
+ Object.send(:const_set, :QUOTED_TYPE, ActiveRecord::Base.connection.quote_column_name('type')) unless Object.const_defined?(:QUOTED_TYPE)
+ else
+ raise "Can't setup connection since ActiveRecord isn't loaded."
+ end
+ end
+
+ # Load actionpack sqlite tables
+ def load_schema
+ File.read(File.dirname(__FILE__) + "/fixtures/db_definitions/sqlite.sql").split(';').each do |sql|
+ ActiveRecord::Base.connection.execute(sql) unless sql.blank?
+ end
+ end
+
+ def require_fixture_models
+ Dir.glob(File.dirname(__FILE__) + "/fixtures/*.rb").each {|f| require f}
+ end
+ end
+end
+
+# Test case for inheritance
+class ActiveRecordTestCase < Test::Unit::TestCase
+ # Set our fixture path
+ if ActiveRecordTestConnector.able_to_connect
+ self.fixture_path = "#{File.dirname(__FILE__)}/fixtures/"
+ self.use_transactional_fixtures = false
+ end
+
+ def self.fixtures(*args)
+ super if ActiveRecordTestConnector.connected
+ end
+
+ def run(*args)
+ super if ActiveRecordTestConnector.connected
+ end
+
+ # Default so Test::Unit::TestCase doesn't complain
+ def test_truth
+ end
+end
+
+ActiveRecordTestConnector.setup
diff --git a/vendor/rails-2.0.2/actionpack/test/activerecord/active_record_store_test.rb b/vendor/rails-2.0.2/actionpack/test/activerecord/active_record_store_test.rb
new file mode 100644
index 000000000..707a0a75c
--- /dev/null
+++ b/vendor/rails-2.0.2/actionpack/test/activerecord/active_record_store_test.rb
@@ -0,0 +1,142 @@
+# These tests exercise CGI::Session::ActiveRecordStore, so you're going to
+# need AR in a sibling directory to AP and have SQLite installed.
+require File.dirname(__FILE__) + '/../active_record_unit'
+require 'action_controller/session/active_record_store'
+
+
+module CommonActiveRecordStoreTests
+ def test_basics
+ s = session_class.new(:session_id => '1234', :data => { 'foo' => 'bar' })
+ assert_equal 'bar', s.data['foo']
+ assert s.save
+ assert_equal 'bar', s.data['foo']
+
+ assert_not_nil t = session_class.find_by_session_id('1234')
+ assert_not_nil t.data
+ assert_equal 'bar', t.data['foo']
+ end
+
+ def test_reload_same_session
+ @new_session.update
+ reloaded = CGI::Session.new(CGI.new, 'session_id' => @new_session.session_id, 'database_manager' => CGI::Session::ActiveRecordStore)
+ assert_equal 'bar', reloaded['foo']
+ end
+
+ def test_tolerates_close_close
+ assert_nothing_raised do
+ @new_session.close
+ @new_session.close
+ end
+ end
+end
+
+class ActiveRecordStoreTest < ActiveRecordTestCase
+ include CommonActiveRecordStoreTests
+
+ def session_class
+ CGI::Session::ActiveRecordStore::Session
+ end
+
+ def session_id_column
+ "session_id"
+ end
+
+ def setup
+ session_class.create_table!
+
+ ENV['REQUEST_METHOD'] = 'GET'
+ ENV['REQUEST_URI'] = '/'
+ CGI::Session::ActiveRecordStore.session_class = session_class
+
+ @cgi = CGI.new
+ @new_session = CGI::Session.new(@cgi, 'database_manager' => CGI::Session::ActiveRecordStore, 'new_session' => true)
+ @new_session['foo'] = 'bar'
+ end
+
+# this test only applies for eager session saving
+# def test_another_instance
+# @another = CGI::Session.new(@cgi, 'session_id' => @new_session.session_id, 'database_manager' => CGI::Session::ActiveRecordStore)
+# assert_equal @new_session.session_id, @another.session_id
+# end
+
+ def test_model_attribute
+ assert_kind_of CGI::Session::ActiveRecordStore::Session, @new_session.model
+ assert_equal({ 'foo' => 'bar' }, @new_session.model.data)
+ end
+
+ def test_save_unloaded_session
+ c = session_class.connection
+ bogus_class = c.quote(Base64.encode64("\004\010o:\vBlammo\000"))
+ c.insert("INSERT INTO #{session_class.table_name} ('#{session_id_column}', 'data') VALUES ('abcdefghijklmnop', #{bogus_class})")
+
+ sess = session_class.find_by_session_id('abcdefghijklmnop')
+ assert_not_nil sess
+ assert !sess.loaded?
+
+ # because the session is not loaded, the save should be a no-op. If it
+ # isn't, this'll try and unmarshall the bogus class, and should get an error.
+ assert_nothing_raised { sess.save }
+ end
+
+ def teardown
+ session_class.drop_table!
+ end
+end
+
+class ColumnLimitTest < ActiveRecordTestCase
+ def setup
+ @session_class = CGI::Session::ActiveRecordStore::Session
+ @session_class.create_table!
+ end
+
+ def teardown
+ @session_class.drop_table!
+ end
+
+ def test_protection_from_data_larger_than_column
+ # Can't test this unless there is a limit
+ return unless limit = @session_class.data_column_size_limit
+ too_big = ':(' * limit
+ s = @session_class.new(:session_id => '666', :data => {'foo' => too_big})
+ s.data
+ assert_raise(ActionController::SessionOverflowError) { s.save }
+ end
+end
+
+class DeprecatedActiveRecordStoreTest < ActiveRecordStoreTest
+ def session_id_column
+ "sessid"
+ end
+
+ def setup
+ session_class.connection.execute 'create table old_sessions (id integer primary key, sessid text unique, data text)'
+ session_class.table_name = 'old_sessions'
+ session_class.send :setup_sessid_compatibility!
+
+ ENV['REQUEST_METHOD'] = 'GET'
+ CGI::Session::ActiveRecordStore.session_class = session_class
+
+ @new_session = CGI::Session.new(CGI.new, 'database_manager' => CGI::Session::ActiveRecordStore, 'new_session' => true)
+ @new_session['foo'] = 'bar'
+ end
+
+ def teardown
+ session_class.connection.execute 'drop table old_sessions'
+ session_class.table_name = 'sessions'
+ end
+end
+
+class SqlBypassActiveRecordStoreTest < ActiveRecordStoreTest
+ def session_class
+ unless defined? @session_class
+ @session_class = CGI::Session::ActiveRecordStore::SqlBypass
+ @session_class.connection = CGI::Session::ActiveRecordStore::Session.connection
+ end
+ @session_class
+ end
+
+ def test_model_attribute
+ assert_kind_of CGI::Session::ActiveRecordStore::SqlBypass, @new_session.model
+ assert_equal({ 'foo' => 'bar' }, @new_session.model.data)
+ end
+end
diff --git a/vendor/rails-2.0.2/actionpack/test/activerecord/render_partial_with_record_identification_test.rb b/vendor/rails-2.0.2/actionpack/test/activerecord/render_partial_with_record_identification_test.rb
new file mode 100644
index 000000000..ccebbefea
--- /dev/null
+++ b/vendor/rails-2.0.2/actionpack/test/activerecord/render_partial_with_record_identification_test.rb
@@ -0,0 +1,74 @@
+require File.dirname(__FILE__) + '/../active_record_unit'
+
+class RenderPartialWithRecordIdentificationTest < ActiveRecordTestCase
+ fixtures :developers, :projects, :developers_projects, :topics, :replies
+
+ class RenderPartialWithRecordIdentificationController < ActionController::Base
+ def render_with_has_many_and_belongs_to_association
+ @developer = Developer.find(1)
+ render :partial => @developer.projects
+ end
+
+ def render_with_has_many_association
+ @topic = Topic.find(1)
+ render :partial => @topic.replies
+ end
+
+ def render_with_has_many_through_association
+ @developer = Developer.find(:first)
+ render :partial => @developer.topics
+ end
+
+ def render_with_belongs_to_association
+ @reply = Reply.find(1)
+ render :partial => @reply.topic
+ end
+
+ def render_with_record
+ @developer = Developer.find(:first)
+ render :partial => @developer
+ end
+
+ def render_with_record_collection
+ @developers = Developer.find(:all)
+ render :partial => @developers
+ end
+ end
+
+ def setup
+ @controller = RenderPartialWithRecordIdentificationController.new
+ @request = ActionController::TestRequest.new
+ @response = ActionController::TestResponse.new
+ super
+ end
+
+ def test_rendering_partial_with_has_many_and_belongs_to_association
+ get :render_with_has_many_and_belongs_to_association
+ assert_template 'projects/_project'
+ end
+
+ def test_rendering_partial_with_has_many_association
+ get :render_with_has_many_association
+ assert_template 'replies/_reply'
+ end
+
+ def test_rendering_partial_with_has_many_association
+ get :render_with_has_many_through_association
+ assert_template 'topics/_topic'
+ end
+
+ def test_rendering_partial_with_belongs_to_association
+ get :render_with_belongs_to_association
+ assert_template 'topics/_topic'
+ end
+
+ def test_render_with_record
+ get :render_with_record
+ assert_template 'developers/_developer'
+ end
+
+ def test_render_with_record_collection
+ get :render_with_record_collection
+ assert_template 'developers/_developer'
+ end
+end
diff --git a/vendor/rails-2.0.2/actionpack/test/controller/action_pack_assertions_test.rb b/vendor/rails-2.0.2/actionpack/test/controller/action_pack_assertions_test.rb
new file mode 100644
index 000000000..1eb9610d0
--- /dev/null
+++ b/vendor/rails-2.0.2/actionpack/test/controller/action_pack_assertions_test.rb
@@ -0,0 +1,492 @@
+require File.dirname(__FILE__) + '/../abstract_unit'
+
+# a controller class to facilitate the tests
+class ActionPackAssertionsController < ActionController::Base
+
+ # this does absolutely nothing
+ def nothing() head :ok end
+
+ # a standard template
+ def hello_world() render :template => "test/hello_world"; end
+
+ # a standard template
+ def hello_xml_world() render :template => "test/hello_xml_world"; end
+
+ # a redirect to an internal location
+ def redirect_internal() redirect_to "/nothing"; end
+
+ def redirect_to_action() redirect_to :action => "flash_me", :id => 1, :params => { "panda" => "fun" }; end
+
+ def redirect_to_controller() redirect_to :controller => "elsewhere", :action => "flash_me"; end
+
+ def redirect_to_controller_with_symbol() redirect_to :controller => :elsewhere, :action => :flash_me; end
+
+ def redirect_to_path() redirect_to '/some/path' end
+
+ def redirect_to_named_route() redirect_to route_one_url end
+
+ # a redirect to an external location
+ def redirect_external() redirect_to "http://www.rubyonrails.org"; end
+
+ # a 404
+ def response404() head '404 AWOL' end
+
+ # a 500
+ def response500() head '500 Sorry' end
+
+ # a fictional 599
+ def response599() head '599 Whoah!' end
+
+ # putting stuff in the flash
+ def flash_me
+ flash['hello'] = 'my name is inigo montoya...'
+ render :text => "Inconceivable!"
+ end
+
+ # we have a flash, but nothing is in it
+ def flash_me_naked
+ flash.clear
+ render :text => "wow!"
+ end
+
+ # assign some template instance variables
+ def assign_this
+ @howdy = "ho"
+ render :inline => "Mr. Henke"
+ end
+
+ def render_based_on_parameters
+ render :text => "Mr. #{params[:name]}"
+ end
+
+ def render_url
+ render :text => "#{url_for(:action => 'flash_me', :only_path => true)}
"
+ end
+
+ def render_text_with_custom_content_type
+ render :text => "Hello!", :content_type => Mime::RSS
+ end
+
+ # puts something in the session
+ def session_stuffing
+ session['xmas'] = 'turkey'
+ render :text => "ho ho ho"
+ end
+
+ # raises exception on get requests
+ def raise_on_get
+ raise "get" if request.get?
+ render :text => "request method: #{request.env['REQUEST_METHOD']}"
+ end
+
+ # raises exception on post requests
+ def raise_on_post
+ raise "post" if request.post?
+ render :text => "request method: #{request.env['REQUEST_METHOD']}"
+ end
+
+ def get_valid_record
+ @record = Class.new do
+ def valid?
+ true
+ end
+
+ def errors
+ Class.new do
+ def full_messages; []; end
+ end.new
+ end
+
+ end.new
+
+ render :nothing => true
+ end
+
+
+ def get_invalid_record
+ @record = Class.new do
+
+ def valid?
+ false
+ end
+
+ def errors
+ Class.new do
+ def full_messages; ['...stuff...']; end
+ end.new
+ end
+ end.new
+
+ render :nothing => true
+ end
+
+ # 911
+ def rescue_action(e) raise; end
+end
+
+module Admin
+ class InnerModuleController < ActionController::Base
+ def index
+ render :nothing => true
+ end
+
+ def redirect_to_index
+ redirect_to admin_inner_module_path
+ end
+
+ def redirect_to_absolute_controller
+ redirect_to :controller => '/content'
+ end
+
+ def redirect_to_fellow_controller
+ redirect_to :controller => 'user'
+ end
+
+ def redirect_to_top_level_named_route
+ redirect_to top_level_url(:id => "foo")
+ end
+ end
+end
+
+# ---------------------------------------------------------------------------
+
+
+# tell the controller where to find its templates but start from parent
+# directory of test_request_response to simulate the behaviour of a
+# production environment
+ActionPackAssertionsController.view_paths = [ File.dirname(__FILE__) + "/../fixtures/" ]
+
+# a test case to exercise the new capabilities TestRequest & TestResponse
+class ActionPackAssertionsControllerTest < Test::Unit::TestCase
+ # let's get this party started
+ def setup
+ ActionController::Routing::Routes.reload
+ ActionController::Routing.use_controllers!(%w(action_pack_assertions admin/inner_module content admin/user))
+ @controller = ActionPackAssertionsController.new
+ @request, @response = ActionController::TestRequest.new, ActionController::TestResponse.new
+ end
+
+ def teardown
+ ActionController::Routing::Routes.reload
+ end
+
+ # -- assertion-based testing ------------------------------------------------
+
+ def test_assert_tag_and_url_for
+ get :render_url
+ assert_tag :content => "/action_pack_assertions/flash_me"
+ end
+
+ # test the get method, make sure the request really was a get
+ def test_get
+ assert_raise(RuntimeError) { get :raise_on_get }
+ get :raise_on_post
+ assert_equal @response.body, 'request method: GET'
+ end
+
+ # test the get method, make sure the request really was a get
+ def test_post
+ assert_raise(RuntimeError) { post :raise_on_post }
+ post :raise_on_get
+ assert_equal @response.body, 'request method: POST'
+ end
+
+# the following test fails because the request_method is now cached on the request instance
+# test the get/post switch within one test action
+# def test_get_post_switch
+# post :raise_on_get
+# assert_equal @response.body, 'request method: POST'
+# get :raise_on_post
+# assert_equal @response.body, 'request method: GET'
+# post :raise_on_get
+# assert_equal @response.body, 'request method: POST'
+# get :raise_on_post
+# assert_equal @response.body, 'request method: GET'
+# end
+
+ # test the redirection to a named route
+ def test_assert_redirect_to_named_route
+ with_routing do |set|
+ set.draw do |map|
+ map.route_one 'route_one', :controller => 'action_pack_assertions', :action => 'nothing'
+ map.connect ':controller/:action/:id'
+ end
+ set.install_helpers
+
+ process :redirect_to_named_route
+ assert_redirected_to 'http://test.host/route_one'
+ assert_redirected_to route_one_url
+ assert_redirected_to :route_one_url
+ end
+ end
+
+ def test_assert_redirect_to_named_route_failure
+ with_routing do |set|
+ set.draw do |map|
+ map.route_one 'route_one', :controller => 'action_pack_assertions', :action => 'nothing', :id => 'one'
+ map.route_two 'route_two', :controller => 'action_pack_assertions', :action => 'nothing', :id => 'two'
+ map.connect ':controller/:action/:id'
+ end
+ process :redirect_to_named_route
+ assert_raise(Test::Unit::AssertionFailedError) do
+ assert_redirected_to 'http://test.host/route_two'
+ end
+ assert_raise(Test::Unit::AssertionFailedError) do
+ assert_redirected_to :controller => 'action_pack_assertions', :action => 'nothing', :id => 'two'
+ end
+ assert_raise(Test::Unit::AssertionFailedError) do
+ assert_redirected_to route_two_url
+ end
+ assert_raise(Test::Unit::AssertionFailedError) do
+ assert_redirected_to :route_two_url
+ end
+ end
+ end
+
+ def test_assert_redirect_to_nested_named_route
+ with_routing do |set|
+ set.draw do |map|
+ map.admin_inner_module 'admin/inner_module', :controller => 'admin/inner_module', :action => 'index'
+ map.connect ':controller/:action/:id'
+ end
+ @controller = Admin::InnerModuleController.new
+ process :redirect_to_index
+ # redirection is <{"action"=>"index", "controller"=>"admin/admin/inner_module"}>
+ assert_redirected_to admin_inner_module_path
+ end
+ end
+
+ def test_assert_redirected_to_top_level_named_route_from_nested_controller
+ with_routing do |set|
+ set.draw do |map|
+ map.top_level '/action_pack_assertions/:id', :controller => 'action_pack_assertions', :action => 'index'
+ map.connect ':controller/:action/:id'
+ end
+ @controller = Admin::InnerModuleController.new
+ process :redirect_to_top_level_named_route
+ # passes -> assert_redirected_to "http://test.host/action_pack_assertions/foo"
+ assert_redirected_to "/action_pack_assertions/foo"
+ end
+ end
+
+ # -- standard request/response object testing --------------------------------
+
+ # make sure that the template objects exist
+ def test_template_objects_alive
+ process :assign_this
+ assert !@response.has_template_object?('hi')
+ assert @response.has_template_object?('howdy')
+ end
+
+ # make sure we don't have template objects when we shouldn't
+ def test_template_object_missing
+ process :nothing
+ assert_nil @response.template_objects['howdy']
+ end
+
+ # check the empty flashing
+ def test_flash_me_naked
+ process :flash_me_naked
+ assert !@response.has_flash?
+ assert !@response.has_flash_with_contents?
+ end
+
+ # check if we have flash objects
+ def test_flash_haves
+ process :flash_me
+ assert @response.has_flash?
+ assert @response.has_flash_with_contents?
+ assert @response.has_flash_object?('hello')
+ end
+
+ # ensure we don't have flash objects
+ def test_flash_have_nots
+ process :nothing
+ assert !@response.has_flash?
+ assert !@response.has_flash_with_contents?
+ assert_nil @response.flash['hello']
+ end
+
+ # check if we were rendered by a file-based template?
+ def test_rendered_action
+ process :nothing
+ assert !@response.rendered_with_file?
+
+ process :hello_world
+ assert @response.rendered_with_file?
+ assert 'hello_world', @response.rendered_file
+ end
+
+ # check the redirection location
+ def test_redirection_location
+ process :redirect_internal
+ assert_equal 'http://test.host/nothing', @response.redirect_url
+
+ process :redirect_external
+ assert_equal 'http://www.rubyonrails.org', @response.redirect_url
+ end
+
+ def test_no_redirect_url
+ process :nothing
+ assert_nil @response.redirect_url
+ end
+
+
+ # check server errors
+ def test_server_error_response_code
+ process :response500
+ assert @response.server_error?
+
+ process :response599
+ assert @response.server_error?
+
+ process :response404
+ assert !@response.server_error?
+ end
+
+ # check a 404 response code
+ def test_missing_response_code
+ process :response404
+ assert @response.missing?
+ end
+
+ # check to see if our redirection matches a pattern
+ def test_redirect_url_match
+ process :redirect_external
+ assert @response.redirect?
+ assert @response.redirect_url_match?("rubyonrails")
+ assert @response.redirect_url_match?(/rubyonrails/)
+ assert !@response.redirect_url_match?("phpoffrails")
+ assert !@response.redirect_url_match?(/perloffrails/)
+ end
+
+ # check for a redirection
+ def test_redirection
+ process :redirect_internal
+ assert @response.redirect?
+
+ process :redirect_external
+ assert @response.redirect?
+
+ process :nothing
+ assert !@response.redirect?
+ end
+
+ # check a successful response code
+ def test_successful_response_code
+ process :nothing
+ assert @response.success?
+ end
+
+ # a basic check to make sure we have a TestResponse object
+ def test_has_response
+ process :nothing
+ assert_kind_of ActionController::TestResponse, @response
+ end
+
+ def test_render_based_on_parameters
+ process :render_based_on_parameters, "name" => "David"
+ assert_equal "Mr. David", @response.body
+ end
+
+ def test_follow_redirect
+ process :redirect_to_action
+ assert_redirected_to :action => "flash_me"
+
+ follow_redirect
+ assert_equal 1, @request.parameters["id"].to_i
+
+ assert "Inconceivable!", @response.body
+ end
+
+ def test_follow_redirect_outside_current_action
+ process :redirect_to_controller
+ assert_redirected_to :controller => "elsewhere", :action => "flash_me"
+
+ assert_raises(RuntimeError, "Can't follow redirects outside of current controller (elsewhere)") { follow_redirect }
+ end
+
+ def test_assert_redirection_fails_with_incorrect_controller
+ process :redirect_to_controller
+ assert_raise(Test::Unit::AssertionFailedError) do
+ assert_redirected_to :controller => "action_pack_assertions", :action => "flash_me"
+ end
+ end
+
+ def test_assert_redirection_with_extra_controller_option
+ get :redirect_to_action
+ assert_redirected_to :controller => 'action_pack_assertions', :action => "flash_me", :id => 1, :params => { :panda => 'fun' }
+ end
+
+ def test_redirected_to_url_leadling_slash
+ process :redirect_to_path
+ assert_redirected_to '/some/path'
+ end
+ def test_redirected_to_url_no_leadling_slash
+ process :redirect_to_path
+ assert_redirected_to 'some/path'
+ end
+ def test_redirected_to_url_full_url
+ process :redirect_to_path
+ assert_redirected_to 'http://test.host/some/path'
+ end
+
+ def test_assert_redirection_with_symbol
+ process :redirect_to_controller_with_symbol
+ assert_nothing_raised {
+ assert_redirected_to :controller => "elsewhere", :action => "flash_me"
+ }
+ process :redirect_to_controller_with_symbol
+ assert_nothing_raised {
+ assert_redirected_to :controller => :elsewhere, :action => :flash_me
+ }
+ end
+
+ def test_redirected_to_with_nested_controller
+ @controller = Admin::InnerModuleController.new
+ get :redirect_to_absolute_controller
+ assert_redirected_to :controller => 'content'
+
+ get :redirect_to_fellow_controller
+ assert_redirected_to :controller => 'admin/user'
+ end
+
+ def test_assert_valid
+ get :get_valid_record
+ assert_valid assigns('record')
+ end
+
+ def test_assert_valid_failing
+ get :get_invalid_record
+
+ begin
+ assert_valid assigns('record')
+ assert false
+ rescue Test::Unit::AssertionFailedError => e
+ end
+ end
+end
+
+class ActionPackHeaderTest < Test::Unit::TestCase
+ def setup
+ @controller = ActionPackAssertionsController.new
+ @request, @response = ActionController::TestRequest.new, ActionController::TestResponse.new
+ end
+
+ def test_rendering_xml_sets_content_type
+ process :hello_xml_world
+ assert_equal('application/xml; charset=utf-8', @response.headers['type'])
+ end
+
+ def test_rendering_xml_respects_content_type
+ @response.headers['type'] = 'application/pdf'
+ process :hello_xml_world
+ assert_equal('application/pdf; charset=utf-8', @response.headers['type'])
+ end
+
+
+ def test_render_text_with_custom_content_type
+ get :render_text_with_custom_content_type
+ assert_equal 'application/rss+xml; charset=utf-8', @response.headers['type']
+ end
+end
diff --git a/vendor/rails-2.0.2/actionpack/test/controller/addresses_render_test.rb b/vendor/rails-2.0.2/actionpack/test/controller/addresses_render_test.rb
new file mode 100644
index 000000000..d1e9122dc
--- /dev/null
+++ b/vendor/rails-2.0.2/actionpack/test/controller/addresses_render_test.rb
@@ -0,0 +1,43 @@
+require File.dirname(__FILE__) + '/../abstract_unit'
+
+class Address
+
+ def Address.count(conditions = nil, join = nil)
+ nil
+ end
+
+ def Address.find_all(arg1, arg2, arg3, arg4)
+ []
+ end
+
+ def self.find(*args)
+ []
+ end
+end
+
+class AddressesTestController < ActionController::Base
+ def self.controller_name; "addresses"; end
+ def self.controller_path; "addresses"; end
+end
+
+AddressesTestController.view_paths = [ File.dirname(__FILE__) + "/../fixtures/" ]
+
+class AddressesTest < Test::Unit::TestCase
+ def setup
+ @controller = AddressesTestController.new
+
+ # enable a logger so that (e.g.) the benchmarking stuff runs, so we can get
+ # a more accurate simulation of what happens in "real life".
+ @controller.logger = Logger.new(nil)
+
+ @request = ActionController::TestRequest.new
+ @response = ActionController::TestResponse.new
+
+ @request.host = "www.nextangle.com"
+ end
+
+ def test_list
+ get :list
+ assert_equal "We only need to get this far!", @response.body.chomp
+ end
+end
diff --git a/vendor/rails-2.0.2/actionpack/test/controller/assert_select_test.rb b/vendor/rails-2.0.2/actionpack/test/controller/assert_select_test.rb
new file mode 100644
index 000000000..b0f3d6ced
--- /dev/null
+++ b/vendor/rails-2.0.2/actionpack/test/controller/assert_select_test.rb
@@ -0,0 +1,682 @@
+#--
+# Copyright (c) 2006 Assaf Arkin (http://labnotes.org)
+# Under MIT and/or CC By license.
+#++
+
+require "#{File.dirname(__FILE__)}/../abstract_unit"
+require "#{File.dirname(__FILE__)}/fake_controllers"
+
+
+unless defined?(ActionMailer)
+ begin
+ $:.unshift(File.dirname(__FILE__) + "/../../../actionmailer/lib")
+ require 'action_mailer'
+ rescue LoadError
+ require 'rubygems'
+ gem 'actionmailer'
+ end
+end
+
+class AssertSelectTest < Test::Unit::TestCase
+ class AssertSelectController < ActionController::Base
+ def response_with=(content)
+ @content = content
+ end
+
+ def response_with(&block)
+ @update = block
+ end
+
+ def html()
+ render :text=>@content, :layout=>false, :content_type=>Mime::HTML
+ @content = nil
+ end
+
+ def rjs()
+ render :update do |page|
+ @update.call page
+ end
+ @update = nil
+ end
+
+ def xml()
+ render :text=>@content, :layout=>false, :content_type=>Mime::XML
+ @content = nil
+ end
+
+ def rescue_action(e)
+ raise e
+ end
+ end
+
+ class AssertSelectMailer < ActionMailer::Base
+ def test(html)
+ recipients "test "
+ from "test@test.host"
+ subject "Test e-mail"
+ part :content_type=>"text/html", :body=>html
+ end
+ end
+
+ AssertionFailedError = Test::Unit::AssertionFailedError
+
+ def setup
+ @controller = AssertSelectController.new
+ @request = ActionController::TestRequest.new
+ @response = ActionController::TestResponse.new
+ ActionMailer::Base.delivery_method = :test
+ ActionMailer::Base.perform_deliveries = true
+ ActionMailer::Base.deliveries = []
+ end
+
+
+ def teardown
+ ActionMailer::Base.deliveries.clear
+ end
+
+ def assert_failure(message, &block)
+ e = assert_raises(AssertionFailedError, &block)
+ assert_match(message, e.message) if Regexp === message
+ assert_equal(message, e.message) if String === message
+ end
+
+ #
+ # Test assert select.
+ #
+
+ def test_assert_select
+ render_html %Q{
}
+ assert_select "div", 2
+ assert_failure(/Expected at least 3 elements matching \"div\", found 2/) { assert_select "div", 3 }
+ assert_failure(/Expected at least 1 element matching \"p\", found 0/) { assert_select "p" }
+ end
+
+
+ def test_equality_true_false
+ render_html %Q{
}
+ assert_nothing_raised { assert_select "div" }
+ assert_raises(AssertionFailedError) { assert_select "p" }
+ assert_nothing_raised { assert_select "div", true }
+ assert_raises(AssertionFailedError) { assert_select "p", true }
+ assert_raises(AssertionFailedError) { assert_select "div", false }
+ assert_nothing_raised { assert_select "p", false }
+ end
+
+
+ def test_equality_string_and_regexp
+ render_html %Q{foo
foo
}
+ assert_nothing_raised { assert_select "div", "foo" }
+ assert_raises(AssertionFailedError) { assert_select "div", "bar" }
+ assert_nothing_raised { assert_select "div", :text=>"foo" }
+ assert_raises(AssertionFailedError) { assert_select "div", :text=>"bar" }
+ assert_nothing_raised { assert_select "div", /(foo|bar)/ }
+ assert_raises(AssertionFailedError) { assert_select "div", /foobar/ }
+ assert_nothing_raised { assert_select "div", :text=>/(foo|bar)/ }
+ assert_raises(AssertionFailedError) { assert_select "div", :text=>/foobar/ }
+ assert_raises(AssertionFailedError) { assert_select "p", :text=>/foobar/ }
+ end
+
+
+ def test_equality_of_html
+ render_html %Q{\n"This is not a big problem," he said.\n
}
+ text = "\"This is not a big problem,\" he said."
+ html = "\"This is not a big problem,\" he said."
+ assert_nothing_raised { assert_select "p", text }
+ assert_raises(AssertionFailedError) { assert_select "p", html }
+ assert_nothing_raised { assert_select "p", :html=>html }
+ assert_raises(AssertionFailedError) { assert_select "p", :html=>text }
+ # No stripping for pre.
+ render_html %Q{\n"This is not a big problem," he said.\n }
+ text = "\n\"This is not a big problem,\" he said.\n"
+ html = "\n\"This is not a big problem,\" he said.\n"
+ assert_nothing_raised { assert_select "pre", text }
+ assert_raises(AssertionFailedError) { assert_select "pre", html }
+ assert_nothing_raised { assert_select "pre", :html=>html }
+ assert_raises(AssertionFailedError) { assert_select "pre", :html=>text }
+ end
+
+
+ def test_counts
+ render_html %Q{foo
foo
}
+ assert_nothing_raised { assert_select "div", 2 }
+ assert_failure(/Expected at least 3 elements matching \"div\", found 2/) do
+ assert_select "div", 3
+ end
+ assert_nothing_raised { assert_select "div", 1..2 }
+ assert_failure(/Expected between 3 and 4 elements matching \"div\", found 2/) do
+ assert_select "div", 3..4
+ end
+ assert_nothing_raised { assert_select "div", :count=>2 }
+ assert_failure(/Expected at least 3 elements matching \"div\", found 2/) do
+ assert_select "div", :count=>3
+ end
+ assert_nothing_raised { assert_select "div", :minimum=>1 }
+ assert_nothing_raised { assert_select "div", :minimum=>2 }
+ assert_failure(/Expected at least 3 elements matching \"div\", found 2/) do
+ assert_select "div", :minimum=>3
+ end
+ assert_nothing_raised { assert_select "div", :maximum=>2 }
+ assert_nothing_raised { assert_select "div", :maximum=>3 }
+ assert_failure(/Expected at most 1 element matching \"div\", found 2/) do
+ assert_select "div", :maximum=>1
+ end
+ assert_nothing_raised { assert_select "div", :minimum=>1, :maximum=>2 }
+ assert_failure(/Expected between 3 and 4 elements matching \"div\", found 2/) do
+ assert_select "div", :minimum=>3, :maximum=>4
+ end
+ end
+
+
+ def test_substitution_values
+ render_html %Q{foo
foo
}
+ assert_select "div#?", /\d+/ do |elements|
+ assert_equal 2, elements.size
+ end
+ assert_select "div" do
+ assert_select "div#?", /\d+/ do |elements|
+ assert_equal 2, elements.size
+ assert_select "#1"
+ assert_select "#2"
+ end
+ end
+ end
+
+
+ def test_nested_assert_select
+ render_html %Q{foo
foo
}
+ assert_select "div" do |elements|
+ assert_equal 2, elements.size
+ assert_select elements[0], "#1"
+ assert_select elements[1], "#2"
+ end
+ assert_select "div" do
+ assert_select "div" do |elements|
+ assert_equal 2, elements.size
+ # Testing in a group is one thing
+ assert_select "#1,#2"
+ # Testing individually is another.
+ assert_select "#1"
+ assert_select "#2"
+ assert_select "#3", false
+ end
+ end
+
+ assert_failure(/Expected at least 1 element matching \"#4\", found 0\./) do
+ assert_select "div" do
+ assert_select "#4"
+ end
+ end
+ end
+
+
+ def test_assert_select_text_match
+ render_html %Q{foo
bar
}
+ assert_select "div" do
+ assert_nothing_raised { assert_select "div", "foo" }
+ assert_nothing_raised { assert_select "div", "bar" }
+ assert_nothing_raised { assert_select "div", /\w*/ }
+ assert_nothing_raised { assert_select "div", /\w*/, :count=>2 }
+ assert_raises(AssertionFailedError) { assert_select "div", :text=>"foo", :count=>2 }
+ assert_nothing_raised { assert_select "div", :html=>"bar " }
+ assert_nothing_raised { assert_select "div", :html=>"bar " }
+ assert_nothing_raised { assert_select "div", :html=>/\w*/ }
+ assert_nothing_raised { assert_select "div", :html=>/\w*/, :count=>2 }
+ assert_raises(AssertionFailedError) { assert_select "div", :html=>"foo ", :count=>2 }
+ end
+ end
+
+
+ # With single result.
+ def test_assert_select_from_rjs_with_single_result
+ render_rjs do |page|
+ page.replace_html "test", "foo
\nfoo
"
+ end
+ assert_select "div" do |elements|
+ assert elements.size == 2
+ assert_select "#1"
+ assert_select "#2"
+ end
+ assert_select "div#?", /\d+/ do |elements|
+ assert_select "#1"
+ assert_select "#2"
+ end
+ end
+
+ # With multiple results.
+ def test_assert_select_from_rjs_with_multiple_results
+ render_rjs do |page|
+ page.replace_html "test", "foo
"
+ page.replace_html "test2", "foo
"
+ end
+ assert_select "div" do |elements|
+ assert elements.size == 2
+ assert_select "#1"
+ assert_select "#2"
+ end
+ end
+
+
+ #
+ # Test css_select.
+ #
+
+
+ def test_css_select
+ render_html %Q{
}
+ assert 2, css_select("div").size
+ assert 0, css_select("p").size
+ end
+
+
+ def test_nested_css_select
+ render_html %Q{foo
foo
}
+ assert_select "div#?", /\d+/ do |elements|
+ assert_equal 1, css_select(elements[0], "div").size
+ assert_equal 1, css_select(elements[1], "div").size
+ end
+ assert_select "div" do
+ assert_equal 2, css_select("div").size
+ css_select("div").each do |element|
+ # Testing as a group is one thing
+ assert !css_select("#1,#2").empty?
+ # Testing individually is another
+ assert !css_select("#1").empty?
+ assert !css_select("#2").empty?
+ end
+ end
+ end
+
+
+ # With one result.
+ def test_css_select_from_rjs_with_single_result
+ render_rjs do |page|
+ page.replace_html "test", "foo
\nfoo
"
+ end
+ assert_equal 2, css_select("div").size
+ assert_equal 1, css_select("#1").size
+ assert_equal 1, css_select("#2").size
+ end
+
+ # With multiple results.
+ def test_css_select_from_rjs_with_multiple_results
+ render_rjs do |page|
+ page.replace_html "test", "foo
"
+ page.replace_html "test2", "foo
"
+ end
+
+ assert_equal 2, css_select("div").size
+ assert_equal 1, css_select("#1").size
+ assert_equal 1, css_select("#2").size
+ end
+
+
+ #
+ # Test assert_select_rjs.
+ #
+
+
+ # Test that we can pick up all statements in the result.
+ def test_assert_select_rjs_picks_up_all_statements
+ render_rjs do |page|
+ page.replace "test", "foo
"
+ page.replace_html "test2", "foo
"
+ page.insert_html :top, "test3", "foo
"
+ end
+
+ found = false
+ assert_select_rjs do
+ assert_select "#1"
+ assert_select "#2"
+ assert_select "#3"
+ found = true
+ end
+ assert found
+ end
+
+ # Test that we fail if there is nothing to pick.
+ def test_assert_select_rjs_fails_if_nothing_to_pick
+ render_rjs { }
+ assert_raises(AssertionFailedError) { assert_select_rjs }
+ end
+
+ def test_assert_select_rjs_with_unicode
+ # Test that non-ascii characters (which are converted into \uXXXX in RJS) are decoded correctly.
+ render_rjs do |page|
+ page.replace "test", "\343\203\201\343\202\261\343\203\203\343\203\210
"
+ end
+ assert_select_rjs do
+ assert_select "#1", :text => "\343\203\201\343\202\261\343\203\203\343\203\210"
+ assert_select "#1", "\343\203\201\343\202\261\343\203\203\343\203\210"
+ assert_select "#1", Regexp.new("\343\203\201..\343\203\210",0,'U')
+ assert_raises(AssertionFailedError) { assert_select "#1", Regexp.new("\343\203\201.\343\203\210",0,'U') }
+ end
+ end
+
+ def test_assert_select_rjs_with_id
+ # Test that we can pick up all statements in the result.
+ render_rjs do |page|
+ page.replace "test1", "foo
"
+ page.replace_html "test2", "foo
"
+ page.insert_html :top, "test3", "foo
"
+ end
+ assert_select_rjs "test1" do
+ assert_select "div", 1
+ assert_select "#1"
+ end
+ assert_select_rjs "test2" do
+ assert_select "div", 1
+ assert_select "#2"
+ end
+ assert_select_rjs "test3" do
+ assert_select "div", 1
+ assert_select "#3"
+ end
+ assert_raises(AssertionFailedError) { assert_select_rjs "test4" }
+ end
+
+
+ def test_assert_select_rjs_for_replace
+ render_rjs do |page|
+ page.replace "test1", "foo
"
+ page.replace_html "test2", "foo
"
+ page.insert_html :top, "test3", "foo
"
+ end
+ # Replace.
+ assert_select_rjs :replace do
+ assert_select "div", 1
+ assert_select "#1"
+ end
+ assert_select_rjs :replace, "test1" do
+ assert_select "div", 1
+ assert_select "#1"
+ end
+ assert_raises(AssertionFailedError) { assert_select_rjs :replace, "test2" }
+ # Replace HTML.
+ assert_select_rjs :replace_html do
+ assert_select "div", 1
+ assert_select "#2"
+ end
+ assert_select_rjs :replace_html, "test2" do
+ assert_select "div", 1
+ assert_select "#2"
+ end
+ assert_raises(AssertionFailedError) { assert_select_rjs :replace_html, "test1" }
+ end
+
+ def test_assert_select_rjs_for_chained_replace
+ render_rjs do |page|
+ page['test1'].replace "foo
"
+ page['test2'].replace_html "foo
"
+ page.insert_html :top, "test3", "foo
"
+ end
+ # Replace.
+ assert_select_rjs :chained_replace do
+ assert_select "div", 1
+ assert_select "#1"
+ end
+ assert_select_rjs :chained_replace, "test1" do
+ assert_select "div", 1
+ assert_select "#1"
+ end
+ assert_raises(AssertionFailedError) { assert_select_rjs :chained_replace, "test2" }
+ # Replace HTML.
+ assert_select_rjs :chained_replace_html do
+ assert_select "div", 1
+ assert_select "#2"
+ end
+ assert_select_rjs :chained_replace_html, "test2" do
+ assert_select "div", 1
+ assert_select "#2"
+ end
+ assert_raises(AssertionFailedError) { assert_select_rjs :replace_html, "test1" }
+ end
+
+ # Simple remove
+ def test_assert_select_rjs_for_remove
+ render_rjs do |page|
+ page.remove "test1"
+ end
+
+ assert_select_rjs :remove, "test1"
+ end
+
+ def test_assert_select_rjs_for_remove_ignores_block
+ render_rjs do |page|
+ page.remove "test1"
+ end
+
+ assert_nothing_raised do
+ assert_select_rjs :remove, "test1" do
+ assert_select "p"
+ end
+ end
+ end
+
+ # Simple show
+ def test_assert_select_rjs_for_show
+ render_rjs do |page|
+ page.show "test1"
+ end
+
+ assert_select_rjs :show, "test1"
+ end
+
+ def test_assert_select_rjs_for_show_ignores_block
+ render_rjs do |page|
+ page.show "test1"
+ end
+
+ assert_nothing_raised do
+ assert_select_rjs :show, "test1" do
+ assert_select "p"
+ end
+ end
+ end
+
+ # Simple hide
+ def test_assert_select_rjs_for_hide
+ render_rjs do |page|
+ page.hide "test1"
+ end
+
+ assert_select_rjs :hide, "test1"
+ end
+
+ def test_assert_select_rjs_for_hide_ignores_block
+ render_rjs do |page|
+ page.hide "test1"
+ end
+
+ assert_nothing_raised do
+ assert_select_rjs :hide, "test1" do
+ assert_select "p"
+ end
+ end
+ end
+
+ # Simple toggle
+ def test_assert_select_rjs_for_toggle
+ render_rjs do |page|
+ page.toggle "test1"
+ end
+
+ assert_select_rjs :toggle, "test1"
+ end
+
+ def test_assert_select_rjs_for_toggle_ignores_block
+ render_rjs do |page|
+ page.toggle "test1"
+ end
+
+ assert_nothing_raised do
+ assert_select_rjs :toggle, "test1" do
+ assert_select "p"
+ end
+ end
+ end
+
+ # Non-positioned insert.
+ def test_assert_select_rjs_for_nonpositioned_insert
+ render_rjs do |page|
+ page.replace "test1", "foo
"
+ page.replace_html "test2", "foo
"
+ page.insert_html :top, "test3", "foo
"
+ end
+ assert_select_rjs :insert_html do
+ assert_select "div", 1
+ assert_select "#3"
+ end
+ assert_select_rjs :insert_html, "test3" do
+ assert_select "div", 1
+ assert_select "#3"
+ end
+ assert_raises(AssertionFailedError) { assert_select_rjs :insert_html, "test1" }
+ end
+
+ # Positioned insert.
+ def test_assert_select_rjs_for_positioned_insert
+ render_rjs do |page|
+ page.insert_html :top, "test1", "foo
"
+ page.insert_html :bottom, "test2", "foo
"
+ page.insert_html :before, "test3", "foo
"
+ page.insert_html :after, "test4", "foo
"
+ end
+ assert_select_rjs :insert, :top do
+ assert_select "div", 1
+ assert_select "#1"
+ end
+ assert_select_rjs :insert, :bottom do
+ assert_select "div", 1
+ assert_select "#2"
+ end
+ assert_select_rjs :insert, :before do
+ assert_select "div", 1
+ assert_select "#3"
+ end
+ assert_select_rjs :insert, :after do
+ assert_select "div", 1
+ assert_select "#4"
+ end
+ assert_select_rjs :insert_html do
+ assert_select "div", 4
+ end
+ end
+
+ # Simple selection from a single result.
+ def test_nested_assert_select_rjs_with_single_result
+ render_rjs do |page|
+ page.replace_html "test", "foo
\nfoo
"
+ end
+
+ assert_select_rjs "test" do |elements|
+ assert_equal 2, elements.size
+ assert_select "#1"
+ assert_select "#2"
+ end
+ end
+
+ # Deal with two results.
+ def test_nested_assert_select_rjs_with_two_results
+ render_rjs do |page|
+ page.replace_html "test", "foo
"
+ page.replace_html "test2", "foo
"
+ end
+
+ assert_select_rjs "test" do |elements|
+ assert_equal 1, elements.size
+ assert_select "#1"
+ end
+
+ assert_select_rjs "test2" do |elements|
+ assert_equal 1, elements.size
+ assert_select "#2"
+ end
+ end
+
+
+ def test_feed_item_encoded
+ render_xml <<-EOF
+
+
+ -
+
+ Test 1
+ ]]>
+
+
+ -
+
+ Test 2
+ ]]>
+
+
+
+
+EOF
+ assert_select "channel item description" do
+ # Test element regardless of wrapper.
+ assert_select_encoded do
+ assert_select "p", :count=>2, :text=>/Test/
+ end
+ # Test through encoded wrapper.
+ assert_select_encoded do
+ assert_select "encoded p", :count=>2, :text=>/Test/
+ end
+ # Use :root instead (recommended)
+ assert_select_encoded do
+ assert_select ":root p", :count=>2, :text=>/Test/
+ end
+ # Test individually.
+ assert_select "description" do |elements|
+ assert_select_encoded elements[0] do
+ assert_select "p", "Test 1"
+ end
+ assert_select_encoded elements[1] do
+ assert_select "p", "Test 2"
+ end
+ end
+ end
+
+ # Test that we only un-encode element itself.
+ assert_select "channel item" do
+ assert_select_encoded do
+ assert_select "p", 0
+ end
+ end
+ end
+
+
+ #
+ # Test assert_select_email
+ #
+
+ def test_assert_select_email
+ assert_raises(AssertionFailedError) { assert_select_email {} }
+ AssertSelectMailer.deliver_test ""
+ assert_select_email do
+ assert_select "div:root" do
+ assert_select "p:first-child", "foo"
+ assert_select "p:last-child", "bar"
+ end
+ end
+ end
+
+
+ protected
+ def render_html(html)
+ @controller.response_with = html
+ get :html
+ end
+
+ def render_rjs(&block)
+ @controller.response_with &block
+ get :rjs
+ end
+
+ def render_xml(xml)
+ @controller.response_with = xml
+ get :xml
+ end
+end
diff --git a/vendor/rails-2.0.2/actionpack/test/controller/base_test.rb b/vendor/rails-2.0.2/actionpack/test/controller/base_test.rb
new file mode 100644
index 000000000..60e61b628
--- /dev/null
+++ b/vendor/rails-2.0.2/actionpack/test/controller/base_test.rb
@@ -0,0 +1,134 @@
+require File.dirname(__FILE__) + '/../abstract_unit'
+require 'test/unit'
+require 'pp' # require 'pp' early to prevent hidden_methods from not picking up the pretty-print methods until too late
+
+# Provide some controller to run the tests on.
+module Submodule
+ class ContainedEmptyController < ActionController::Base
+ end
+ class ContainedNonEmptyController < ActionController::Base
+ def public_action
+ end
+
+ hide_action :hidden_action
+ def hidden_action
+ raise "Noooo!"
+ end
+
+ def another_hidden_action
+ end
+ hide_action :another_hidden_action
+ end
+ class SubclassedController < ContainedNonEmptyController
+ hide_action :public_action # Hiding it here should not affect the superclass.
+ end
+end
+class EmptyController < ActionController::Base
+end
+class NonEmptyController < ActionController::Base
+ def public_action
+ end
+
+ hide_action :hidden_action
+ def hidden_action
+ end
+end
+
+class MethodMissingController < ActionController::Base
+
+ hide_action :shouldnt_be_called
+ def shouldnt_be_called
+ raise "NO WAY!"
+ end
+
+protected
+
+ def method_missing(selector)
+ render :text => selector.to_s
+ end
+
+end
+
+class ControllerClassTests < Test::Unit::TestCase
+ def test_controller_path
+ assert_equal 'empty', EmptyController.controller_path
+ assert_equal EmptyController.controller_path, EmptyController.new.controller_path
+ assert_equal 'submodule/contained_empty', Submodule::ContainedEmptyController.controller_path
+ assert_equal Submodule::ContainedEmptyController.controller_path, Submodule::ContainedEmptyController.new.controller_path
+ end
+ def test_controller_name
+ assert_equal 'empty', EmptyController.controller_name
+ assert_equal 'contained_empty', Submodule::ContainedEmptyController.controller_name
+ end
+end
+
+class ControllerInstanceTests < Test::Unit::TestCase
+ def setup
+ @empty = EmptyController.new
+ @contained = Submodule::ContainedEmptyController.new
+ @empty_controllers = [@empty, @contained, Submodule::SubclassedController.new]
+
+ @non_empty_controllers = [NonEmptyController.new,
+ Submodule::ContainedNonEmptyController.new]
+ end
+
+ def test_action_methods
+ @empty_controllers.each do |c|
+ hide_mocha_methods_from_controller(c)
+ assert_equal Set.new, c.send!(:action_methods), "#{c.controller_path} should be empty!"
+ end
+ @non_empty_controllers.each do |c|
+ hide_mocha_methods_from_controller(c)
+ assert_equal Set.new(%w(public_action)), c.send!(:action_methods), "#{c.controller_path} should not be empty!"
+ end
+ end
+
+ protected
+ # Mocha adds some public instance methods to Object that would be
+ # considered actions, so explicitly hide_action them.
+ def hide_mocha_methods_from_controller(controller)
+ mocha_methods = [:expects, :metaclass, :mocha, :mocha_inspect, :reset_mocha, :stubba_object, :stubba_method, :stubs, :verify, :__metaclass__, :__is_a__]
+ controller.class.send!(:hide_action, *mocha_methods)
+ end
+end
+
+
+class PerformActionTest < Test::Unit::TestCase
+ def use_controller(controller_class)
+ @controller = controller_class.new
+
+ # enable a logger so that (e.g.) the benchmarking stuff runs, so we can get
+ # a more accurate simulation of what happens in "real life".
+ @controller.logger = Logger.new(nil)
+
+ @request = ActionController::TestRequest.new
+ @response = ActionController::TestResponse.new
+
+ @request.host = "www.nextangle.com"
+ end
+
+ def test_get_on_priv_should_show_selector
+ use_controller MethodMissingController
+ get :shouldnt_be_called
+ assert_response :success
+ assert_equal 'shouldnt_be_called', @response.body
+ end
+
+ def test_method_missing_is_not_an_action_name
+ use_controller MethodMissingController
+ assert ! @controller.send!(:action_methods).include?('method_missing')
+
+ get :method_missing
+ assert_response :success
+ assert_equal 'method_missing', @response.body
+ end
+
+ def test_get_on_hidden_should_fail
+ use_controller NonEmptyController
+ get :hidden_action
+ assert_response 404
+
+ get :another_hidden_action
+ assert_response 404
+ end
+end
diff --git a/vendor/rails-2.0.2/actionpack/test/controller/benchmark_test.rb b/vendor/rails-2.0.2/actionpack/test/controller/benchmark_test.rb
new file mode 100644
index 000000000..f346e575e
--- /dev/null
+++ b/vendor/rails-2.0.2/actionpack/test/controller/benchmark_test.rb
@@ -0,0 +1,33 @@
+require File.dirname(__FILE__) + '/../abstract_unit'
+require 'test/unit'
+
+# Provide some static controllers.
+class BenchmarkedController < ActionController::Base
+ def public_action
+ render :nothing => true
+ end
+
+ def rescue_action(e)
+ raise e
+ end
+end
+
+class BenchmarkTest < Test::Unit::TestCase
+ class MockLogger
+ def method_missing(*args)
+ end
+ end
+
+ def setup
+ @controller = BenchmarkedController.new
+ # benchmark doesn't do anything unless a logger is set
+ @controller.logger = MockLogger.new
+ @request, @response = ActionController::TestRequest.new, ActionController::TestResponse.new
+ @request.host = "test.actioncontroller.i"
+ end
+
+ def test_with_http_1_0_request
+ @request.host = nil
+ assert_nothing_raised { get :public_action }
+ end
+end
diff --git a/vendor/rails-2.0.2/actionpack/test/controller/caching_test.rb b/vendor/rails-2.0.2/actionpack/test/controller/caching_test.rb
new file mode 100644
index 000000000..d6982fbc8
--- /dev/null
+++ b/vendor/rails-2.0.2/actionpack/test/controller/caching_test.rb
@@ -0,0 +1,349 @@
+require 'fileutils'
+require File.dirname(__FILE__) + '/../abstract_unit'
+
+CACHE_DIR = 'test_cache'
+# Don't change '/../temp/' cavalierly or you might hose something you don't want hosed
+FILE_STORE_PATH = File.join(File.dirname(__FILE__), '/../temp/', CACHE_DIR)
+ActionController::Base.page_cache_directory = FILE_STORE_PATH
+ActionController::Base.fragment_cache_store = :file_store, FILE_STORE_PATH
+
+class PageCachingTestController < ActionController::Base
+ caches_page :ok, :no_content, :found, :not_found
+
+ def ok
+ head :ok
+ end
+
+ def no_content
+ head :no_content
+ end
+
+ def found
+ redirect_to :action => 'ok'
+ end
+
+ def not_found
+ head :not_found
+ end
+
+ def custom_path
+ render :text => "Super soaker"
+ cache_page("Super soaker", "/index.html")
+ end
+
+ def expire_custom_path
+ expire_page("/index.html")
+ head :ok
+ end
+
+ def trailing_slash
+ render :text => "Sneak attack"
+ end
+end
+
+class PageCachingTest < Test::Unit::TestCase
+ def setup
+ ActionController::Base.perform_caching = true
+
+ ActionController::Routing::Routes.draw do |map|
+ map.main '', :controller => 'posts'
+ map.resources :posts
+ map.connect ':controller/:action/:id'
+ end
+
+ @request = ActionController::TestRequest.new
+ @request.host = 'hostname.com'
+
+ @response = ActionController::TestResponse.new
+ @controller = PageCachingTestController.new
+
+ @params = {:controller => 'posts', :action => 'index', :only_path => true, :skip_relative_url_root => true}
+ @rewriter = ActionController::UrlRewriter.new(@request, @params)
+
+ FileUtils.rm_rf(File.dirname(FILE_STORE_PATH))
+ FileUtils.mkdir_p(FILE_STORE_PATH)
+ end
+
+ def teardown
+ FileUtils.rm_rf(File.dirname(FILE_STORE_PATH))
+
+ ActionController::Base.perform_caching = false
+ end
+
+ def test_page_caching_resources_saves_to_correct_path_with_extension_even_if_default_route
+ @params[:format] = 'rss'
+ assert_equal '/posts.rss', @rewriter.rewrite(@params)
+ @params[:format] = nil
+ assert_equal '/', @rewriter.rewrite(@params)
+ end
+
+ def test_should_cache_get_with_ok_status
+ get :ok
+ assert_response :ok
+ assert_page_cached :ok, "get with ok status should have been cached"
+ end
+
+ def test_should_cache_with_custom_path
+ get :custom_path
+ assert File.exist?("#{FILE_STORE_PATH}/index.html")
+ end
+
+ def test_should_expire_cache_with_custom_path
+ get :custom_path
+ assert File.exist?("#{FILE_STORE_PATH}/index.html")
+
+ get :expire_custom_path
+ assert !File.exist?("#{FILE_STORE_PATH}/index.html")
+ end
+
+ def test_should_cache_without_trailing_slash_on_url
+ @controller.class.cache_page 'cached content', '/page_caching_test/trailing_slash'
+ assert File.exist?("#{FILE_STORE_PATH}/page_caching_test/trailing_slash.html")
+ end
+
+ def test_should_cache_with_trailing_slash_on_url
+ @controller.class.cache_page 'cached content', '/page_caching_test/trailing_slash/'
+ assert File.exist?("#{FILE_STORE_PATH}/page_caching_test/trailing_slash.html")
+ end
+
+ uses_mocha("should_cache_ok_at_custom_path") do
+ def test_should_cache_ok_at_custom_path
+ @request.expects(:path).returns("/index.html")
+ get :ok
+ assert_response :ok
+ assert File.exist?("#{FILE_STORE_PATH}/index.html")
+ end
+ end
+
+ [:ok, :no_content, :found, :not_found].each do |status|
+ [:get, :post, :put, :delete].each do |method|
+ unless method == :get and status == :ok
+ define_method "test_shouldnt_cache_#{method}_with_#{status}_status" do
+ @request.env['REQUEST_METHOD'] = method.to_s.upcase
+ process status
+ assert_response status
+ assert_page_not_cached status, "#{method} with #{status} status shouldn't have been cached"
+ end
+ end
+ end
+ end
+
+ private
+ def assert_page_cached(action, message = "#{action} should have been cached")
+ assert page_cached?(action), message
+ end
+
+ def assert_page_not_cached(action, message = "#{action} shouldn't have been cached")
+ assert !page_cached?(action), message
+ end
+
+ def page_cached?(action)
+ File.exist? "#{FILE_STORE_PATH}/page_caching_test/#{action}.html"
+ end
+end
+
+
+class ActionCachingTestController < ActionController::Base
+ caches_action :index, :redirected, :forbidden
+ caches_action :show, :cache_path => 'http://test.host/custom/show'
+ caches_action :edit, :cache_path => Proc.new { |c| c.params[:id] ? "http://test.host/#{c.params[:id]};edit" : "http://test.host/edit" }
+
+ def index
+ @cache_this = Time.now.to_f.to_s
+ render :text => @cache_this
+ end
+
+ def redirected
+ redirect_to :action => 'index'
+ end
+
+ def forbidden
+ render :text => "Forbidden"
+ headers["Status"] = "403 Forbidden"
+ end
+
+ alias_method :show, :index
+ alias_method :edit, :index
+
+ def expire
+ expire_action :controller => 'action_caching_test', :action => 'index'
+ render :nothing => true
+ end
+
+end
+
+class ActionCachingMockController
+ attr_accessor :mock_url_for
+ attr_accessor :mock_path
+
+ def initialize
+ yield self if block_given?
+ end
+
+ def url_for(*args)
+ @mock_url_for
+ end
+
+ def request
+ mocked_path = @mock_path
+ Object.new.instance_eval(<<-EVAL)
+ def path; '#{@mock_path}' end
+ self
+ EVAL
+ end
+end
+
+class ActionCacheTest < Test::Unit::TestCase
+ def setup
+ reset!
+ FileUtils.mkdir_p(FILE_STORE_PATH)
+ @path_class = ActionController::Caching::Actions::ActionCachePath
+ @mock_controller = ActionCachingMockController.new
+ end
+
+ def teardown
+ FileUtils.rm_rf(File.dirname(FILE_STORE_PATH))
+ end
+
+ def test_simple_action_cache
+ get :index
+ cached_time = content_to_cache
+ assert_equal cached_time, @response.body
+ assert_cache_exists 'hostname.com/action_caching_test'
+ reset!
+
+ get :index
+ assert_equal cached_time, @response.body
+ end
+
+ def test_action_cache_with_custom_cache_path
+ get :show
+ cached_time = content_to_cache
+ assert_equal cached_time, @response.body
+ assert_cache_exists 'test.host/custom/show'
+ reset!
+
+ get :show
+ assert_equal cached_time, @response.body
+ end
+
+ def test_action_cache_with_custom_cache_path_in_block
+ get :edit
+ assert_cache_exists 'test.host/edit'
+ reset!
+
+ get :edit, :id => 1
+ assert_cache_exists 'test.host/1;edit'
+ end
+
+ def test_cache_expiration
+ get :index
+ cached_time = content_to_cache
+ reset!
+
+ get :index
+ assert_equal cached_time, @response.body
+ reset!
+
+ get :expire
+ reset!
+
+ get :index
+ new_cached_time = content_to_cache
+ assert_not_equal cached_time, @response.body
+ reset!
+
+ get :index
+ assert_response :success
+ assert_equal new_cached_time, @response.body
+ end
+
+ def test_cache_is_scoped_by_subdomain
+ @request.host = 'jamis.hostname.com'
+ get :index
+ jamis_cache = content_to_cache
+
+ reset!
+
+ @request.host = 'david.hostname.com'
+ get :index
+ david_cache = content_to_cache
+ assert_not_equal jamis_cache, @response.body
+
+ reset!
+
+ @request.host = 'jamis.hostname.com'
+ get :index
+ assert_equal jamis_cache, @response.body
+
+ reset!
+
+ @request.host = 'david.hostname.com'
+ get :index
+ assert_equal david_cache, @response.body
+ end
+
+ def test_redirect_is_not_cached
+ get :redirected
+ assert_response :redirect
+ reset!
+
+ get :redirected
+ assert_response :redirect
+ end
+
+ def test_forbidden_is_not_cached
+ get :forbidden
+ assert_response :forbidden
+ reset!
+
+ get :forbidden
+ assert_response :forbidden
+ end
+
+ def test_xml_version_of_resource_is_treated_as_different_cache
+ @mock_controller.mock_url_for = 'http://example.org/posts/'
+ @mock_controller.mock_path = '/posts/index.xml'
+ path_object = @path_class.new(@mock_controller, {})
+ assert_equal 'xml', path_object.extension
+ assert_equal 'example.org/posts/index.xml', path_object.path
+ end
+
+ def test_correct_content_type_is_returned_for_cache_hit
+ # run it twice to cache it the first time
+ get :index, :id => 'content-type.xml'
+ get :index, :id => 'content-type.xml'
+ assert_equal 'application/xml', @response.content_type
+ end
+
+ def test_empty_path_is_normalized
+ @mock_controller.mock_url_for = 'http://example.org/'
+ @mock_controller.mock_path = '/'
+
+ assert_equal 'example.org/index', @path_class.path_for(@mock_controller, {})
+ end
+
+ def test_file_extensions
+ get :index, :id => 'kitten.jpg'
+ get :index, :id => 'kitten.jpg'
+
+ assert_response :success
+ end
+
+ private
+ def content_to_cache
+ assigns(:cache_this)
+ end
+
+ def reset!
+ @request = ActionController::TestRequest.new
+ @response = ActionController::TestResponse.new
+ @controller = ActionCachingTestController.new
+ @request.host = 'hostname.com'
+ end
+
+ def assert_cache_exists(path)
+ full_path = File.join(FILE_STORE_PATH, path + '.cache')
+ assert File.exist?(full_path), "#{full_path.inspect} does not exist."
+ end
+end
diff --git a/vendor/rails-2.0.2/actionpack/test/controller/capture_test.rb b/vendor/rails-2.0.2/actionpack/test/controller/capture_test.rb
new file mode 100644
index 000000000..7ec5f32a3
--- /dev/null
+++ b/vendor/rails-2.0.2/actionpack/test/controller/capture_test.rb
@@ -0,0 +1,89 @@
+require File.dirname(__FILE__) + '/../abstract_unit'
+
+class CaptureController < ActionController::Base
+ def self.controller_name; "test"; end
+ def self.controller_path; "test"; end
+
+ def content_for
+ render :layout => "talk_from_action"
+ end
+
+ def content_for_with_parameter
+ render :layout => "talk_from_action"
+ end
+
+ def content_for_concatenated
+ render :layout => "talk_from_action"
+ end
+
+ def erb_content_for
+ render :layout => "talk_from_action"
+ end
+
+ def block_content_for
+ render :layout => "talk_from_action"
+ end
+
+ def non_erb_block_content_for
+ render :layout => "talk_from_action"
+ end
+
+ def rescue_action(e) raise end
+end
+
+CaptureController.view_paths = [ File.dirname(__FILE__) + "/../fixtures/" ]
+
+class CaptureTest < Test::Unit::TestCase
+ def setup
+ @controller = CaptureController.new
+
+ # enable a logger so that (e.g.) the benchmarking stuff runs, so we can get
+ # a more accurate simulation of what happens in "real life".
+ @controller.logger = Logger.new(nil)
+
+ @request = ActionController::TestRequest.new
+ @response = ActionController::TestResponse.new
+
+ @request.host = "www.nextangle.com"
+ end
+
+ def test_simple_capture
+ get :capturing
+ assert_equal "Dreamy days", @response.body.strip
+ end
+
+ def test_content_for
+ get :content_for
+ assert_equal expected_content_for_output, @response.body
+ end
+
+ def test_should_concatentate_content_for
+ get :content_for_concatenated
+ assert_equal expected_content_for_output, @response.body
+ end
+
+ def test_erb_content_for
+ get :erb_content_for
+ assert_equal expected_content_for_output, @response.body
+ end
+
+ def test_should_set_content_for_with_parameter
+ get :content_for_with_parameter
+ assert_equal expected_content_for_output, @response.body
+ end
+
+ def test_block_content_for
+ get :block_content_for
+ assert_equal expected_content_for_output, @response.body
+ end
+
+ def test_non_erb_block_content_for
+ get :non_erb_block_content_for
+ assert_equal expected_content_for_output, @response.body
+ end
+
+ private
+ def expected_content_for_output
+ "Putting stuff in the title! \n\nGreat stuff!"
+ end
+end
diff --git a/vendor/rails-2.0.2/actionpack/test/controller/cgi_test.rb b/vendor/rails-2.0.2/actionpack/test/controller/cgi_test.rb
new file mode 100755
index 000000000..021781df9
--- /dev/null
+++ b/vendor/rails-2.0.2/actionpack/test/controller/cgi_test.rb
@@ -0,0 +1,115 @@
+require File.dirname(__FILE__) + '/../abstract_unit'
+require 'action_controller/cgi_process'
+
+class BaseCgiTest < Test::Unit::TestCase
+ def setup
+ @request_hash = {"HTTP_MAX_FORWARDS"=>"10", "SERVER_NAME"=>"glu.ttono.us:8007", "FCGI_ROLE"=>"RESPONDER", "HTTP_X_FORWARDED_HOST"=>"glu.ttono.us", "HTTP_ACCEPT_ENCODING"=>"gzip, deflate", "HTTP_USER_AGENT"=>"Mozilla/5.0 (Macintosh; U; PPC Mac OS X; en) AppleWebKit/312.5.1 (KHTML, like Gecko) Safari/312.3.1", "PATH_INFO"=>"", "HTTP_ACCEPT_LANGUAGE"=>"en", "HTTP_HOST"=>"glu.ttono.us:8007", "SERVER_PROTOCOL"=>"HTTP/1.1", "REDIRECT_URI"=>"/dispatch.fcgi", "SCRIPT_NAME"=>"/dispatch.fcgi", "SERVER_ADDR"=>"207.7.108.53", "REMOTE_ADDR"=>"207.7.108.53", "SERVER_SOFTWARE"=>"lighttpd/1.4.5", "HTTP_COOKIE"=>"_session_id=c84ace84796670c052c6ceb2451fb0f2; is_admin=yes", "HTTP_X_FORWARDED_SERVER"=>"glu.ttono.us", "REQUEST_URI"=>"/admin", "DOCUMENT_ROOT"=>"/home/kevinc/sites/typo/public", "SERVER_PORT"=>"8007", "QUERY_STRING"=>"", "REMOTE_PORT"=>"63137", "GATEWAY_INTERFACE"=>"CGI/1.1", "HTTP_X_FORWARDED_FOR"=>"65.88.180.234", "HTTP_ACCEPT"=>"*/*", "SCRIPT_FILENAME"=>"/home/kevinc/sites/typo/public/dispatch.fcgi", "REDIRECT_STATUS"=>"200", "REQUEST_METHOD"=>"GET"}
+ # cookie as returned by some Nokia phone browsers (no space after semicolon separator)
+ @alt_cookie_fmt_request_hash = {"HTTP_COOKIE"=>"_session_id=c84ace84796670c052c6ceb2451fb0f2;is_admin=yes"}
+ @fake_cgi = Struct.new(:env_table).new(@request_hash)
+ @request = ActionController::CgiRequest.new(@fake_cgi)
+ end
+
+ def default_test; end
+end
+
+
+class CgiRequestTest < BaseCgiTest
+ def test_proxy_request
+ assert_equal 'glu.ttono.us', @request.host_with_port
+ end
+
+ def test_http_host
+ @request_hash.delete "HTTP_X_FORWARDED_HOST"
+ @request_hash['HTTP_HOST'] = "rubyonrails.org:8080"
+ assert_equal "rubyonrails.org:8080", @request.host_with_port
+
+ @request_hash['HTTP_X_FORWARDED_HOST'] = "www.firsthost.org, www.secondhost.org"
+ assert_equal "www.secondhost.org", @request.host
+ end
+
+ def test_http_host_with_default_port_overrides_server_port
+ @request_hash.delete "HTTP_X_FORWARDED_HOST"
+ @request_hash['HTTP_HOST'] = "rubyonrails.org"
+ assert_equal "rubyonrails.org", @request.host_with_port
+ end
+
+ def test_host_with_port_defaults_to_server_name_if_no_host_headers
+ @request_hash.delete "HTTP_X_FORWARDED_HOST"
+ @request_hash.delete "HTTP_HOST"
+ assert_equal "glu.ttono.us:8007", @request.host_with_port
+ end
+
+ def test_host_with_port_falls_back_to_server_addr_if_necessary
+ @request_hash.delete "HTTP_X_FORWARDED_HOST"
+ @request_hash.delete "HTTP_HOST"
+ @request_hash.delete "SERVER_NAME"
+ assert_equal "207.7.108.53:8007", @request.host_with_port
+ end
+
+ def test_host_with_port_if_http_standard_port_is_specified
+ @request_hash['HTTP_X_FORWARDED_HOST'] = "glu.ttono.us:80"
+ assert_equal "glu.ttono.us", @request.host_with_port
+ end
+
+ def test_host_with_port_if_https_standard_port_is_specified
+ @request_hash['HTTP_X_FORWARDED_PROTO'] = "https"
+ @request_hash['HTTP_X_FORWARDED_HOST'] = "glu.ttono.us:443"
+ assert_equal "glu.ttono.us", @request.host_with_port
+ end
+
+ def test_host_if_ipv6_reference
+ @request_hash.delete "HTTP_X_FORWARDED_HOST"
+ @request_hash['HTTP_HOST'] = "[2001:1234:5678:9abc:def0::dead:beef]"
+ assert_equal "[2001:1234:5678:9abc:def0::dead:beef]", @request.host
+ end
+
+ def test_host_if_ipv6_reference_with_port
+ @request_hash.delete "HTTP_X_FORWARDED_HOST"
+ @request_hash['HTTP_HOST'] = "[2001:1234:5678:9abc:def0::dead:beef]:8008"
+ assert_equal "[2001:1234:5678:9abc:def0::dead:beef]", @request.host
+ end
+
+ def test_cookie_syntax_resilience
+ cookies = CGI::Cookie::parse(@request_hash["HTTP_COOKIE"]);
+ assert_equal ["c84ace84796670c052c6ceb2451fb0f2"], cookies["_session_id"], cookies.inspect
+ assert_equal ["yes"], cookies["is_admin"], cookies.inspect
+
+ alt_cookies = CGI::Cookie::parse(@alt_cookie_fmt_request_hash["HTTP_COOKIE"]);
+ assert_equal ["c84ace84796670c052c6ceb2451fb0f2"], alt_cookies["_session_id"], alt_cookies.inspect
+ assert_equal ["yes"], alt_cookies["is_admin"], alt_cookies.inspect
+ end
+end
+
+
+class CgiRequestParamsParsingTest < BaseCgiTest
+ def test_doesnt_break_when_content_type_has_charset
+ data = 'flamenco=love'
+ @request.env['CONTENT_LENGTH'] = data.length
+ @request.env['CONTENT_TYPE'] = 'application/x-www-form-urlencoded; charset=utf-8'
+ @request.env['RAW_POST_DATA'] = data
+ assert_equal({"flamenco"=> "love"}, @request.request_parameters)
+ end
+
+ def test_doesnt_interpret_request_uri_as_query_string_when_missing
+ @request.env['REQUEST_URI'] = 'foo'
+ assert_equal({}, @request.query_parameters)
+ end
+end
+
+
+class CgiRequestNeedsRewoundTest < BaseCgiTest
+ def test_body_should_be_rewound
+ data = 'foo'
+ fake_cgi = Struct.new(:env_table, :query_string, :stdinput).new(@request_hash, '', StringIO.new(data))
+ fake_cgi.env_table['CONTENT_LENGTH'] = data.length
+ fake_cgi.env_table['CONTENT_TYPE'] = 'application/x-www-form-urlencoded; charset=utf-8'
+
+ # Read the request body by parsing params.
+ request = ActionController::CgiRequest.new(fake_cgi)
+ request.request_parameters
+
+ # Should have rewound the body.
+ assert_equal 0, request.body.pos
+ end
+end
diff --git a/vendor/rails-2.0.2/actionpack/test/controller/components_test.rb b/vendor/rails-2.0.2/actionpack/test/controller/components_test.rb
new file mode 100644
index 000000000..debd8a274
--- /dev/null
+++ b/vendor/rails-2.0.2/actionpack/test/controller/components_test.rb
@@ -0,0 +1,140 @@
+require File.dirname(__FILE__) + '/../abstract_unit'
+
+class CallerController < ActionController::Base
+ def calling_from_controller
+ render_component(:controller => "callee", :action => "being_called")
+ end
+
+ def calling_from_controller_with_params
+ render_component(:controller => "callee", :action => "being_called", :params => { "name" => "David" })
+ end
+
+ def calling_from_controller_with_different_status_code
+ render_component(:controller => "callee", :action => "blowing_up")
+ end
+
+ def calling_from_template
+ render :inline => "Ring, ring: <%= render_component(:controller => 'callee', :action => 'being_called') %>"
+ end
+
+ def internal_caller
+ render :inline => "Are you there? <%= render_component(:action => 'internal_callee') %>"
+ end
+
+ def internal_callee
+ render :text => "Yes, ma'am"
+ end
+
+ def set_flash
+ render_component(:controller => "callee", :action => "set_flash")
+ end
+
+ def use_flash
+ render_component(:controller => "callee", :action => "use_flash")
+ end
+
+ def calling_redirected
+ render_component(:controller => "callee", :action => "redirected")
+ end
+
+ def calling_redirected_as_string
+ render :inline => "<%= render_component(:controller => 'callee', :action => 'redirected') %>"
+ end
+
+ def rescue_action(e) raise end
+end
+
+class CalleeController < ActionController::Base
+ def being_called
+ render :text => "#{params[:name] || "Lady"} of the House, speaking"
+ end
+
+ def blowing_up
+ render :text => "It's game over, man, just game over, man!", :status => 500
+ end
+
+ def set_flash
+ flash[:notice] = 'My stoney baby'
+ render :text => 'flash is set'
+ end
+
+ def use_flash
+ render :text => flash[:notice] || 'no flash'
+ end
+
+ def redirected
+ redirect_to :controller => "callee", :action => "being_called"
+ end
+
+ def rescue_action(e) raise end
+end
+
+class ComponentsTest < Test::Unit::TestCase
+ def setup
+ @controller = CallerController.new
+ @request = ActionController::TestRequest.new
+ @response = ActionController::TestResponse.new
+ end
+
+ def test_calling_from_controller
+ get :calling_from_controller
+ assert_equal "Lady of the House, speaking", @response.body
+ end
+
+ def test_calling_from_controller_with_params
+ get :calling_from_controller_with_params
+ assert_equal "David of the House, speaking", @response.body
+ end
+
+ def test_calling_from_controller_with_different_status_code
+ get :calling_from_controller_with_different_status_code
+ assert_equal 500, @response.response_code
+ end
+
+ def test_calling_from_template
+ get :calling_from_template
+ assert_equal "Ring, ring: Lady of the House, speaking", @response.body
+ end
+
+ def test_etag_is_set_for_parent_template_when_calling_from_template
+ get :calling_from_template
+ expected_etag = etag_for("Ring, ring: Lady of the House, speaking")
+ assert_equal expected_etag, @response.headers['ETag']
+ end
+
+ def test_internal_calling
+ get :internal_caller
+ assert_equal "Are you there? Yes, ma'am", @response.body
+ end
+
+ def test_flash
+ get :set_flash
+ assert_equal 'My stoney baby', flash[:notice]
+ get :use_flash
+ assert_equal 'My stoney baby', @response.body
+ get :use_flash
+ assert_equal 'no flash', @response.body
+ end
+
+ def test_component_redirect_redirects
+ get :calling_redirected
+
+ assert_redirected_to :action => "being_called"
+ end
+
+ def test_component_multiple_redirect_redirects
+ test_component_redirect_redirects
+ test_internal_calling
+ end
+
+ def test_component_as_string_redirect_renders_redirected_action
+ get :calling_redirected_as_string
+
+ assert_equal "Lady of the House, speaking", @response.body
+ end
+
+ protected
+ def etag_for(text)
+ %("#{Digest::MD5.hexdigest(text)}")
+ end
+end
diff --git a/vendor/rails-2.0.2/actionpack/test/controller/content_type_test.rb b/vendor/rails-2.0.2/actionpack/test/controller/content_type_test.rb
new file mode 100644
index 000000000..1841d37c0
--- /dev/null
+++ b/vendor/rails-2.0.2/actionpack/test/controller/content_type_test.rb
@@ -0,0 +1,139 @@
+require File.dirname(__FILE__) + '/../abstract_unit'
+
+class ContentTypeController < ActionController::Base
+ def render_content_type_from_body
+ response.content_type = Mime::RSS
+ render :text => "hello world!"
+ end
+
+ def render_defaults
+ render :text => "hello world!"
+ end
+
+ def render_content_type_from_render
+ render :text => "hello world!", :content_type => Mime::RSS
+ end
+
+ def render_charset_from_body
+ response.charset = "utf-16"
+ render :text => "hello world!"
+ end
+
+ def render_default_for_rhtml
+ end
+
+ def render_default_for_rxml
+ end
+
+ def render_default_for_rjs
+ end
+
+ def render_change_for_rxml
+ response.content_type = Mime::HTML
+ render :action => "render_default_for_rxml"
+ end
+
+ def render_default_content_types_for_respond_to
+ respond_to do |format|
+ format.html { render :text => "hello world!" }
+ format.xml { render :action => "render_default_content_types_for_respond_to.rhtml" }
+ format.js { render :text => "hello world!" }
+ format.rss { render :text => "hello world!", :content_type => Mime::XML }
+ end
+ end
+
+ def rescue_action(e) raise end
+end
+
+ContentTypeController.view_paths = [ File.dirname(__FILE__) + "/../fixtures/" ]
+
+class ContentTypeTest < Test::Unit::TestCase
+ def setup
+ @controller = ContentTypeController.new
+
+ # enable a logger so that (e.g.) the benchmarking stuff runs, so we can get
+ # a more accurate simulation of what happens in "real life".
+ @controller.logger = Logger.new(nil)
+
+ @request = ActionController::TestRequest.new
+ @response = ActionController::TestResponse.new
+ end
+
+ def test_render_defaults
+ get :render_defaults
+ assert_equal "utf-8", @response.charset
+ assert_equal Mime::HTML, @response.content_type
+ end
+
+ def test_render_changed_charset_default
+ ContentTypeController.default_charset = "utf-16"
+ get :render_defaults
+ assert_equal "utf-16", @response.charset
+ assert_equal Mime::HTML, @response.content_type
+ ContentTypeController.default_charset = "utf-8"
+ end
+
+ def test_content_type_from_body
+ get :render_content_type_from_body
+ assert_equal "application/rss+xml", @response.content_type
+ assert_equal "utf-8", @response.charset
+ end
+
+ def test_content_type_from_render
+ get :render_content_type_from_render
+ assert_equal "application/rss+xml", @response.content_type
+ assert_equal "utf-8", @response.charset
+ end
+
+ def test_charset_from_body
+ get :render_charset_from_body
+ assert_equal "utf-16", @response.charset
+ assert_equal Mime::HTML, @response.content_type
+ end
+
+ def test_default_for_rhtml
+ get :render_default_for_rhtml
+ assert_equal Mime::HTML, @response.content_type
+ assert_equal "utf-8", @response.charset
+ end
+
+ def test_default_for_rxml
+ get :render_default_for_rxml
+ assert_equal Mime::XML, @response.content_type
+ assert_equal "utf-8", @response.charset
+ end
+
+ def test_default_for_rjs
+ xhr :post, :render_default_for_rjs
+ assert_equal Mime::JS, @response.content_type
+ assert_equal "utf-8", @response.charset
+ end
+
+ def test_change_for_rxml
+ get :render_change_for_rxml
+ assert_equal Mime::HTML, @response.content_type
+ assert_equal "utf-8", @response.charset
+ end
+
+ def test_render_default_content_types_for_respond_to
+ @request.env["HTTP_ACCEPT"] = Mime::HTML.to_s
+ get :render_default_content_types_for_respond_to
+ assert_equal Mime::HTML, @response.content_type
+
+ @request.env["HTTP_ACCEPT"] = Mime::JS.to_s
+ get :render_default_content_types_for_respond_to
+ assert_equal Mime::JS, @response.content_type
+ end
+
+ def test_render_default_content_types_for_respond_to_with_template
+ @request.env["HTTP_ACCEPT"] = Mime::XML.to_s
+ get :render_default_content_types_for_respond_to
+ assert_equal Mime::XML, @response.content_type
+ end
+
+ def test_render_default_content_types_for_respond_to_with_overwrite
+ @request.env["HTTP_ACCEPT"] = Mime::RSS.to_s
+ get :render_default_content_types_for_respond_to
+ assert_equal Mime::XML, @response.content_type
+ end
+end
\ No newline at end of file
diff --git a/vendor/rails-2.0.2/actionpack/test/controller/controller_fixtures/app/controllers/admin/user_controller.rb b/vendor/rails-2.0.2/actionpack/test/controller/controller_fixtures/app/controllers/admin/user_controller.rb
new file mode 100644
index 000000000..e69de29bb
diff --git a/vendor/rails-2.0.2/actionpack/test/controller/controller_fixtures/app/controllers/user_controller.rb b/vendor/rails-2.0.2/actionpack/test/controller/controller_fixtures/app/controllers/user_controller.rb
new file mode 100644
index 000000000..e69de29bb
diff --git a/vendor/rails-2.0.2/actionpack/test/controller/controller_fixtures/vendor/plugins/bad_plugin/lib/plugin_controller.rb b/vendor/rails-2.0.2/actionpack/test/controller/controller_fixtures/vendor/plugins/bad_plugin/lib/plugin_controller.rb
new file mode 100644
index 000000000..e69de29bb
diff --git a/vendor/rails-2.0.2/actionpack/test/controller/cookie_test.rb b/vendor/rails-2.0.2/actionpack/test/controller/cookie_test.rb
new file mode 100644
index 000000000..6a833fee3
--- /dev/null
+++ b/vendor/rails-2.0.2/actionpack/test/controller/cookie_test.rb
@@ -0,0 +1,135 @@
+require File.dirname(__FILE__) + '/../abstract_unit'
+
+class CookieTest < Test::Unit::TestCase
+ class TestController < ActionController::Base
+ def authenticate
+ cookies["user_name"] = "david"
+ end
+
+ def authenticate_for_fourteen_days
+ cookies["user_name"] = { "value" => "david", "expires" => Time.local(2005, 10, 10) }
+ end
+
+ def authenticate_for_fourteen_days_with_symbols
+ cookies[:user_name] = { :value => "david", :expires => Time.local(2005, 10, 10) }
+ end
+
+ def set_multiple_cookies
+ cookies["user_name"] = { "value" => "david", "expires" => Time.local(2005, 10, 10) }
+ cookies["login"] = "XJ-122"
+ end
+
+ def access_frozen_cookies
+ cookies["will"] = "work"
+ end
+
+ def logout
+ cookies.delete("user_name")
+ end
+
+ def delete_cookie_with_path
+ cookies.delete("user_name", :path => '/beaten')
+ render :text => "hello world"
+ end
+
+ def authenticate_with_http_only
+ cookies["user_name"] = { :value => "david", :http_only => true }
+ end
+
+ def rescue_action(e)
+ raise unless ActionController::MissingTemplate # No templates here, and we don't care about the output
+ end
+ end
+
+ def setup
+ @request = ActionController::TestRequest.new
+ @response = ActionController::TestResponse.new
+
+ @controller = TestController.new
+ @request.host = "www.nextangle.com"
+ end
+
+ def test_setting_cookie
+ get :authenticate
+ assert_equal [ CGI::Cookie::new("name" => "user_name", "value" => "david") ], @response.headers["cookie"]
+ end
+
+ def test_setting_cookie_for_fourteen_days
+ get :authenticate_for_fourteen_days
+ assert_equal [ CGI::Cookie::new("name" => "user_name", "value" => "david", "expires" => Time.local(2005, 10, 10)) ], @response.headers["cookie"]
+ end
+
+ def test_setting_cookie_for_fourteen_days_with_symbols
+ get :authenticate_for_fourteen_days
+ assert_equal [ CGI::Cookie::new("name" => "user_name", "value" => "david", "expires" => Time.local(2005, 10, 10)) ], @response.headers["cookie"]
+ end
+
+ def test_setting_cookie_with_http_only
+ get :authenticate_with_http_only
+ assert_equal [ CGI::Cookie::new("name" => "user_name", "value" => "david", "http_only" => true) ], @response.headers["cookie"]
+ assert_equal CGI::Cookie::new("name" => "user_name", "value" => "david", "path" => "/", "http_only" => true).to_s, @response.headers["cookie"][0].to_s
+ end
+
+ def test_multiple_cookies
+ get :set_multiple_cookies
+ assert_equal 2, @response.cookies.size
+ end
+
+ def test_setting_test_cookie
+ assert_nothing_raised { get :access_frozen_cookies }
+ end
+
+ def test_expiring_cookie
+ get :logout
+ assert_equal [ CGI::Cookie::new("name" => "user_name", "value" => "", "expires" => Time.at(0)) ], @response.headers["cookie"]
+ end
+
+ def test_cookiejar_accessor
+ @request.cookies["user_name"] = CGI::Cookie.new("name" => "user_name", "value" => "david", "expires" => Time.local(2025, 10, 10))
+ @controller.request = @request
+ jar = ActionController::CookieJar.new(@controller)
+ assert_equal "david", jar["user_name"]
+ assert_equal nil, jar["something_else"]
+ end
+
+ def test_cookiejar_accessor_with_array_value
+ a = %w{1 2 3}
+ @request.cookies["pages"] = CGI::Cookie.new("name" => "pages", "value" => a, "expires" => Time.local(2025, 10, 10))
+ @controller.request = @request
+ jar = ActionController::CookieJar.new(@controller)
+ assert_equal a, jar["pages"]
+ end
+
+ def test_delete_cookie_with_path
+ get :delete_cookie_with_path
+ assert_equal "/beaten", @response.headers["cookie"].first.path
+ assert_not_equal "/", @response.headers["cookie"].first.path
+ end
+
+ def test_cookie_to_s_simple_values
+ assert_equal 'myname=myvalue; path=', CGI::Cookie.new('myname', 'myvalue').to_s
+ end
+
+ def test_cookie_to_s_hash
+ cookie_str = CGI::Cookie.new(
+ 'name' => 'myname',
+ 'value' => 'myvalue',
+ 'domain' => 'mydomain',
+ 'path' => 'mypath',
+ 'expires' => Time.utc(2007, 10, 20),
+ 'secure' => true,
+ 'http_only' => true).to_s
+ assert_equal 'myname=myvalue; domain=mydomain; path=mypath; expires=Sat, 20 Oct 2007 00:00:00 GMT; secure; HttpOnly', cookie_str
+ end
+
+ def test_cookie_to_s_hash_default_not_secure_not_http_only
+ cookie_str = CGI::Cookie.new(
+ 'name' => 'myname',
+ 'value' => 'myvalue',
+ 'domain' => 'mydomain',
+ 'path' => 'mypath',
+ 'expires' => Time.utc(2007, 10, 20))
+ assert cookie_str !~ /secure/
+ assert cookie_str !~ /HttpOnly/
+ end
+end
diff --git a/vendor/rails-2.0.2/actionpack/test/controller/custom_handler_test.rb b/vendor/rails-2.0.2/actionpack/test/controller/custom_handler_test.rb
new file mode 100644
index 000000000..2747a0f3c
--- /dev/null
+++ b/vendor/rails-2.0.2/actionpack/test/controller/custom_handler_test.rb
@@ -0,0 +1,41 @@
+require File.dirname(__FILE__) + '/../abstract_unit'
+
+class CustomHandler
+ def initialize( view )
+ @view = view
+ end
+
+ def render( template, local_assigns )
+ [ template,
+ local_assigns,
+ @view ]
+ end
+end
+
+class CustomHandlerTest < Test::Unit::TestCase
+ def setup
+ ActionView::Base.register_template_handler "foo", CustomHandler
+ ActionView::Base.register_template_handler :foo2, CustomHandler
+ @view = ActionView::Base.new
+ end
+
+ def test_custom_render
+ result = @view.render_template( "foo", "hello <%= one %>", nil, :one => "two" )
+ assert_equal(
+ [ "hello <%= one %>", { :one => "two" }, @view ],
+ result )
+ end
+
+ def test_custom_render2
+ result = @view.render_template( "foo2", "hello <%= one %>", nil, :one => "two" )
+ assert_equal(
+ [ "hello <%= one %>", { :one => "two" }, @view ],
+ result )
+ end
+
+ def test_unhandled_extension
+ # uses the ERb handler by default if the extension isn't recognized
+ result = @view.render_template( "bar", "hello <%= one %>", nil, :one => "two" )
+ assert_equal "hello two", result
+ end
+end
diff --git a/vendor/rails-2.0.2/actionpack/test/controller/deprecation/deprecated_base_methods_test.rb b/vendor/rails-2.0.2/actionpack/test/controller/deprecation/deprecated_base_methods_test.rb
new file mode 100644
index 000000000..6d7157e1a
--- /dev/null
+++ b/vendor/rails-2.0.2/actionpack/test/controller/deprecation/deprecated_base_methods_test.rb
@@ -0,0 +1,37 @@
+require File.dirname(__FILE__) + '/../../abstract_unit'
+
+class DeprecatedBaseMethodsTest < Test::Unit::TestCase
+ class Target < ActionController::Base
+
+ def home_url(greeting)
+ "http://example.com/#{greeting}"
+ end
+
+ def raises_name_error
+ this_method_doesnt_exist
+ end
+
+ def rescue_action(e) raise e end
+ end
+
+ Target.view_paths = [ File.dirname(__FILE__) + "/../../fixtures" ]
+
+ def setup
+ @request = ActionController::TestRequest.new
+ @response = ActionController::TestResponse.new
+ @controller = Target.new
+ end
+
+ def test_log_error_silences_deprecation_warnings
+ get :raises_name_error
+ rescue => e
+ assert_not_deprecated { @controller.send :log_error, e }
+ end
+
+ def test_assertion_failed_error_silences_deprecation_warnings
+ get :raises_name_error
+ rescue => e
+ error = Test::Unit::Error.new('testing ur doodz', e)
+ assert_not_deprecated { error.message }
+ end
+end
diff --git a/vendor/rails-2.0.2/actionpack/test/controller/dispatcher_test.rb b/vendor/rails-2.0.2/actionpack/test/controller/dispatcher_test.rb
new file mode 100644
index 000000000..ec937ebfd
--- /dev/null
+++ b/vendor/rails-2.0.2/actionpack/test/controller/dispatcher_test.rb
@@ -0,0 +1,123 @@
+require "#{File.dirname(__FILE__)}/../abstract_unit"
+
+uses_mocha 'dispatcher tests' do
+
+require 'action_controller/dispatcher'
+
+class DispatcherTest < Test::Unit::TestCase
+ Dispatcher = ActionController::Dispatcher
+
+ def setup
+ @output = StringIO.new
+ ENV['REQUEST_METHOD'] = 'GET'
+
+ Dispatcher.callbacks[:prepare].clear
+ @dispatcher = Dispatcher.new(@output)
+ end
+
+ def teardown
+ ENV['REQUEST_METHOD'] = nil
+ end
+
+ def test_clears_dependencies_after_dispatch_if_in_loading_mode
+ Dependencies.stubs(:load?).returns(true)
+
+ ActionController::Routing::Routes.expects(:reload).once
+ Dependencies.expects(:clear).once
+
+ dispatch
+ end
+
+ def test_leaves_dependencies_after_dispatch_if_not_in_loading_mode
+ Dependencies.stubs(:load?).returns(false)
+
+ ActionController::Routing::Routes.expects(:reload).never
+ Dependencies.expects(:clear).never
+
+ dispatch
+ end
+
+ def test_failsafe_response
+ CGI.expects(:new).raises('some multipart parsing failure')
+
+ ActionController::Routing::Routes.stubs(:reload)
+ Dispatcher.stubs(:log_failsafe_exception)
+
+ assert_nothing_raised { dispatch }
+
+ assert_equal "Status: 400 Bad Request\r\nContent-Type: text/html\r\n\r\n400 Bad Request ", @output.string
+ end
+
+ def test_reload_application_sets_unprepared_if_loading_dependencies
+ Dependencies.stubs(:load?).returns(false)
+ ActionController::Routing::Routes.expects(:reload).never
+ @dispatcher.unprepared = false
+ @dispatcher.send!(:reload_application)
+ assert !@dispatcher.unprepared
+
+ Dependencies.stubs(:load?).returns(true)
+ ActionController::Routing::Routes.expects(:reload).once
+ @dispatcher.send!(:reload_application)
+ assert @dispatcher.unprepared
+ end
+
+ def test_prepare_application_runs_callbacks_if_unprepared
+ a = b = c = nil
+ Dispatcher.to_prepare { a = b = c = 1 }
+ Dispatcher.to_prepare { b = c = 2 }
+ Dispatcher.to_prepare { c = 3 }
+
+ # Skip the callbacks when already prepared.
+ @dispatcher.unprepared = false
+ @dispatcher.send! :prepare_application
+ assert_nil a || b || c
+
+ # Perform the callbacks when unprepared.
+ @dispatcher.unprepared = true
+ @dispatcher.send! :prepare_application
+ assert_equal 1, a
+ assert_equal 2, b
+ assert_equal 3, c
+
+ # But when not :load, make sure they are only run once
+ a = b = c = nil
+ @dispatcher.send! :prepare_application
+ assert_nil a || b || c
+ end
+
+ def test_to_prepare_with_identifier_replaces
+ a = b = nil
+ Dispatcher.to_prepare(:unique_id) { a = b = 1 }
+ Dispatcher.to_prepare(:unique_id) { a = 2 }
+
+ @dispatcher.unprepared = true
+ @dispatcher.send! :prepare_application
+ assert_equal 2, a
+ assert_equal nil, b
+ end
+
+ def test_to_prepare_only_runs_once_if_not_loading_dependencies
+ Dependencies.stubs(:load?).returns(false)
+ called = 0
+ Dispatcher.to_prepare(:unprepared_test) { called += 1 }
+ 2.times { dispatch }
+ assert_equal 1, called
+ end
+
+ private
+ def dispatch(output = @output)
+ controller = mock
+ controller.stubs(:process).returns(controller)
+ controller.stubs(:out).with(output).returns('response')
+
+ ActionController::Routing::Routes.stubs(:recognize).returns(controller)
+
+ Dispatcher.dispatch(nil, {}, output)
+ end
+
+ def assert_subclasses(howmany, klass, message = klass.subclasses.inspect)
+ assert_equal howmany, klass.subclasses.size, message
+ end
+end
+
+end
diff --git a/vendor/rails-2.0.2/actionpack/test/controller/fake_controllers.rb b/vendor/rails-2.0.2/actionpack/test/controller/fake_controllers.rb
new file mode 100644
index 000000000..5f958b284
--- /dev/null
+++ b/vendor/rails-2.0.2/actionpack/test/controller/fake_controllers.rb
@@ -0,0 +1,16 @@
+class << Object; alias_method :const_available?, :const_defined?; end
+
+class ContentController < Class.new(ActionController::Base)
+end
+class NotAController
+end
+module Admin
+ class << self; alias_method :const_available?, :const_defined?; end
+ class UserController < Class.new(ActionController::Base); end
+ class NewsFeedController < Class.new(ActionController::Base); end
+end
+
+ActionController::Routing::Routes.draw do |map|
+ map.route_one 'route_one', :controller => 'elsewhere', :action => 'flash_me'
+ map.connect ':controller/:action/:id'
+end
diff --git a/vendor/rails-2.0.2/actionpack/test/controller/fake_models.rb b/vendor/rails-2.0.2/actionpack/test/controller/fake_models.rb
new file mode 100644
index 000000000..2761b09f2
--- /dev/null
+++ b/vendor/rails-2.0.2/actionpack/test/controller/fake_models.rb
@@ -0,0 +1,5 @@
+class Customer < Struct.new(:name, :id)
+ def to_param
+ id.to_s
+ end
+end
diff --git a/vendor/rails-2.0.2/actionpack/test/controller/filter_params_test.rb b/vendor/rails-2.0.2/actionpack/test/controller/filter_params_test.rb
new file mode 100644
index 000000000..7b810b162
--- /dev/null
+++ b/vendor/rails-2.0.2/actionpack/test/controller/filter_params_test.rb
@@ -0,0 +1,43 @@
+require File.dirname(__FILE__) + '/../abstract_unit'
+
+class FilterParamController < ActionController::Base
+end
+
+class FilterParamTest < Test::Unit::TestCase
+ def setup
+ @controller = FilterParamController.new
+ end
+
+ def test_filter_parameters
+ assert FilterParamController.respond_to?(:filter_parameter_logging)
+ assert !@controller.respond_to?(:filter_parameters)
+
+ FilterParamController.filter_parameter_logging
+ assert @controller.respond_to?(:filter_parameters)
+
+ test_hashes = [[{},{},[]],
+ [{'foo'=>nil},{'foo'=>nil},[]],
+ [{'foo'=>'bar'},{'foo'=>'bar'},[]],
+ [{'foo'=>'bar'},{'foo'=>'bar'},%w'food'],
+ [{'foo'=>'bar'},{'foo'=>'[FILTERED]'},%w'foo'],
+ [{'foo'=>'bar', 'bar'=>'foo'},{'foo'=>'[FILTERED]', 'bar'=>'foo'},%w'foo baz'],
+ [{'foo'=>'bar', 'baz'=>'foo'},{'foo'=>'[FILTERED]', 'baz'=>'[FILTERED]'},%w'foo baz'],
+ [{'bar'=>{'foo'=>'bar','bar'=>'foo'}},{'bar'=>{'foo'=>'[FILTERED]','bar'=>'foo'}},%w'fo'],
+ [{'foo'=>{'foo'=>'bar','bar'=>'foo'}},{'foo'=>'[FILTERED]'},%w'f banana']]
+
+ test_hashes.each do |before_filter, after_filter, filter_words|
+ FilterParamController.filter_parameter_logging(*filter_words)
+ assert_equal after_filter, @controller.filter_parameters(before_filter)
+
+ filter_words.push('blah')
+ FilterParamController.filter_parameter_logging(*filter_words) do |key, value|
+ value.reverse! if key =~ /bargain/
+ end
+
+ before_filter['barg'] = {'bargain'=>'gain', 'blah'=>'bar', 'bar'=>{'bargain'=>{'blah'=>'foo'}}}
+ after_filter['barg'] = {'bargain'=>'niag', 'blah'=>'[FILTERED]', 'bar'=>{'bargain'=>{'blah'=>'[FILTERED]'}}}
+
+ assert_equal after_filter, @controller.filter_parameters(before_filter)
+ end
+ end
+end
diff --git a/vendor/rails-2.0.2/actionpack/test/controller/filters_test.rb b/vendor/rails-2.0.2/actionpack/test/controller/filters_test.rb
new file mode 100644
index 000000000..188e75afd
--- /dev/null
+++ b/vendor/rails-2.0.2/actionpack/test/controller/filters_test.rb
@@ -0,0 +1,856 @@
+require File.dirname(__FILE__) + '/../abstract_unit'
+
+# FIXME: crashes Ruby 1.9
+class FilterTest < Test::Unit::TestCase
+ class TestController < ActionController::Base
+ before_filter :ensure_login
+ after_filter :clean_up
+
+ def show
+ render :inline => "ran action"
+ end
+
+ private
+ def ensure_login
+ @ran_filter ||= []
+ @ran_filter << "ensure_login"
+ end
+
+ def clean_up
+ @ran_after_filter ||= []
+ @ran_after_filter << "clean_up"
+ end
+ end
+
+ class ChangingTheRequirementsController < TestController
+ before_filter :ensure_login, :except => [:go_wild]
+
+ def go_wild
+ render :text => "gobble"
+ end
+ end
+
+ class TestMultipleFiltersController < ActionController::Base
+ before_filter :try_1
+ before_filter :try_2
+ before_filter :try_3
+
+ (1..3).each do |i|
+ define_method "fail_#{i}" do
+ render :text => i.to_s
+ end
+ end
+
+ protected
+ (1..3).each do |i|
+ define_method "try_#{i}" do
+ instance_variable_set :@try, i
+ if action_name == "fail_#{i}"
+ head(404)
+ end
+ end
+ end
+ end
+
+ class RenderingController < ActionController::Base
+ before_filter :render_something_else
+
+ def show
+ @ran_action = true
+ render :inline => "ran action"
+ end
+
+ private
+ def render_something_else
+ render :inline => "something else"
+ end
+ end
+
+ class ConditionalFilterController < ActionController::Base
+ def show
+ render :inline => "ran action"
+ end
+
+ def another_action
+ render :inline => "ran action"
+ end
+
+ def show_without_filter
+ render :inline => "ran action without filter"
+ end
+
+ private
+ def ensure_login
+ @ran_filter ||= []
+ @ran_filter << "ensure_login"
+ end
+
+ def clean_up_tmp
+ @ran_filter ||= []
+ @ran_filter << "clean_up_tmp"
+ end
+
+ def rescue_action(e) raise(e) end
+ end
+
+ class ConditionalCollectionFilterController < ConditionalFilterController
+ before_filter :ensure_login, :except => [ :show_without_filter, :another_action ]
+ end
+
+ class OnlyConditionSymController < ConditionalFilterController
+ before_filter :ensure_login, :only => :show
+ end
+
+ class ExceptConditionSymController < ConditionalFilterController
+ before_filter :ensure_login, :except => :show_without_filter
+ end
+
+ class BeforeAndAfterConditionController < ConditionalFilterController
+ before_filter :ensure_login, :only => :show
+ after_filter :clean_up_tmp, :only => :show
+ end
+
+ class OnlyConditionProcController < ConditionalFilterController
+ before_filter(:only => :show) {|c| c.assigns["ran_proc_filter"] = true }
+ end
+
+ class ExceptConditionProcController < ConditionalFilterController
+ before_filter(:except => :show_without_filter) {|c| c.assigns["ran_proc_filter"] = true }
+ end
+
+ class ConditionalClassFilter
+ def self.filter(controller) controller.assigns["ran_class_filter"] = true end
+ end
+
+ class OnlyConditionClassController < ConditionalFilterController
+ before_filter ConditionalClassFilter, :only => :show
+ end
+
+ class ExceptConditionClassController < ConditionalFilterController
+ before_filter ConditionalClassFilter, :except => :show_without_filter
+ end
+
+ class AnomolousYetValidConditionController < ConditionalFilterController
+ before_filter(ConditionalClassFilter, :ensure_login, Proc.new {|c| c.assigns["ran_proc_filter1"] = true }, :except => :show_without_filter) { |c| c.assigns["ran_proc_filter2"] = true}
+ end
+
+ class EmptyFilterChainController < TestController
+ self.filter_chain.clear
+ def show
+ @action_executed = true
+ render :text => "yawp!"
+ end
+ end
+
+ class PrependingController < TestController
+ prepend_before_filter :wonderful_life
+ # skip_before_filter :fire_flash
+
+ private
+ def wonderful_life
+ @ran_filter ||= []
+ @ran_filter << "wonderful_life"
+ end
+ end
+
+ class ConditionalSkippingController < TestController
+ skip_before_filter :ensure_login, :only => [ :login ]
+ skip_after_filter :clean_up, :only => [ :login ]
+
+ before_filter :find_user, :only => [ :change_password ]
+
+ def login
+ render :inline => "ran action"
+ end
+
+ def change_password
+ render :inline => "ran action"
+ end
+
+ protected
+ def find_user
+ @ran_filter ||= []
+ @ran_filter << "find_user"
+ end
+ end
+
+ class ConditionalParentOfConditionalSkippingController < ConditionalFilterController
+ before_filter :conditional_in_parent, :only => [:show, :another_action]
+ after_filter :conditional_in_parent, :only => [:show, :another_action]
+
+ private
+
+ def conditional_in_parent
+ @ran_filter ||= []
+ @ran_filter << 'conditional_in_parent'
+ end
+ end
+
+ class ChildOfConditionalParentController < ConditionalParentOfConditionalSkippingController
+ skip_before_filter :conditional_in_parent, :only => :another_action
+ skip_after_filter :conditional_in_parent, :only => :another_action
+ end
+
+ class AnotherChildOfConditionalParentController < ConditionalParentOfConditionalSkippingController
+ skip_before_filter :conditional_in_parent, :only => :show
+ end
+
+ class ProcController < PrependingController
+ before_filter(proc { |c| c.assigns["ran_proc_filter"] = true })
+ end
+
+ class ImplicitProcController < PrependingController
+ before_filter { |c| c.assigns["ran_proc_filter"] = true }
+ end
+
+ class AuditFilter
+ def self.filter(controller)
+ controller.assigns["was_audited"] = true
+ end
+ end
+
+ class AroundFilter
+ def before(controller)
+ @execution_log = "before"
+ controller.class.execution_log << " before aroundfilter " if controller.respond_to? :execution_log
+ controller.assigns["before_ran"] = true
+ end
+
+ def after(controller)
+ controller.assigns["execution_log"] = @execution_log + " and after"
+ controller.assigns["after_ran"] = true
+ controller.class.execution_log << " after aroundfilter " if controller.respond_to? :execution_log
+ end
+ end
+
+ class AppendedAroundFilter
+ def before(controller)
+ controller.class.execution_log << " before appended aroundfilter "
+ end
+
+ def after(controller)
+ controller.class.execution_log << " after appended aroundfilter "
+ end
+ end
+
+ class AuditController < ActionController::Base
+ before_filter(AuditFilter)
+
+ def show
+ render :text => "hello"
+ end
+ end
+
+ class AroundFilterController < PrependingController
+ around_filter AroundFilter.new
+ end
+
+ class BeforeAfterClassFilterController < PrependingController
+ begin
+ filter = AroundFilter.new
+ before_filter filter
+ after_filter filter
+ end
+ end
+
+ class MixedFilterController < PrependingController
+ cattr_accessor :execution_log
+
+ def initialize
+ @@execution_log = ""
+ end
+
+ before_filter { |c| c.class.execution_log << " before procfilter " }
+ prepend_around_filter AroundFilter.new
+
+ after_filter { |c| c.class.execution_log << " after procfilter " }
+ append_around_filter AppendedAroundFilter.new
+ end
+
+ class MixedSpecializationController < ActionController::Base
+ class OutOfOrder < StandardError; end
+
+ before_filter :first
+ before_filter :second, :only => :foo
+
+ def foo
+ render :text => 'foo'
+ end
+
+ def bar
+ render :text => 'bar'
+ end
+
+ protected
+ def first
+ @first = true
+ end
+
+ def second
+ raise OutOfOrder unless @first
+ end
+ end
+
+ class DynamicDispatchController < ActionController::Base
+ before_filter :choose
+
+ %w(foo bar baz).each do |action|
+ define_method(action) { render :text => action }
+ end
+
+ private
+ def choose
+ self.action_name = params[:choose]
+ end
+ end
+
+ class PrependingBeforeAndAfterController < ActionController::Base
+ prepend_before_filter :before_all
+ prepend_after_filter :after_all
+ before_filter :between_before_all_and_after_all
+
+ def before_all
+ @ran_filter ||= []
+ @ran_filter << 'before_all'
+ end
+
+ def after_all
+ @ran_filter ||= []
+ @ran_filter << 'after_all'
+ end
+
+ def between_before_all_and_after_all
+ @ran_filter ||= []
+ @ran_filter << 'between_before_all_and_after_all'
+ end
+ def show
+ render :text => 'hello'
+ end
+ end
+
+ class ErrorToRescue < Exception; end
+
+ class RescuingAroundFilterWithBlock
+ def filter(controller)
+ begin
+ yield
+ rescue ErrorToRescue => ex
+ controller.send! :render, :text => "I rescued this: #{ex.inspect}"
+ end
+ end
+ end
+
+ class RescuedController < ActionController::Base
+ around_filter RescuingAroundFilterWithBlock.new
+
+ def show
+ raise ErrorToRescue.new("Something made the bad noise.")
+ end
+
+ private
+ def rescue_action(exception)
+ raise exception
+ end
+ end
+
+ class NonYieldingAroundFilterController < ActionController::Base
+
+ before_filter :filter_one
+ around_filter :non_yielding_filter
+ before_filter :filter_two
+ after_filter :filter_three
+
+ def index
+ render :inline => "index"
+ end
+
+ #make sure the controller complains
+ def rescue_action(e); raise e; end
+
+ private
+
+ def filter_one
+ @filters ||= []
+ @filters << "filter_one"
+ end
+
+ def filter_two
+ @filters << "filter_two"
+ end
+
+ def non_yielding_filter
+ @filters << "zomg it didn't yield"
+ @filter_return_value
+ end
+
+ def filter_three
+ @filters << "filter_three"
+ end
+
+ end
+
+ def test_non_yielding_around_filters_not_returning_false_do_not_raise
+ controller = NonYieldingAroundFilterController.new
+ controller.instance_variable_set "@filter_return_value", true
+ assert_nothing_raised do
+ test_process(controller, "index")
+ end
+ end
+
+ def test_non_yielding_around_filters_returning_false_do_not_raise
+ controller = NonYieldingAroundFilterController.new
+ controller.instance_variable_set "@filter_return_value", false
+ assert_nothing_raised do
+ test_process(controller, "index")
+ end
+ end
+
+ def test_after_filters_are_not_run_if_around_filter_returns_false
+ controller = NonYieldingAroundFilterController.new
+ controller.instance_variable_set "@filter_return_value", false
+ test_process(controller, "index")
+ assert_equal ["filter_one", "zomg it didn't yield"], controller.assigns['filters']
+ end
+
+ def test_after_filters_are_not_run_if_around_filter_does_not_yield
+ controller = NonYieldingAroundFilterController.new
+ controller.instance_variable_set "@filter_return_value", true
+ test_process(controller, "index")
+ assert_equal ["filter_one", "zomg it didn't yield"], controller.assigns['filters']
+ end
+
+ def test_empty_filter_chain
+ assert_equal 0, EmptyFilterChainController.filter_chain.size
+ assert test_process(EmptyFilterChainController).template.assigns['action_executed']
+ end
+
+ def test_added_filter_to_inheritance_graph
+ assert_equal [ :ensure_login ], TestController.before_filters
+ end
+
+ def test_base_class_in_isolation
+ assert_equal [ ], ActionController::Base.before_filters
+ end
+
+ def test_prepending_filter
+ assert_equal [ :wonderful_life, :ensure_login ], PrependingController.before_filters
+ end
+
+ def test_running_filters
+ assert_equal %w( wonderful_life ensure_login ), test_process(PrependingController).template.assigns["ran_filter"]
+ end
+
+ def test_running_filters_with_proc
+ assert test_process(ProcController).template.assigns["ran_proc_filter"]
+ end
+
+ def test_running_filters_with_implicit_proc
+ assert test_process(ImplicitProcController).template.assigns["ran_proc_filter"]
+ end
+
+ def test_running_filters_with_class
+ assert test_process(AuditController).template.assigns["was_audited"]
+ end
+
+ def test_running_anomolous_yet_valid_condition_filters
+ response = test_process(AnomolousYetValidConditionController)
+ assert_equal %w( ensure_login ), response.template.assigns["ran_filter"]
+ assert response.template.assigns["ran_class_filter"]
+ assert response.template.assigns["ran_proc_filter1"]
+ assert response.template.assigns["ran_proc_filter2"]
+
+ response = test_process(AnomolousYetValidConditionController, "show_without_filter")
+ assert_equal nil, response.template.assigns["ran_filter"]
+ assert !response.template.assigns["ran_class_filter"]
+ assert !response.template.assigns["ran_proc_filter1"]
+ assert !response.template.assigns["ran_proc_filter2"]
+ end
+
+ def test_running_collection_condition_filters
+ assert_equal %w( ensure_login ), test_process(ConditionalCollectionFilterController).template.assigns["ran_filter"]
+ assert_equal nil, test_process(ConditionalCollectionFilterController, "show_without_filter").template.assigns["ran_filter"]
+ assert_equal nil, test_process(ConditionalCollectionFilterController, "another_action").template.assigns["ran_filter"]
+ end
+
+ def test_running_only_condition_filters
+ assert_equal %w( ensure_login ), test_process(OnlyConditionSymController).template.assigns["ran_filter"]
+ assert_equal nil, test_process(OnlyConditionSymController, "show_without_filter").template.assigns["ran_filter"]
+
+ assert test_process(OnlyConditionProcController).template.assigns["ran_proc_filter"]
+ assert !test_process(OnlyConditionProcController, "show_without_filter").template.assigns["ran_proc_filter"]
+
+ assert test_process(OnlyConditionClassController).template.assigns["ran_class_filter"]
+ assert !test_process(OnlyConditionClassController, "show_without_filter").template.assigns["ran_class_filter"]
+ end
+
+ def test_running_except_condition_filters
+ assert_equal %w( ensure_login ), test_process(ExceptConditionSymController).template.assigns["ran_filter"]
+ assert_equal nil, test_process(ExceptConditionSymController, "show_without_filter").template.assigns["ran_filter"]
+
+ assert test_process(ExceptConditionProcController).template.assigns["ran_proc_filter"]
+ assert !test_process(ExceptConditionProcController, "show_without_filter").template.assigns["ran_proc_filter"]
+
+ assert test_process(ExceptConditionClassController).template.assigns["ran_class_filter"]
+ assert !test_process(ExceptConditionClassController, "show_without_filter").template.assigns["ran_class_filter"]
+ end
+
+ def test_running_before_and_after_condition_filters
+ assert_equal %w( ensure_login clean_up_tmp), test_process(BeforeAndAfterConditionController).template.assigns["ran_filter"]
+ assert_equal nil, test_process(BeforeAndAfterConditionController, "show_without_filter").template.assigns["ran_filter"]
+ end
+
+ def test_bad_filter
+ bad_filter_controller = Class.new(ActionController::Base)
+ assert_raises(ActionController::ActionControllerError) do
+ bad_filter_controller.before_filter 2
+ end
+ end
+
+ def test_around_filter
+ controller = test_process(AroundFilterController)
+ assert controller.template.assigns["before_ran"]
+ assert controller.template.assigns["after_ran"]
+ end
+
+ def test_before_after_class_filter
+ controller = test_process(BeforeAfterClassFilterController)
+ assert controller.template.assigns["before_ran"]
+ assert controller.template.assigns["after_ran"]
+ end
+
+ def test_having_properties_in_around_filter
+ controller = test_process(AroundFilterController)
+ assert_equal "before and after", controller.template.assigns["execution_log"]
+ end
+
+ def test_prepending_and_appending_around_filter
+ controller = test_process(MixedFilterController)
+ assert_equal " before aroundfilter before procfilter before appended aroundfilter " +
+ " after appended aroundfilter after aroundfilter after procfilter ",
+ MixedFilterController.execution_log
+ end
+
+ def test_rendering_breaks_filtering_chain
+ response = test_process(RenderingController)
+ assert_equal "something else", response.body
+ assert !response.template.assigns["ran_action"]
+ end
+
+ def test_filters_with_mixed_specialization_run_in_order
+ assert_nothing_raised do
+ response = test_process(MixedSpecializationController, 'bar')
+ assert_equal 'bar', response.body
+ end
+
+ assert_nothing_raised do
+ response = test_process(MixedSpecializationController, 'foo')
+ assert_equal 'foo', response.body
+ end
+ end
+
+ def test_dynamic_dispatch
+ %w(foo bar baz).each do |action|
+ request = ActionController::TestRequest.new
+ request.query_parameters[:choose] = action
+ response = DynamicDispatchController.process(request, ActionController::TestResponse.new)
+ assert_equal action, response.body
+ end
+ end
+
+ def test_running_prepended_before_and_after_filter
+ assert_equal 3, PrependingBeforeAndAfterController.filter_chain.length
+ response = test_process(PrependingBeforeAndAfterController)
+ assert_equal %w( before_all between_before_all_and_after_all after_all ), response.template.assigns["ran_filter"]
+ end
+
+ def test_conditional_skipping_of_filters
+ assert_nil test_process(ConditionalSkippingController, "login").template.assigns["ran_filter"]
+ assert_equal %w( ensure_login find_user ), test_process(ConditionalSkippingController, "change_password").template.assigns["ran_filter"]
+
+ assert_nil test_process(ConditionalSkippingController, "login").template.controller.instance_variable_get("@ran_after_filter")
+ assert_equal %w( clean_up ), test_process(ConditionalSkippingController, "change_password").template.controller.instance_variable_get("@ran_after_filter")
+ end
+
+ def test_conditional_skipping_of_filters_when_parent_filter_is_also_conditional
+ assert_equal %w( conditional_in_parent conditional_in_parent ), test_process(ChildOfConditionalParentController).template.assigns['ran_filter']
+ assert_nil test_process(ChildOfConditionalParentController, 'another_action').template.assigns['ran_filter']
+ end
+
+ def test_condition_skipping_of_filters_when_siblings_also_have_conditions
+ assert_equal %w( conditional_in_parent conditional_in_parent ), test_process(ChildOfConditionalParentController).template.assigns['ran_filter'], "1"
+ assert_equal nil, test_process(AnotherChildOfConditionalParentController).template.assigns['ran_filter']
+ assert_equal %w( conditional_in_parent conditional_in_parent ), test_process(ChildOfConditionalParentController).template.assigns['ran_filter']
+ end
+
+ def test_changing_the_requirements
+ assert_equal nil, test_process(ChangingTheRequirementsController, "go_wild").template.assigns['ran_filter']
+ end
+
+ def test_a_rescuing_around_filter
+ response = nil
+ assert_nothing_raised do
+ response = test_process(RescuedController)
+ end
+
+ assert response.success?
+ assert_equal("I rescued this: #", response.body)
+ end
+
+ private
+ def test_process(controller, action = "show")
+ request = ActionController::TestRequest.new
+ request.action = action
+ controller.process(request, ActionController::TestResponse.new)
+ end
+end
+
+
+
+class PostsController < ActionController::Base
+ def rescue_action(e); raise e; end
+
+ module AroundExceptions
+ class Error < StandardError ; end
+ class Before < Error ; end
+ class After < Error ; end
+ end
+ include AroundExceptions
+
+ class DefaultFilter
+ include AroundExceptions
+ end
+
+ module_eval %w(raises_before raises_after raises_both no_raise no_filter).map { |action| "def #{action}; default_action end" }.join("\n")
+
+ private
+ def default_action
+ render :inline => "#{action_name} called"
+ end
+end
+
+class ControllerWithSymbolAsFilter < PostsController
+ around_filter :raise_before, :only => :raises_before
+ around_filter :raise_after, :only => :raises_after
+ around_filter :without_exception, :only => :no_raise
+
+ private
+ def raise_before
+ raise Before
+ yield
+ end
+
+ def raise_after
+ yield
+ raise After
+ end
+
+ def without_exception
+ # Do stuff...
+ 1 + 1
+
+ yield
+
+ # Do stuff...
+ 1 + 1
+ end
+end
+
+class ControllerWithFilterClass < PostsController
+ class YieldingFilter < DefaultFilter
+ def self.filter(controller)
+ yield
+ raise After
+ end
+ end
+
+ around_filter YieldingFilter, :only => :raises_after
+end
+
+class ControllerWithFilterInstance < PostsController
+ class YieldingFilter < DefaultFilter
+ def filter(controller)
+ yield
+ raise After
+ end
+ end
+
+ around_filter YieldingFilter.new, :only => :raises_after
+end
+
+class ControllerWithFilterMethod < PostsController
+ class YieldingFilter < DefaultFilter
+ def filter(controller)
+ yield
+ raise After
+ end
+ end
+
+ around_filter YieldingFilter.new.method(:filter), :only => :raises_after
+end
+
+class ControllerWithProcFilter < PostsController
+ around_filter(:only => :no_raise) do |c,b|
+ c.assigns['before'] = true
+ b.call
+ c.assigns['after'] = true
+ end
+end
+
+class ControllerWithWrongFilterType < PostsController
+ around_filter lambda { yield }, :only => :no_raise
+end
+
+class ControllerWithNestedFilters < ControllerWithSymbolAsFilter
+ around_filter :raise_before, :raise_after, :without_exception, :only => :raises_both
+end
+
+class ControllerWithAllTypesOfFilters < PostsController
+ before_filter :before
+ around_filter :around
+ after_filter :after
+ around_filter :around_again
+
+ private
+ def before
+ @ran_filter ||= []
+ @ran_filter << 'before'
+ end
+
+ def around
+ @ran_filter << 'around (before yield)'
+ yield
+ @ran_filter << 'around (after yield)'
+ end
+
+ def after
+ @ran_filter << 'after'
+ end
+
+ def around_again
+ @ran_filter << 'around_again (before yield)'
+ yield
+ @ran_filter << 'around_again (after yield)'
+ end
+end
+
+class ControllerWithTwoLessFilters < ControllerWithAllTypesOfFilters
+ skip_filter :around_again
+ skip_filter :after
+end
+
+class YieldingAroundFiltersTest < Test::Unit::TestCase
+ include PostsController::AroundExceptions
+
+ def test_filters_registering
+ assert_equal 1, ControllerWithFilterMethod.filter_chain.size
+ assert_equal 1, ControllerWithFilterClass.filter_chain.size
+ assert_equal 1, ControllerWithFilterInstance.filter_chain.size
+ assert_equal 3, ControllerWithSymbolAsFilter.filter_chain.size
+ assert_equal 1, ControllerWithWrongFilterType.filter_chain.size
+ assert_equal 6, ControllerWithNestedFilters.filter_chain.size
+ assert_equal 4, ControllerWithAllTypesOfFilters.filter_chain.size
+ end
+
+ def test_wrong_filter_type
+ assert_raise(ActionController::ActionControllerError) do
+ test_process(ControllerWithWrongFilterType,'no_raise')
+ end
+ end
+
+ def test_base
+ controller = PostsController
+ assert_nothing_raised { test_process(controller,'no_raise') }
+ assert_nothing_raised { test_process(controller,'raises_before') }
+ assert_nothing_raised { test_process(controller,'raises_after') }
+ assert_nothing_raised { test_process(controller,'no_filter') }
+ end
+
+ def test_with_symbol
+ controller = ControllerWithSymbolAsFilter
+ assert_nothing_raised { test_process(controller,'no_raise') }
+ assert_raise(Before) { test_process(controller,'raises_before') }
+ assert_raise(After) { test_process(controller,'raises_after') }
+ assert_nothing_raised { test_process(controller,'no_raise') }
+ end
+
+ def test_with_class
+ controller = ControllerWithFilterClass
+ assert_nothing_raised { test_process(controller,'no_raise') }
+ assert_raise(After) { test_process(controller,'raises_after') }
+ end
+
+ def test_with_instance
+ controller = ControllerWithFilterInstance
+ assert_nothing_raised { test_process(controller,'no_raise') }
+ assert_raise(After) { test_process(controller,'raises_after') }
+ end
+
+ def test_with_method
+ controller = ControllerWithFilterMethod
+ assert_nothing_raised { test_process(controller,'no_raise') }
+ assert_raise(After) { test_process(controller,'raises_after') }
+ end
+
+ def test_with_proc
+ controller = test_process(ControllerWithProcFilter,'no_raise')
+ assert controller.template.assigns['before']
+ assert controller.template.assigns['after']
+ end
+
+ def test_nested_filters
+ controller = ControllerWithNestedFilters
+ assert_nothing_raised do
+ begin
+ test_process(controller,'raises_both')
+ rescue Before, After
+ end
+ end
+ assert_raise Before do
+ begin
+ test_process(controller,'raises_both')
+ rescue After
+ end
+ end
+ end
+
+ def test_filter_order_with_all_filter_types
+ controller = test_process(ControllerWithAllTypesOfFilters,'no_raise')
+ assert_equal 'before around (before yield) around_again (before yield) around_again (after yield) around (after yield) after',controller.template.assigns['ran_filter'].join(' ')
+ end
+
+ def test_filter_order_with_skip_filter_method
+ controller = test_process(ControllerWithTwoLessFilters,'no_raise')
+ assert_equal 'before around (before yield) around (after yield)',controller.template.assigns['ran_filter'].join(' ')
+ end
+
+ def test_first_filter_in_multiple_before_filter_chain_halts
+ controller = ::FilterTest::TestMultipleFiltersController.new
+ response = test_process(controller, 'fail_1')
+ assert_equal ' ', response.body
+ assert_equal 1, controller.instance_variable_get(:@try)
+ assert controller.instance_variable_get(:@before_filter_chain_aborted)
+ end
+
+ def test_second_filter_in_multiple_before_filter_chain_halts
+ controller = ::FilterTest::TestMultipleFiltersController.new
+ response = test_process(controller, 'fail_2')
+ assert_equal ' ', response.body
+ assert_equal 2, controller.instance_variable_get(:@try)
+ assert controller.instance_variable_get(:@before_filter_chain_aborted)
+ end
+
+ def test_last_filter_in_multiple_before_filter_chain_halts
+ controller = ::FilterTest::TestMultipleFiltersController.new
+ response = test_process(controller, 'fail_3')
+ assert_equal ' ', response.body
+ assert_equal 3, controller.instance_variable_get(:@try)
+ assert controller.instance_variable_get(:@before_filter_chain_aborted)
+ end
+
+ protected
+ def test_process(controller, action = "show")
+ request = ActionController::TestRequest.new
+ request.action = action
+ controller.process(request, ActionController::TestResponse.new)
+ end
+end
diff --git a/vendor/rails-2.0.2/actionpack/test/controller/flash_test.rb b/vendor/rails-2.0.2/actionpack/test/controller/flash_test.rb
new file mode 100644
index 000000000..4a6f3c9e0
--- /dev/null
+++ b/vendor/rails-2.0.2/actionpack/test/controller/flash_test.rb
@@ -0,0 +1,146 @@
+require File.dirname(__FILE__) + '/../abstract_unit'
+
+class FlashTest < Test::Unit::TestCase
+ class TestController < ActionController::Base
+ def set_flash
+ flash["that"] = "hello"
+ render :inline => "hello"
+ end
+
+ def set_flash_now
+ flash.now["that"] = "hello"
+ flash.now["foo"] ||= "bar"
+ flash.now["foo"] ||= "err"
+ @flashy = flash.now["that"]
+ @flash_copy = {}.update flash
+ render :inline => "hello"
+ end
+
+ def attempt_to_use_flash_now
+ @flash_copy = {}.update flash
+ @flashy = flash["that"]
+ render :inline => "hello"
+ end
+
+ def use_flash
+ @flash_copy = {}.update flash
+ @flashy = flash["that"]
+ render :inline => "hello"
+ end
+
+ def use_flash_and_keep_it
+ @flash_copy = {}.update flash
+ @flashy = flash["that"]
+ flash.keep
+ render :inline => "hello"
+ end
+
+ def use_flash_and_update_it
+ flash.update("this" => "hello again")
+ @flash_copy = {}.update flash
+ render :inline => "hello"
+ end
+
+ def use_flash_after_reset_session
+ flash["that"] = "hello"
+ @flashy_that = flash["that"]
+ reset_session
+ @flashy_that_reset = flash["that"]
+ flash["this"] = "good-bye"
+ @flashy_this = flash["this"]
+ render :inline => "hello"
+ end
+
+ def rescue_action(e)
+ raise unless ActionController::MissingTemplate === e
+ end
+
+ # methods for test_sweep_after_halted_filter_chain
+ before_filter :halt_and_redir, :only => "filter_halting_action"
+
+ def std_action
+ @flash_copy = {}.update(flash)
+ end
+
+ def filter_halting_action
+ @flash_copy = {}.update(flash)
+ end
+
+ def halt_and_redir
+ flash["foo"] = "bar"
+ redirect_to :action => "std_action"
+ @flash_copy = {}.update(flash)
+ end
+ end
+
+ def setup
+ @request = ActionController::TestRequest.new
+ @response = ActionController::TestResponse.new
+ @controller = TestController.new
+ end
+
+ def test_flash
+ get :set_flash
+
+ get :use_flash
+ assert_equal "hello", @response.template.assigns["flash_copy"]["that"]
+ assert_equal "hello", @response.template.assigns["flashy"]
+
+ get :use_flash
+ assert_nil @response.template.assigns["flash_copy"]["that"], "On second flash"
+ end
+
+ def test_keep_flash
+ get :set_flash
+
+ get :use_flash_and_keep_it
+ assert_equal "hello", @response.template.assigns["flash_copy"]["that"]
+ assert_equal "hello", @response.template.assigns["flashy"]
+
+ get :use_flash
+ assert_equal "hello", @response.template.assigns["flash_copy"]["that"], "On second flash"
+
+ get :use_flash
+ assert_nil @response.template.assigns["flash_copy"]["that"], "On third flash"
+ end
+
+ def test_flash_now
+ get :set_flash_now
+ assert_equal "hello", @response.template.assigns["flash_copy"]["that"]
+ assert_equal "bar" , @response.template.assigns["flash_copy"]["foo"]
+ assert_equal "hello", @response.template.assigns["flashy"]
+
+ get :attempt_to_use_flash_now
+ assert_nil @response.template.assigns["flash_copy"]["that"]
+ assert_nil @response.template.assigns["flash_copy"]["foo"]
+ assert_nil @response.template.assigns["flashy"]
+ end
+
+ def test_update_flash
+ get :set_flash
+ get :use_flash_and_update_it
+ assert_equal "hello", @response.template.assigns["flash_copy"]["that"]
+ assert_equal "hello again", @response.template.assigns["flash_copy"]["this"]
+ get :use_flash
+ assert_nil @response.template.assigns["flash_copy"]["that"], "On second flash"
+ assert_equal "hello again", @response.template.assigns["flash_copy"]["this"], "On second flash"
+ end
+
+ def test_flash_after_reset_session
+ get :use_flash_after_reset_session
+ assert_equal "hello", @response.template.assigns["flashy_that"]
+ assert_equal "good-bye", @response.template.assigns["flashy_this"]
+ assert_nil @response.template.assigns["flashy_that_reset"]
+ end
+
+ def test_sweep_after_halted_filter_chain
+ get :std_action
+ assert_nil @response.template.assigns["flash_copy"]["foo"]
+ get :filter_halting_action
+ assert_equal "bar", @response.template.assigns["flash_copy"]["foo"]
+ get :std_action # follow redirection
+ assert_equal "bar", @response.template.assigns["flash_copy"]["foo"]
+ get :std_action
+ assert_nil @response.template.assigns["flash_copy"]["foo"]
+ end
+end
diff --git a/vendor/rails-2.0.2/actionpack/test/controller/fragment_store_setting_test.rb b/vendor/rails-2.0.2/actionpack/test/controller/fragment_store_setting_test.rb
new file mode 100644
index 000000000..3df6fd0be
--- /dev/null
+++ b/vendor/rails-2.0.2/actionpack/test/controller/fragment_store_setting_test.rb
@@ -0,0 +1,47 @@
+require File.dirname(__FILE__) + '/../abstract_unit'
+
+MemCache = Struct.new(:MemCache, :address) unless Object.const_defined?(:MemCache)
+
+class FragmentCacheStoreSettingTest < Test::Unit::TestCase
+ def teardown
+ ActionController::Base.fragment_cache_store = ActionController::Caching::Fragments::MemoryStore.new
+ end
+
+ def test_file_fragment_cache_store
+ ActionController::Base.fragment_cache_store = :file_store, "/path/to/cache/directory"
+ assert_kind_of(
+ ActionController::Caching::Fragments::FileStore,
+ ActionController::Base.fragment_cache_store
+ )
+ assert_equal "/path/to/cache/directory", ActionController::Base.fragment_cache_store.cache_path
+ end
+
+ def test_drb_fragment_cache_store
+ ActionController::Base.fragment_cache_store = :drb_store, "druby://localhost:9192"
+ assert_kind_of(
+ ActionController::Caching::Fragments::DRbStore,
+ ActionController::Base.fragment_cache_store
+ )
+ assert_equal "druby://localhost:9192", ActionController::Base.fragment_cache_store.address
+ end
+
+ if defined? CGI::Session::MemCacheStore
+ def test_mem_cache_fragment_cache_store
+ ActionController::Base.fragment_cache_store = :mem_cache_store, "localhost"
+ assert_kind_of(
+ ActionController::Caching::Fragments::MemCacheStore,
+ ActionController::Base.fragment_cache_store
+ )
+ assert_equal %w(localhost), ActionController::Base.fragment_cache_store.addresses
+ end
+ end
+
+ def test_object_assigned_fragment_cache_store
+ ActionController::Base.fragment_cache_store = ActionController::Caching::Fragments::FileStore.new("/path/to/cache/directory")
+ assert_kind_of(
+ ActionController::Caching::Fragments::FileStore,
+ ActionController::Base.fragment_cache_store
+ )
+ assert_equal "/path/to/cache/directory", ActionController::Base.fragment_cache_store.cache_path
+ end
+end
diff --git a/vendor/rails-2.0.2/actionpack/test/controller/helper_test.rb b/vendor/rails-2.0.2/actionpack/test/controller/helper_test.rb
new file mode 100644
index 000000000..117f73b76
--- /dev/null
+++ b/vendor/rails-2.0.2/actionpack/test/controller/helper_test.rb
@@ -0,0 +1,206 @@
+require File.dirname(__FILE__) + '/../abstract_unit'
+
+ActionController::Helpers::HELPERS_DIR.replace File.dirname(__FILE__) + '/../fixtures/helpers'
+
+class TestController < ActionController::Base
+ attr_accessor :delegate_attr
+ def delegate_method() end
+ def rescue_action(e) raise end
+end
+
+module Fun
+ class GamesController < ActionController::Base
+ def render_hello_world
+ render :inline => "hello: <%= stratego %>"
+ end
+
+ def rescue_action(e) raise end
+ end
+
+ class PdfController < ActionController::Base
+ def test
+ render :inline => "test: <%= foobar %>"
+ end
+
+ def rescue_action(e) raise end
+ end
+end
+
+class ApplicationController < ActionController::Base
+ helper :all
+end
+
+module LocalAbcHelper
+ def a() end
+ def b() end
+ def c() end
+end
+
+class HelperTest < Test::Unit::TestCase
+ def setup
+ # Increment symbol counter.
+ @symbol = (@@counter ||= 'A0').succ!.dup
+
+ # Generate new controller class.
+ controller_class_name = "Helper#{@symbol}Controller"
+ eval("class #{controller_class_name} < TestController; end")
+ @controller_class = self.class.const_get(controller_class_name)
+
+ # Generate new template class and assign to controller.
+ template_class_name = "Test#{@symbol}View"
+ eval("class #{template_class_name} < ActionView::Base; end")
+ @template_class = self.class.const_get(template_class_name)
+ @controller_class.template_class = @template_class
+
+ # Set default test helper.
+ self.test_helper = LocalAbcHelper
+ end
+
+ def teardown
+ # Reset template class.
+ #ActionController::Base.template_class = ActionView::Base
+ end
+
+
+ def test_deprecated_helper
+ assert_equal expected_helper_methods, missing_methods
+ assert_nothing_raised { @controller_class.helper TestHelper }
+ assert_equal [], missing_methods
+ end
+
+ def test_declare_helper
+ require 'abc_helper'
+ self.test_helper = AbcHelper
+ assert_equal expected_helper_methods, missing_methods
+ assert_nothing_raised { @controller_class.helper :abc }
+ assert_equal [], missing_methods
+ end
+
+ def test_declare_missing_helper
+ assert_equal expected_helper_methods, missing_methods
+ assert_raise(MissingSourceFile) { @controller_class.helper :missing }
+ end
+
+ def test_declare_missing_file_from_helper
+ require 'broken_helper'
+ rescue LoadError => e
+ assert_nil(/\bbroken_helper\b/.match(e.to_s)[1])
+ end
+
+ def test_helper_block
+ assert_nothing_raised {
+ @controller_class.helper { def block_helper_method; end }
+ }
+ assert master_helper_methods.include?('block_helper_method')
+ end
+
+ def test_helper_block_include
+ assert_equal expected_helper_methods, missing_methods
+ assert_nothing_raised {
+ @controller_class.helper { include TestHelper }
+ }
+ assert [], missing_methods
+ end
+
+ def test_helper_method
+ assert_nothing_raised { @controller_class.helper_method :delegate_method }
+ assert master_helper_methods.include?('delegate_method')
+ end
+
+ def test_helper_attr
+ assert_nothing_raised { @controller_class.helper_attr :delegate_attr }
+ assert master_helper_methods.include?('delegate_attr')
+ assert master_helper_methods.include?('delegate_attr=')
+ end
+
+ def test_helper_for_nested_controller
+ request = ActionController::TestRequest.new
+ response = ActionController::TestResponse.new
+ request.action = 'render_hello_world'
+
+ assert_equal 'hello: Iz guuut!', Fun::GamesController.process(request, response).body
+ end
+
+ def test_helper_for_acronym_controller
+ request = ActionController::TestRequest.new
+ response = ActionController::TestResponse.new
+ request.action = 'test'
+
+ assert_equal 'test: baz', Fun::PdfController.process(request, response).body
+ end
+
+ def test_all_helpers
+ methods = ApplicationController.master_helper_module.instance_methods.map(&:to_s)
+
+ # abc_helper.rb
+ assert methods.include?('bare_a')
+
+ # fun/games_helper.rb
+ assert methods.include?('stratego')
+
+ # fun/pdf_helper.rb
+ assert methods.include?('foobar')
+ end
+
+ private
+ def expected_helper_methods
+ TestHelper.instance_methods.map(&:to_s)
+ end
+
+ def master_helper_methods
+ @controller_class.master_helper_module.instance_methods.map(&:to_s)
+ end
+
+ def missing_methods
+ expected_helper_methods - master_helper_methods
+ end
+
+ def test_helper=(helper_module)
+ silence_warnings { self.class.const_set('TestHelper', helper_module) }
+ end
+end
+
+
+class IsolatedHelpersTest < Test::Unit::TestCase
+ class A < ActionController::Base
+ def index
+ render :inline => '<%= shout %>'
+ end
+
+ def rescue_action(e) raise end
+ end
+
+ class B < A
+ helper { def shout; 'B' end }
+
+ def index
+ render :inline => '<%= shout %>'
+ end
+ end
+
+ class C < A
+ helper { def shout; 'C' end }
+
+ def index
+ render :inline => '<%= shout %>'
+ end
+ end
+
+ def setup
+ @request = ActionController::TestRequest.new
+ @response = ActionController::TestResponse.new
+ @request.action = 'index'
+ end
+
+ def test_helper_in_a
+ assert_raise(NameError) { A.process(@request, @response) }
+ end
+
+ def test_helper_in_b
+ assert_equal 'B', B.process(@request, @response).body
+ end
+
+ def test_helper_in_c
+ assert_equal 'C', C.process(@request, @response).body
+ end
+end
diff --git a/vendor/rails-2.0.2/actionpack/test/controller/html-scanner/document_test.rb b/vendor/rails-2.0.2/actionpack/test/controller/html-scanner/document_test.rb
new file mode 100644
index 000000000..0719883f3
--- /dev/null
+++ b/vendor/rails-2.0.2/actionpack/test/controller/html-scanner/document_test.rb
@@ -0,0 +1,124 @@
+require File.dirname(__FILE__) + '/../../abstract_unit'
+require 'test/unit'
+
+class DocumentTest < Test::Unit::TestCase
+ def test_handle_doctype
+ doc = nil
+ assert_nothing_raised do
+ doc = HTML::Document.new <<-HTML.strip
+
+
+
+ HTML
+ end
+ assert_equal 3, doc.root.children.length
+ assert_equal %{}, doc.root.children[0].content
+ assert_match %r{\s+}m, doc.root.children[1].content
+ assert_equal "html", doc.root.children[2].name
+ end
+
+ def test_find_img
+ doc = HTML::Document.new <<-HTML.strip
+
+
+
+
+
+ HTML
+ assert doc.find(:tag=>"img", :attributes=>{"src"=>"hello.gif"})
+ end
+
+ def test_find_all
+ doc = HTML::Document.new <<-HTML.strip
+
+
+
+
+
something
+
here is more
+
+
+
+ HTML
+ all = doc.find_all :attributes => { :class => "test" }
+ assert_equal 3, all.length
+ assert_equal [ "p", "p", "em" ], all.map { |n| n.name }
+ end
+
+ def test_find_with_text
+ doc = HTML::Document.new <<-HTML.strip
+
+
+ Some text
+
+
+ HTML
+ assert doc.find(:content => "Some text")
+ assert doc.find(:tag => "p", :child => { :content => "Some text" })
+ assert doc.find(:tag => "p", :child => "Some text")
+ assert doc.find(:tag => "p", :content => "Some text")
+ end
+
+ def test_parse_xml
+ assert_nothing_raised { HTML::Document.new(" ", true, true) }
+ assert_nothing_raised { HTML::Document.new(" something ", true, true) }
+ end
+
+ def test_parse_document
+ doc = HTML::Document.new(<<-HTML)
+
+ HTML
+ assert_not_nil doc.find(:tag => "div", :children => { :count => 1, :only => { :tag => "table" } })
+ end
+
+ def test_tag_nesting_nothing_to_s
+ doc = HTML::Document.new(" ")
+ assert_equal " ", doc.root.to_s
+ end
+
+ def test_tag_nesting_space_to_s
+ doc = HTML::Document.new(" ")
+ assert_equal " ", doc.root.to_s
+ end
+
+ def test_tag_nesting_text_to_s
+ doc = HTML::Document.new("text ")
+ assert_equal "text ", doc.root.to_s
+ end
+
+ def test_tag_nesting_tag_to_s
+ doc = HTML::Document.new(" ")
+ assert_equal " ", doc.root.to_s
+ end
+
+ def test_parse_cdata
+ doc = HTML::Document.new(<<-HTML)
+
+
+
+ ]]>
+
+
+ this document has <br> for a title
+
+
+HTML
+
+ assert_nil doc.find(:tag => "title", :descendant => { :tag => "br" })
+ assert doc.find(:tag => "title", :child => " ")
+ end
+
+ def test_find_empty_tag
+ doc = HTML::Document.new("
")
+ assert_nil doc.find(:tag => "div", :attributes => { :id => "map" }, :content => /./)
+ assert doc.find(:tag => "div", :attributes => { :id => "map" }, :content => /\A\Z/)
+ assert doc.find(:tag => "div", :attributes => { :id => "map" }, :content => /^$/)
+ assert doc.find(:tag => "div", :attributes => { :id => "map" }, :content => "")
+ assert doc.find(:tag => "div", :attributes => { :id => "map" }, :content => nil)
+ end
+end
diff --git a/vendor/rails-2.0.2/actionpack/test/controller/html-scanner/node_test.rb b/vendor/rails-2.0.2/actionpack/test/controller/html-scanner/node_test.rb
new file mode 100644
index 000000000..1cf0a4bb6
--- /dev/null
+++ b/vendor/rails-2.0.2/actionpack/test/controller/html-scanner/node_test.rb
@@ -0,0 +1,69 @@
+require File.dirname(__FILE__) + '/../../abstract_unit'
+require 'test/unit'
+
+class NodeTest < Test::Unit::TestCase
+
+ class MockNode
+ def initialize(matched, value)
+ @matched = matched
+ @value = value
+ end
+
+ def find(conditions)
+ @matched && self
+ end
+
+ def to_s
+ @value.to_s
+ end
+ end
+
+ def setup
+ @node = HTML::Node.new("parent")
+ @node.children.concat [MockNode.new(false,1), MockNode.new(true,"two"), MockNode.new(false,:three)]
+ end
+
+ def test_match
+ assert !@node.match("foo")
+ end
+
+ def test_tag
+ assert !@node.tag?
+ end
+
+ def test_to_s
+ assert_equal "1twothree", @node.to_s
+ end
+
+ def test_find
+ assert_equal "two", @node.find('blah').to_s
+ end
+
+ def test_parse_strict
+ s = ""
+ assert_raise(RuntimeError) { HTML::Node.parse(nil,0,0,s) }
+ end
+
+ def test_parse_relaxed
+ s = ""
+ node = nil
+ assert_nothing_raised { node = HTML::Node.parse(nil,0,0,s,false) }
+ assert node.attributes.has_key?("foo")
+ assert !node.attributes.has_key?("bar")
+ end
+
+ def test_to_s_with_boolean_attrs
+ s = ""
+ node = HTML::Node.parse(nil,0,0,s)
+ assert node.attributes.has_key?("foo")
+ assert node.attributes.has_key?("bar")
+ assert "", node.to_s
+ end
+
+ def test_parse_with_unclosed_tag
+ s = ""))
+ assert_equal("Dont touch me", sanitizer.sanitize("Dont touch me"))
+ assert_equal("This is a test.", sanitizer.sanitize("This is a test .
"))
+ assert_equal("Weirdos", sanitizer.sanitize("Wei<a onclick='alert(document.cookie);' />rdos"))
+ assert_equal("This is a test.", sanitizer.sanitize("This is a test."))
+ assert_equal(
+ %{This is a test.\n\n\nIt no longer contains any HTML.\n}, sanitizer.sanitize(
+ %{This is a test . \n\n\n\nIt no longer contains any HTML .
\n}))
+ assert_equal "This has a here.", sanitizer.sanitize("This has a here.")
+ [nil, '', ' '].each { |blank| assert_equal blank, sanitizer.sanitize(blank) }
+ end
+
+ def test_strip_links
+ sanitizer = HTML::LinkSanitizer.new
+ assert_equal "Dont touch me", sanitizer.sanitize("Dont touch me")
+ assert_equal "on my mind\nall day long", sanitizer.sanitize("on my mind \nall day long ")
+ assert_equal "0wn3d", sanitizer.sanitize("0wn3d ")
+ assert_equal "Magic", sanitizer.sanitize("Mag ic")
+ assert_equal "FrrFox", sanitizer.sanitize("FrrFox ")
+ assert_equal "My mind\nall day long", sanitizer.sanitize("My mind \nall day long ")
+ assert_equal "all day long", sanitizer.sanitize("<a href='hello'>all day long< /a>")
+
+ assert_equal " ", ''
+ end
+
+ def test_sanitize_plaintext
+ raw = "foo "
+ assert_sanitized raw, "foo "
+ end
+
+ def test_sanitize_script
+ assert_sanitized "a b cd e f", "a b cd e f"
+ end
+
+ # fucked
+ def test_sanitize_js_handlers
+ raw = %{onthis="do that" hello }
+ assert_sanitized raw, %{onthis="do that" hello }
+ end
+
+ def test_sanitize_javascript_href
+ raw = %{href="javascript:bang" foo , bar }
+ assert_sanitized raw, %{href="javascript:bang" foo , bar }
+ end
+
+ def test_sanitize_image_src
+ raw = %{src="javascript:bang" foo, bar }
+ assert_sanitized raw, %{src="javascript:bang" foo, bar }
+ end
+
+ HTML::WhiteListSanitizer.allowed_tags.each do |tag_name|
+ define_method "test_should_allow_#{tag_name}_tag" do
+ assert_sanitized "start <#{tag_name} title=\"1\" onclick=\"foo\">foo bar baz#{tag_name}> end", %(start <#{tag_name} title="1">foo bar baz#{tag_name}> end)
+ end
+ end
+
+ def test_should_allow_anchors
+ assert_sanitized %( ), %( )
+ end
+
+ # RFC 3986, sec 4.2
+ def test_allow_colons_in_path_component
+ assert_sanitized("foo ")
+ end
+
+ %w(src width height alt).each do |img_attr|
+ define_method "test_should_allow_image_#{img_attr}_attribute" do
+ assert_sanitized %( ), %( )
+ end
+ end
+
+ def test_should_handle_non_html
+ assert_sanitized 'abc'
+ end
+
+ def test_should_handle_blank_text
+ assert_sanitized nil
+ assert_sanitized ''
+ end
+
+ def test_should_allow_custom_tags
+ text = "foo "
+ sanitizer = HTML::WhiteListSanitizer.new
+ assert_equal(text, sanitizer.sanitize(text, :tags => %w(u)))
+ end
+
+ def test_should_allow_only_custom_tags
+ text = "foo with bar "
+ sanitizer = HTML::WhiteListSanitizer.new
+ assert_equal("foo with bar", sanitizer.sanitize(text, :tags => %w(u)))
+ end
+
+ def test_should_allow_custom_tags_with_attributes
+ text = %(foo )
+ sanitizer = HTML::WhiteListSanitizer.new
+ assert_equal(text, sanitizer.sanitize(text))
+ end
+
+ def test_should_allow_custom_tags_with_custom_attributes
+ text = %(Lorem ipsum )
+ sanitizer = HTML::WhiteListSanitizer.new
+ assert_equal(text, sanitizer.sanitize(text, :attributes => ['foo']))
+ end
+
+ [%w(img src), %w(a href)].each do |(tag, attr)|
+ define_method "test_should_strip_#{attr}_attribute_in_#{tag}_with_bad_protocols" do
+ assert_sanitized %(<#{tag} #{attr}="javascript:bang" title="1">boo#{tag}>), %(<#{tag} title="1">boo#{tag}>)
+ end
+ end
+
+ def test_should_flag_bad_protocols
+ sanitizer = HTML::WhiteListSanitizer.new
+ %w(about chrome data disk hcp help javascript livescript lynxcgi lynxexec ms-help ms-its mhtml mocha opera res resource shell vbscript view-source vnd.ms.radio wysiwyg).each do |proto|
+ assert sanitizer.send(:contains_bad_protocols?, 'src', "#{proto}://bad")
+ end
+ end
+
+ def test_should_accept_good_protocols
+ sanitizer = HTML::WhiteListSanitizer.new
+ HTML::WhiteListSanitizer.allowed_protocols.each do |proto|
+ assert !sanitizer.send(:contains_bad_protocols?, 'src', "#{proto}://good")
+ end
+ end
+
+ def test_should_reject_hex_codes_in_protocol
+ assert_sanitized %(1 ), "1 "
+ assert @sanitizer.send(:contains_bad_protocols?, 'src', "%6A%61%76%61%73%63%72%69%70%74%3A%61%6C%65%72%74%28%22%58%53%53%22%29")
+ end
+
+ def test_should_block_script_tag
+ assert_sanitized %(), ""
+ end
+
+ [%( ),
+ %( ),
+ %( ),
+ %( ">),
+ %( ),
+ %( ),
+ %( ),
+ %( ),
+ %( ),
+ %( ),
+ %( ),
+ %( ),
+ %( ),
+ %( ),
+ %( )].each_with_index do |img_hack, i|
+ define_method "test_should_not_fall_for_xss_image_hack_#{i+1}" do
+ assert_sanitized img_hack, " "
+ end
+ end
+
+ def test_should_sanitize_tag_broken_up_by_null
+ assert_sanitized %(alert(\"XSS\") ), "alert(\"XSS\")"
+ end
+
+ def test_should_sanitize_invalid_script_tag
+ assert_sanitized %(), ""
+ end
+
+ def test_should_sanitize_script_tag_with_multiple_open_brackets
+ assert_sanitized %(<), "<"
+ assert_sanitized %( }
+ assert_end
+ end
+
+ def test_unterminated_comment
+ tokenize %{hello \n\n It no longer contains any HTML .
\n}))
+ assert_equal "This has a here.", strip_tags("This has a here.")
+ [nil, '', ' '].each { |blank| assert_equal blank, strip_tags(blank) }
+ end
+
+ def assert_sanitized(text, expected = nil)
+ assert_equal((expected || text), sanitize(text))
+ end
+end
\ No newline at end of file
diff --git a/vendor/rails-2.0.2/actionpack/test/template/scriptaculous_helper_test.rb b/vendor/rails-2.0.2/actionpack/test/template/scriptaculous_helper_test.rb
new file mode 100644
index 000000000..04fbe33d5
--- /dev/null
+++ b/vendor/rails-2.0.2/actionpack/test/template/scriptaculous_helper_test.rb
@@ -0,0 +1,96 @@
+require "#{File.dirname(__FILE__)}/../abstract_unit"
+
+class ScriptaculousHelperTest < Test::Unit::TestCase
+ include ActionView::Helpers::JavaScriptHelper
+ include ActionView::Helpers::PrototypeHelper
+ include ActionView::Helpers::ScriptaculousHelper
+
+ include ActionView::Helpers::UrlHelper
+ include ActionView::Helpers::TagHelper
+ include ActionView::Helpers::TextHelper
+ include ActionView::Helpers::FormHelper
+ include ActionView::Helpers::CaptureHelper
+
+ def setup
+ @controller = Class.new do
+ def url_for(options)
+ url = "http://www.example.com/"
+ url << options[:action].to_s if options and options[:action]
+ url
+ end
+ end.new
+ end
+
+ def test_effect
+ assert_equal "new Effect.Highlight(\"posts\",{});", visual_effect(:highlight, "posts")
+ assert_equal "new Effect.Highlight(\"posts\",{});", visual_effect("highlight", :posts)
+ assert_equal "new Effect.Highlight(\"posts\",{});", visual_effect(:highlight, :posts)
+ assert_equal "new Effect.Fade(\"fademe\",{duration:4.0});", visual_effect(:fade, "fademe", :duration => 4.0)
+ assert_equal "new Effect.Shake(element,{});", visual_effect(:shake)
+ assert_equal "new Effect.DropOut(\"dropme\",{queue:'end'});", visual_effect(:drop_out, 'dropme', :queue => :end)
+ assert_equal "new Effect.Highlight(\"status\",{endcolor:'#EEEEEE'});", visual_effect(:highlight, 'status', :endcolor => '#EEEEEE')
+ assert_equal "new Effect.Highlight(\"status\",{restorecolor:'#500000', startcolor:'#FEFEFE'});", visual_effect(:highlight, 'status', :restorecolor => '#500000', :startcolor => '#FEFEFE')
+
+ # chop the queue params into a comma separated list
+ beginning, ending = 'new Effect.DropOut("dropme",{queue:{', '}});'
+ ve = [
+ visual_effect(:drop_out, 'dropme', :queue => {:position => "end", :scope => "test", :limit => 2}),
+ visual_effect(:drop_out, 'dropme', :queue => {:scope => :list, :limit => 2}),
+ visual_effect(:drop_out, 'dropme', :queue => {:position => :end, :scope => :test, :limit => 2})
+ ].collect { |v| v[beginning.length..-ending.length-1].split(',') }
+
+ assert ve[0].include?("limit:2")
+ assert ve[0].include?("scope:'test'")
+ assert ve[0].include?("position:'end'")
+
+ assert ve[1].include?("limit:2")
+ assert ve[1].include?("scope:'list'")
+
+ assert ve[2].include?("limit:2")
+ assert ve[2].include?("scope:'test'")
+ assert ve[2].include?("position:'end'")
+ end
+
+ def test_toggle_effects
+ assert_equal "Effect.toggle(\"posts\",'appear',{});", visual_effect(:toggle_appear, "posts")
+ assert_equal "Effect.toggle(\"posts\",'slide',{});", visual_effect(:toggle_slide, "posts")
+ assert_equal "Effect.toggle(\"posts\",'blind',{});", visual_effect(:toggle_blind, "posts")
+ assert_equal "Effect.toggle(\"posts\",'appear',{});", visual_effect("toggle_appear", "posts")
+ assert_equal "Effect.toggle(\"posts\",'slide',{});", visual_effect("toggle_slide", "posts")
+ assert_equal "Effect.toggle(\"posts\",'blind',{});", visual_effect("toggle_blind", "posts")
+ end
+
+
+ def test_sortable_element
+ assert_dom_equal %(),
+ sortable_element("mylist", :url => { :action => "order" })
+ assert_equal %(),
+ sortable_element("mylist", :tag => "div", :constraint => "horizontal", :url => { :action => "order" })
+ assert_dom_equal %||,
+ sortable_element("mylist", :containment => ['list1','list2'], :constraint => "horizontal", :url => { :action => "order" })
+ assert_dom_equal %(),
+ sortable_element("mylist", :containment => 'list1', :constraint => "horizontal", :url => { :action => "order" })
+ end
+
+ def test_draggable_element
+ assert_dom_equal %(),
+ draggable_element("product_13")
+ assert_equal %(),
+ draggable_element("product_13", :revert => true)
+ end
+
+ def test_drop_receiving_element
+ assert_dom_equal %(),
+ drop_receiving_element("droptarget1")
+ assert_dom_equal %(),
+ drop_receiving_element("droptarget1", :accept => 'products')
+ assert_dom_equal %(),
+ drop_receiving_element("droptarget1", :accept => 'products', :update => 'infobox')
+ assert_dom_equal %(),
+ drop_receiving_element("droptarget1", :accept => ['tshirts','mugs'], :update => 'infobox')
+ end
+
+ def protect_against_forgery?
+ false
+ end
+end
diff --git a/vendor/rails-2.0.2/actionpack/test/template/tag_helper_test.rb b/vendor/rails-2.0.2/actionpack/test/template/tag_helper_test.rb
new file mode 100644
index 000000000..c7edc678f
--- /dev/null
+++ b/vendor/rails-2.0.2/actionpack/test/template/tag_helper_test.rb
@@ -0,0 +1,80 @@
+require "#{File.dirname(__FILE__)}/../abstract_unit"
+
+class TagHelperTest < Test::Unit::TestCase
+ include ActionView::Helpers::TagHelper
+ include ActionView::Helpers::UrlHelper
+ include ActionView::Helpers::TextHelper
+ include ActionView::Helpers::CaptureHelper
+
+ def test_tag
+ assert_equal " ", tag("br")
+ assert_equal " ", tag(:br, :clear => "left")
+ assert_equal " ", tag("br", nil, true)
+ end
+
+ def test_tag_options
+ str = tag("p", "class" => "show", :class => "elsewhere")
+ assert_match /class="show"/, str
+ assert_match /class="elsewhere"/, str
+ end
+
+ def test_tag_options_rejects_nil_option
+ assert_equal "
", tag("p", :ignored => nil)
+ end
+
+ def test_tag_options_accepts_blank_option
+ assert_equal "
", tag("p", :included => '')
+ end
+
+ def test_tag_options_converts_boolean_option
+ assert_equal '
',
+ tag("p", :disabled => true, :multiple => true, :readonly => true)
+ end
+
+ def test_content_tag
+ assert_equal "Create ", content_tag("a", "Create", "href" => "create")
+ assert_equal content_tag("a", "Create", "href" => "create"),
+ content_tag("a", "Create", :href => "create")
+ end
+
+ def test_content_tag_with_block
+ _erbout = ''
+ content_tag(:div) { _erbout.concat "Hello world!" }
+ assert_dom_equal "Hello world!
", _erbout
+ end
+
+ def test_content_tag_with_block_and_options
+ _erbout = ''
+ content_tag(:div, :class => "green") { _erbout.concat "Hello world!" }
+ assert_dom_equal %(Hello world!
), _erbout
+ end
+
+ def test_content_tag_with_block_and_options_outside_of_action_view
+ assert_equal content_tag("a", "Create", :href => "create"),
+ content_tag("a", "href" => "create") { "Create" }
+ end
+
+ def test_cdata_section
+ assert_equal "]]>", cdata_section("")
+ end
+
+ def test_escape_once
+ assert_equal '1 < 2 & 3', escape_once('1 < 2 & 3')
+ end
+
+ def test_double_escaping_attributes
+ ['1&2', '1 < 2', '“test“'].each do |escaped|
+ assert_equal %( ), tag('a', :href => escaped)
+ end
+ end
+
+ def test_skip_invalid_escaped_attributes
+ ['&1;', 'dfa3;', '& #123;'].each do |escaped|
+ assert_equal %( ), tag('a', :href => escaped)
+ end
+ end
+
+ def test_disable_escaping
+ assert_equal ' ', tag('a', { :href => '&' }, false, false)
+ end
+end
diff --git a/vendor/rails-2.0.2/actionpack/test/template/text_helper_test.rb b/vendor/rails-2.0.2/actionpack/test/template/text_helper_test.rb
new file mode 100644
index 000000000..92d6bc3ae
--- /dev/null
+++ b/vendor/rails-2.0.2/actionpack/test/template/text_helper_test.rb
@@ -0,0 +1,335 @@
+require "#{File.dirname(__FILE__)}/../abstract_unit"
+require "#{File.dirname(__FILE__)}/../testing_sandbox"
+
+class TextHelperTest < Test::Unit::TestCase
+ include ActionView::Helpers::TextHelper
+ include ActionView::Helpers::TagHelper
+ include TestingSandbox
+
+ def setup
+ # This simulates the fact that instance variables are reset every time
+ # a view is rendered. The cycle helper depends on this behavior.
+ @_cycles = nil if (defined? @_cycles)
+ end
+
+ def test_simple_format
+ assert_equal "
", simple_format(nil)
+
+ assert_equal "crazy\n cross\n platform linebreaks
", simple_format("crazy\r\n cross\r platform linebreaks")
+ assert_equal "A paragraph
\n\nand another one!
", simple_format("A paragraph\n\nand another one!")
+ assert_equal "A paragraph\n With a newline
", simple_format("A paragraph\n With a newline")
+
+ text = "A\nB\nC\nD".freeze
+ assert_equal "A\n B\n C\n D
", simple_format(text)
+
+ text = "A\r\n \nB\n\n\r\n\t\nC\nD".freeze
+ assert_equal "A\n \n B
\n\n\t\n C\n D
", simple_format(text)
+ end
+
+ def test_truncate
+ assert_equal "Hello World!", truncate("Hello World!", 12)
+ assert_equal "Hello Wor...", truncate("Hello World!!", 12)
+ end
+
+ def test_truncate_should_use_default_length_of_30
+ str = "This is a string that will go longer then the default truncate length of 30"
+ assert_equal str[0...27] + "...", truncate(str)
+ end
+
+ def test_truncate_multibyte
+ with_kcode 'none' do
+ assert_equal "\354\225\210\353\205\225\355...", truncate("\354\225\210\353\205\225\355\225\230\354\204\270\354\232\224", 10)
+ end
+ with_kcode 'u' do
+ assert_equal "\354\225\204\353\246\254\353\236\221 \354\225\204\353\246\254 ...",
+ truncate("\354\225\204\353\246\254\353\236\221 \354\225\204\353\246\254 \354\225\204\353\235\274\353\246\254\354\230\244", 10)
+ end
+ end
+
+ def test_highlighter
+ assert_equal(
+ "This is a beautiful morning",
+ highlight("This is a beautiful morning", "beautiful")
+ )
+
+ assert_equal(
+ "This is a beautiful morning, but also a beautiful day",
+ highlight("This is a beautiful morning, but also a beautiful day", "beautiful")
+ )
+
+ assert_equal(
+ "This is a beautiful morning, but also a beautiful day",
+ highlight("This is a beautiful morning, but also a beautiful day", "beautiful", '\1 ')
+ )
+
+ assert_equal(
+ "This text is not changed because we supplied an empty phrase",
+ highlight("This text is not changed because we supplied an empty phrase", nil)
+ )
+
+ assert_equal ' ', highlight(' ', 'blank text is returned verbatim')
+ end
+
+ def test_highlighter_with_regexp
+ assert_equal(
+ "This is a beautiful! morning",
+ highlight("This is a beautiful! morning", "beautiful!")
+ )
+
+ assert_equal(
+ "This is a beautiful! morning ",
+ highlight("This is a beautiful! morning", "beautiful! morning")
+ )
+
+ assert_equal(
+ "This is a beautiful? morning ",
+ highlight("This is a beautiful? morning", "beautiful? morning")
+ )
+ end
+
+ def test_highlighting_multiple_phrases_in_one_pass
+ assert_equal %(wow em ), highlight('wow em', %w(wow em), '\1 ')
+ end
+
+ def test_excerpt
+ assert_equal("...is a beautiful morni...", excerpt("This is a beautiful morning", "beautiful", 5))
+ assert_equal("This is a...", excerpt("This is a beautiful morning", "this", 5))
+ assert_equal("...iful morning", excerpt("This is a beautiful morning", "morning", 5))
+ assert_nil excerpt("This is a beautiful morning", "day")
+ end
+
+ def test_excerpt_with_regex
+ assert_equal('...is a beautiful! morn...', excerpt('This is a beautiful! morning', 'beautiful', 5))
+ assert_equal('...is a beautiful? morn...', excerpt('This is a beautiful? morning', 'beautiful', 5))
+ end
+
+ def test_excerpt_with_utf8
+ with_kcode('u') do
+ assert_equal("...fficiency could not be h...", excerpt("That's why efficiency could not be helped", 'could', 8))
+ end
+ with_kcode('none') do
+ assert_equal("...\203ciency could not be h...", excerpt("That's why efficiency could not be helped", 'could', 8))
+ end
+ end
+
+ def test_word_wrap
+ assert_equal("my very very\nvery long\nstring", word_wrap("my very very very long string", 15))
+ end
+
+ def test_word_wrap_with_extra_newlines
+ assert_equal("my very very\nvery long\nstring\n\nwith another\nline", word_wrap("my very very very long string\n\nwith another line", 15))
+ end
+
+ def test_pluralization
+ assert_equal("1 count", pluralize(1, "count"))
+ assert_equal("2 counts", pluralize(2, "count"))
+ assert_equal("1 count", pluralize('1', "count"))
+ assert_equal("2 counts", pluralize('2', "count"))
+ assert_equal("1,066 counts", pluralize('1,066', "count"))
+ assert_equal("1.25 counts", pluralize('1.25', "count"))
+ assert_equal("2 counters", pluralize(2, "count", "counters"))
+ assert_equal("0 counters", pluralize(nil, "count", "counters"))
+ assert_equal("2 people", pluralize(2, "person"))
+ assert_equal("10 buffaloes", pluralize(10, "buffalo"))
+ end
+
+ uses_mocha("should_just_add_s_for_pluralize_without_inflector_loaded") do
+ def test_should_just_add_s_for_pluralize_without_inflector_loaded
+ Object.expects(:const_defined?).with("Inflector").times(4).returns(false)
+ assert_equal("1 count", pluralize(1, "count"))
+ assert_equal("2 persons", pluralize(2, "person"))
+ assert_equal("2 personss", pluralize("2", "persons"))
+ assert_equal("2 counts", pluralize(2, "count"))
+ assert_equal("10 buffalos", pluralize(10, "buffalo"))
+ end
+ end
+
+ def test_auto_link_parsing
+ urls = %w(http://www.rubyonrails.com
+ http://www.rubyonrails.com:80
+ http://www.rubyonrails.com/~minam
+ https://www.rubyonrails.com/~minam
+ http://www.rubyonrails.com/~minam/url%20with%20spaces
+ http://www.rubyonrails.com/foo.cgi?something=here
+ http://www.rubyonrails.com/foo.cgi?something=here&and=here
+ http://www.rubyonrails.com/contact;new
+ http://www.rubyonrails.com/contact;new%20with%20spaces
+ http://www.rubyonrails.com/contact;new?with=query&string=params
+ http://www.rubyonrails.com/~minam/contact;new?with=query&string=params
+ http://en.wikipedia.org/wiki/Wikipedia:Today%27s_featured_picture_%28animation%29/January_20%2C_2007
+ http://www.mail-archive.com/rails@lists.rubyonrails.org/
+ )
+
+ urls.each do |url|
+ assert_equal %(#{url} ), auto_link(url)
+ end
+ end
+
+ def test_auto_linking
+ email_raw = 'david@loudthinking.com'
+ email_result = %{#{email_raw} }
+ email2_raw = '+david@loudthinking.com'
+ email2_result = %{#{email2_raw} }
+ link_raw = 'http://www.rubyonrails.com'
+ link_result = %{#{link_raw} }
+ link_result_with_options = %{#{link_raw} }
+ link2_raw = 'www.rubyonrails.com'
+ link2_result = %{#{link2_raw} }
+ link3_raw = 'http://manuals.ruby-on-rails.com/read/chapter.need_a-period/103#page281'
+ link3_result = %{#{link3_raw} }
+ link4_raw = 'http://foo.example.com/controller/action?parm=value&p2=v2#anchor123'
+ link4_result = %{#{link4_raw} }
+ link5_raw = 'http://foo.example.com:3000/controller/action'
+ link5_result = %{#{link5_raw} }
+ link6_raw = 'http://foo.example.com:3000/controller/action+pack'
+ link6_result = %{#{link6_raw} }
+ link7_raw = 'http://foo.example.com/controller/action?parm=value&p2=v2#anchor-123'
+ link7_result = %{#{link7_raw} }
+ link8_raw = 'http://foo.example.com:3000/controller/action.html'
+ link8_result = %{#{link8_raw} }
+ link9_raw = 'http://business.timesonline.co.uk/article/0,,9065-2473189,00.html'
+ link9_result = %{#{link9_raw} }
+ link10_raw = 'http://www.mail-archive.com/ruby-talk@ruby-lang.org/'
+ link10_result = %{#{link10_raw} }
+
+ assert_equal %(hello #{email_result}), auto_link("hello #{email_raw}", :email_addresses)
+ assert_equal %(Go to #{link_result}), auto_link("Go to #{link_raw}", :urls)
+ assert_equal %(Go to #{link_raw}), auto_link("Go to #{link_raw}", :email_addresses)
+ assert_equal %(Go to #{link_result} and say hello to #{email_result}), auto_link("Go to #{link_raw} and say hello to #{email_raw}")
+ assert_equal %(Link #{link_result}
), auto_link("Link #{link_raw}
")
+ assert_equal %(#{link_result} Link
), auto_link("#{link_raw} Link
")
+ assert_equal %(Link #{link_result_with_options}
), auto_link("Link #{link_raw}
", :all, {:target => "_blank"})
+ assert_equal %(Go to #{link_result}.), auto_link(%(Go to #{link_raw}.))
+ assert_equal %(Go to #{link_result}, then say hello to #{email_result}.
), auto_link(%(Go to #{link_raw}, then say hello to #{email_raw}.
))
+ assert_equal %(Go to #{link2_result}), auto_link("Go to #{link2_raw}", :urls)
+ assert_equal %(Go to #{link2_raw}), auto_link("Go to #{link2_raw}", :email_addresses)
+ assert_equal %(Link #{link2_result}
), auto_link("Link #{link2_raw}
")
+ assert_equal %(#{link2_result} Link
), auto_link("#{link2_raw} Link
")
+ assert_equal %(Go to #{link2_result}.), auto_link(%(Go to #{link2_raw}.))
+ assert_equal %(Say hello to #{email_result}, then go to #{link2_result}.
), auto_link(%(Say hello to #{email_raw}, then go to #{link2_raw}.
))
+ assert_equal %(Go to #{link3_result}), auto_link("Go to #{link3_raw}", :urls)
+ assert_equal %(Go to #{link3_raw}), auto_link("Go to #{link3_raw}", :email_addresses)
+ assert_equal %(Link #{link3_result}
), auto_link("Link #{link3_raw}
")
+ assert_equal %(#{link3_result} Link
), auto_link("#{link3_raw} Link
")
+ assert_equal %(Go to #{link3_result}.), auto_link(%(Go to #{link3_raw}.))
+ assert_equal %(Go to #{link3_result}. seriously, #{link3_result}? i think I'll say hello to #{email_result}. instead.
), auto_link(%(Go to #{link3_raw}. seriously, #{link3_raw}? i think I'll say hello to #{email_raw}. instead.
))
+ assert_equal %(Link #{link4_result}
), auto_link("Link #{link4_raw}
")
+ assert_equal %(#{link4_result} Link
), auto_link("#{link4_raw} Link
")
+ assert_equal %(#{link5_result} Link
), auto_link("#{link5_raw} Link
")
+ assert_equal %(#{link6_result} Link
), auto_link("#{link6_raw} Link
")
+ assert_equal %(#{link7_result} Link
), auto_link("#{link7_raw} Link
")
+ assert_equal %(Go to #{link8_result}), auto_link("Go to #{link8_raw}", :urls)
+ assert_equal %(Go to #{link8_raw}), auto_link("Go to #{link8_raw}", :email_addresses)
+ assert_equal %(Link #{link8_result}
), auto_link("Link #{link8_raw}
")
+ assert_equal %(#{link8_result} Link
), auto_link("#{link8_raw} Link
")
+ assert_equal %(Go to #{link8_result}.), auto_link(%(Go to #{link8_raw}.))
+ assert_equal %(Go to #{link8_result}. seriously, #{link8_result}? i think I'll say hello to #{email_result}. instead.
), auto_link(%(Go to #{link8_raw}. seriously, #{link8_raw}? i think I'll say hello to #{email_raw}. instead.
))
+ assert_equal %(Go to #{link9_result}), auto_link("Go to #{link9_raw}", :urls)
+ assert_equal %(Go to #{link9_raw}), auto_link("Go to #{link9_raw}", :email_addresses)
+ assert_equal %(Link #{link9_result}
), auto_link("Link #{link9_raw}
")
+ assert_equal %(#{link9_result} Link
), auto_link("#{link9_raw} Link
")
+ assert_equal %(Go to #{link9_result}.), auto_link(%(Go to #{link9_raw}.))
+ assert_equal %(Go to #{link9_result}. seriously, #{link9_result}? i think I'll say hello to #{email_result}. instead.
), auto_link(%(Go to #{link9_raw}. seriously, #{link9_raw}? i think I'll say hello to #{email_raw}. instead.
))
+ assert_equal %(#{link10_result} Link
), auto_link("#{link10_raw} Link
")
+ assert_equal email2_result, auto_link(email2_raw)
+ assert_equal '', auto_link(nil)
+ assert_equal '', auto_link('')
+ end
+
+ def test_auto_link_at_eol
+ url1 = "http://api.rubyonrails.com/Foo.html"
+ url2 = "http://www.ruby-doc.org/core/Bar.html"
+
+ assert_equal %(#{url1} #{url2}
), auto_link("#{url1} #{url2}
")
+ end
+
+ def test_auto_link_with_block
+ url = "http://api.rubyonrails.com/Foo.html"
+ email = "fantabulous@shiznadel.ic"
+
+ assert_equal %(#{url[0...7]}... #{email[0...7]}...
), auto_link("#{url} #{email}
") { |url| truncate(url, 10) }
+ end
+
+ def test_cycle_class
+ value = Cycle.new("one", 2, "3")
+ assert_equal("one", value.to_s)
+ assert_equal("2", value.to_s)
+ assert_equal("3", value.to_s)
+ assert_equal("one", value.to_s)
+ value.reset
+ assert_equal("one", value.to_s)
+ assert_equal("2", value.to_s)
+ assert_equal("3", value.to_s)
+ end
+
+ def test_cycle_class_with_no_arguments
+ assert_raise(ArgumentError) { value = Cycle.new() }
+ end
+
+ def test_cycle
+ assert_equal("one", cycle("one", 2, "3"))
+ assert_equal("2", cycle("one", 2, "3"))
+ assert_equal("3", cycle("one", 2, "3"))
+ assert_equal("one", cycle("one", 2, "3"))
+ assert_equal("2", cycle("one", 2, "3"))
+ assert_equal("3", cycle("one", 2, "3"))
+ end
+
+ def test_cycle_with_no_arguments
+ assert_raise(ArgumentError) { value = cycle() }
+ end
+
+ def test_cycle_resets_with_new_values
+ assert_equal("even", cycle("even", "odd"))
+ assert_equal("odd", cycle("even", "odd"))
+ assert_equal("even", cycle("even", "odd"))
+ assert_equal("1", cycle(1, 2, 3))
+ assert_equal("2", cycle(1, 2, 3))
+ assert_equal("3", cycle(1, 2, 3))
+ assert_equal("1", cycle(1, 2, 3))
+ end
+
+ def test_named_cycles
+ assert_equal("1", cycle(1, 2, 3, :name => "numbers"))
+ assert_equal("red", cycle("red", "blue", :name => "colors"))
+ assert_equal("2", cycle(1, 2, 3, :name => "numbers"))
+ assert_equal("blue", cycle("red", "blue", :name => "colors"))
+ assert_equal("3", cycle(1, 2, 3, :name => "numbers"))
+ assert_equal("red", cycle("red", "blue", :name => "colors"))
+ end
+
+ def test_default_named_cycle
+ assert_equal("1", cycle(1, 2, 3))
+ assert_equal("2", cycle(1, 2, 3, :name => "default"))
+ assert_equal("3", cycle(1, 2, 3))
+ end
+
+ def test_reset_cycle
+ assert_equal("1", cycle(1, 2, 3))
+ assert_equal("2", cycle(1, 2, 3))
+ reset_cycle
+ assert_equal("1", cycle(1, 2, 3))
+ end
+
+ def test_reset_unknown_cycle
+ reset_cycle("colors")
+ end
+
+ def test_recet_named_cycle
+ assert_equal("1", cycle(1, 2, 3, :name => "numbers"))
+ assert_equal("red", cycle("red", "blue", :name => "colors"))
+ reset_cycle("numbers")
+ assert_equal("1", cycle(1, 2, 3, :name => "numbers"))
+ assert_equal("blue", cycle("red", "blue", :name => "colors"))
+ assert_equal("2", cycle(1, 2, 3, :name => "numbers"))
+ assert_equal("red", cycle("red", "blue", :name => "colors"))
+ end
+
+ def test_cycle_no_instance_variable_clashes
+ @cycles = %w{Specialized Fuji Giant}
+ assert_equal("red", cycle("red", "blue"))
+ assert_equal("blue", cycle("red", "blue"))
+ assert_equal("red", cycle("red", "blue"))
+ assert_equal(%w{Specialized Fuji Giant}, @cycles)
+ end
+end
diff --git a/vendor/rails-2.0.2/actionpack/test/template/url_helper_test.rb b/vendor/rails-2.0.2/actionpack/test/template/url_helper_test.rb
new file mode 100644
index 000000000..ee75965be
--- /dev/null
+++ b/vendor/rails-2.0.2/actionpack/test/template/url_helper_test.rb
@@ -0,0 +1,536 @@
+require "#{File.dirname(__FILE__)}/../abstract_unit"
+
+RequestMock = Struct.new("Request", :request_uri, :protocol, :host_with_port, :env)
+
+class UrlHelperTest < Test::Unit::TestCase
+ include ActionView::Helpers::AssetTagHelper
+ include ActionView::Helpers::UrlHelper
+ include ActionView::Helpers::TagHelper
+
+ def setup
+ @controller = Class.new do
+ attr_accessor :url, :request
+ def url_for(options)
+ url
+ end
+ end
+ @controller = @controller.new
+ @controller.url = "http://www.example.com"
+ end
+
+ def test_url_for_escapes_urls
+ @controller.url = "http://www.example.com?a=b&c=d"
+ assert_equal "http://www.example.com?a=b&c=d", url_for(:a => 'b', :c => 'd')
+ assert_equal "http://www.example.com?a=b&c=d", url_for(:a => 'b', :c => 'd', :escape => true)
+ assert_equal "http://www.example.com?a=b&c=d", url_for(:a => 'b', :c => 'd', :escape => false)
+ end
+
+ def test_url_for_escapes_url_once
+ @controller.url = "http://www.example.com?a=b&c=d"
+ assert_equal "http://www.example.com?a=b&c=d", url_for("http://www.example.com?a=b&c=d")
+ end
+
+ # todo: missing test cases
+ def test_button_to_with_straight_url
+ assert_dom_equal "", button_to("Hello", "http://www.example.com")
+ end
+
+ def test_button_to_with_query
+ assert_dom_equal "", button_to("Hello", "http://www.example.com/q1=v1&q2=v2")
+ end
+
+ def test_button_to_with_escaped_query
+ assert_dom_equal "", button_to("Hello", "http://www.example.com/q1=v1&q2=v2")
+ end
+
+ def test_button_to_with_query_and_no_name
+ assert_dom_equal "", button_to(nil, "http://www.example.com?q1=v1&q2=v2")
+ end
+
+ def test_button_to_with_javascript_confirm
+ assert_dom_equal(
+ "",
+ button_to("Hello", "http://www.example.com", :confirm => "Are you sure?")
+ )
+ end
+
+ def test_button_to_enabled_disabled
+ assert_dom_equal(
+ "",
+ button_to("Hello", "http://www.example.com", :disabled => false)
+ )
+ assert_dom_equal(
+ "",
+ button_to("Hello", "http://www.example.com", :disabled => true)
+ )
+ end
+
+ def test_button_to_with_method_delete
+ assert_dom_equal(
+ "",
+ button_to("Hello", "http://www.example.com", :method => :delete)
+ )
+ end
+
+ def test_button_to_with_method_get
+ assert_dom_equal(
+ "",
+ button_to("Hello", "http://www.example.com", :method => :get)
+ )
+ end
+
+ def test_link_tag_with_straight_url
+ assert_dom_equal "Hello ", link_to("Hello", "http://www.example.com")
+ end
+
+ def test_link_tag_without_host_option
+ ActionController::Base.class_eval { attr_accessor :url }
+ url = {:controller => 'weblog', :action => 'show'}
+ @controller = ActionController::Base.new
+ @controller.request = ActionController::TestRequest.new
+ @controller.url = ActionController::UrlRewriter.new(@controller.request, url)
+ assert_dom_equal(%q{Test Link }, link_to('Test Link', url))
+ end
+
+ def test_link_tag_with_host_option
+ ActionController::Base.class_eval { attr_accessor :url }
+ url = {:controller => 'weblog', :action => 'show', :host => 'www.example.com'}
+ @controller = ActionController::Base.new
+ @controller.request = ActionController::TestRequest.new
+ @controller.url = ActionController::UrlRewriter.new(@controller.request, url)
+ assert_dom_equal(%q{Test Link }, link_to('Test Link', url))
+ end
+
+ def test_link_tag_with_query
+ assert_dom_equal "Hello ", link_to("Hello", "http://www.example.com?q1=v1&q2=v2")
+ end
+
+ def test_link_tag_with_query_and_no_name
+ assert_dom_equal "http://www.example.com?q1=v1&q2=v2 ", link_to(nil, "http://www.example.com?q1=v1&q2=v2")
+ end
+
+ def test_link_tag_with_back
+ @controller.request = RequestMock.new("http://www.example.com/weblog/show", nil, nil, {'HTTP_REFERER' => 'http://www.example.com/referer'})
+ assert_dom_equal "go back ", link_to('go back', :back)
+ end
+
+ def test_link_tag_with_back_and_no_referer
+ @controller.request = RequestMock.new("http://www.example.com/weblog/show", nil, nil, {})
+ assert_dom_equal "go back ", link_to('go back', :back)
+ end
+
+ def test_link_tag_with_back
+ @controller.request = RequestMock.new("http://www.example.com/weblog/show", nil, nil, {'HTTP_REFERER' => 'http://www.example.com/referer'})
+ assert_dom_equal "go back ", link_to('go back', :back)
+ end
+
+ def test_link_tag_with_back_and_no_referer
+ @controller.request = RequestMock.new("http://www.example.com/weblog/show", nil, nil, {})
+ assert_dom_equal "go back ", link_to('go back', :back)
+ end
+
+ def test_link_tag_with_img
+ assert_dom_equal " ", link_to(" ", "http://www.example.com")
+ end
+
+ def test_link_with_nil_html_options
+ assert_dom_equal "Hello ", link_to("Hello", {:action => 'myaction'}, nil)
+ end
+
+ def test_link_tag_with_custom_onclick
+ assert_dom_equal "Hello ", link_to("Hello", "http://www.example.com", :onclick => "alert('yay!')")
+ end
+
+ def test_link_tag_with_javascript_confirm
+ assert_dom_equal(
+ "Hello ",
+ link_to("Hello", "http://www.example.com", :confirm => "Are you sure?")
+ )
+ assert_dom_equal(
+ "Hello ",
+ link_to("Hello", "http://www.example.com", :confirm => "You can't possibly be sure, can you?")
+ )
+ assert_dom_equal(
+ "Hello ",
+ link_to("Hello", "http://www.example.com", :confirm => "You can't possibly be sure,\n can you?")
+ )
+ end
+
+ def test_link_tag_with_popup
+ assert_dom_equal(
+ "Hello ",
+ link_to("Hello", "http://www.example.com", :popup => true)
+ )
+ assert_dom_equal(
+ "Hello ",
+ link_to("Hello", "http://www.example.com", :popup => 'true')
+ )
+ assert_dom_equal(
+ "Hello ",
+ link_to("Hello", "http://www.example.com", :popup => ['window_name', 'width=300,height=300'])
+ )
+ end
+
+ def test_link_tag_with_popup_and_javascript_confirm
+ assert_dom_equal(
+ "Hello ",
+ link_to("Hello", "http://www.example.com", { :popup => true, :confirm => "Fo' sho'?" })
+ )
+ assert_dom_equal(
+ "Hello ",
+ link_to("Hello", "http://www.example.com", { :popup => ['window_name', 'width=300,height=300'], :confirm => "Are you serious?" })
+ )
+ end
+
+ def test_link_tag_using_post_javascript
+ assert_dom_equal(
+ "Hello ",
+ link_to("Hello", "http://www.example.com", :method => :post)
+ )
+ end
+
+ def test_link_tag_using_delete_javascript
+ assert_dom_equal(
+ "Destroy ",
+ link_to("Destroy", "http://www.example.com", :method => :delete)
+ )
+ end
+
+ def test_link_tag_using_delete_javascript_and_href
+ assert_dom_equal(
+ "Destroy ",
+ link_to("Destroy", "http://www.example.com", :method => :delete, :href => '#')
+ )
+ end
+
+ def test_link_tag_using_post_javascript_and_confirm
+ assert_dom_equal(
+ "Hello ",
+ link_to("Hello", "http://www.example.com", :method => :post, :confirm => "Are you serious?")
+ )
+ end
+
+ def test_link_tag_using_post_javascript_and_popup
+ assert_raises(ActionView::ActionViewError) { link_to("Hello", "http://www.example.com", :popup => true, :method => :post, :confirm => "Are you serious?") }
+ end
+
+ def test_link_to_unless
+ assert_equal "Showing", link_to_unless(true, "Showing", :action => "show", :controller => "weblog")
+ assert_dom_equal "Listing ", link_to_unless(false, "Listing", :action => "list", :controller => "weblog")
+ assert_equal "Showing", link_to_unless(true, "Showing", :action => "show", :controller => "weblog", :id => 1)
+ assert_equal "Showing ", link_to_unless(true, "Showing", :action => "show", :controller => "weblog", :id => 1) { |name, options, html_options|
+ "#{name} "
+ }
+ assert_equal "Showing ", link_to_unless(true, "Showing", :action => "show", :controller => "weblog", :id => 1) { |name|
+ "#{name} "
+ }
+ assert_equal "test", link_to_unless(true, "Showing", :action => "show", :controller => "weblog", :id => 1) {
+ "test"
+ }
+ end
+
+ def test_link_to_if
+ assert_equal "Showing", link_to_if(false, "Showing", :action => "show", :controller => "weblog")
+ assert_dom_equal "Listing ", link_to_if(true, "Listing", :action => "list", :controller => "weblog")
+ assert_equal "Showing", link_to_if(false, "Showing", :action => "show", :controller => "weblog", :id => 1)
+ end
+
+ def test_link_unless_current
+ @controller.request = RequestMock.new("http://www.example.com/weblog/show")
+ @controller.url = "http://www.example.com/weblog/show"
+ assert_equal "Showing", link_to_unless_current("Showing", { :action => "show", :controller => "weblog" })
+ assert_equal "Showing", link_to_unless_current("Showing", "http://www.example.com/weblog/show")
+
+ @controller.request = RequestMock.new("http://www.example.com/weblog/show")
+ @controller.url = "http://www.example.com/weblog/list"
+ assert_equal "Listing ",
+ link_to_unless_current("Listing", :action => "list", :controller => "weblog")
+ assert_equal "Listing ",
+ link_to_unless_current("Listing", "http://www.example.com/weblog/list")
+ end
+
+ def test_mail_to
+ assert_dom_equal "david@loudthinking.com ", mail_to("david@loudthinking.com")
+ assert_dom_equal "David Heinemeier Hansson ", mail_to("david@loudthinking.com", "David Heinemeier Hansson")
+ assert_dom_equal(
+ "David Heinemeier Hansson ",
+ mail_to("david@loudthinking.com", "David Heinemeier Hansson", "class" => "admin")
+ )
+ assert_equal mail_to("david@loudthinking.com", "David Heinemeier Hansson", "class" => "admin"),
+ mail_to("david@loudthinking.com", "David Heinemeier Hansson", :class => "admin")
+ end
+
+ def test_mail_to_with_javascript
+ assert_dom_equal "", mail_to("me@domain.com", "My email", :encode => "javascript")
+ end
+
+ def test_mail_with_options
+ assert_dom_equal(
+ %(My email ),
+ mail_to("me@example.com", "My email", :cc => "ccaddress@example.com", :bcc => "bccaddress@example.com", :subject => "This is an example email", :body => "This is the body of the message.")
+ )
+ end
+
+ def test_mail_to_with_img
+ assert_dom_equal %( ), mail_to('feedback@example.com', ' ')
+ end
+
+ def test_mail_to_with_hex
+ assert_dom_equal "My email ", mail_to("me@domain.com", "My email", :encode => "hex")
+ assert_dom_equal "me@domain.com ", mail_to("me@domain.com", nil, :encode => "hex")
+ end
+
+ def test_mail_to_with_replace_options
+ assert_dom_equal "wolfgang(at)stufenlos(dot)net ", mail_to("wolfgang@stufenlos.net", nil, :replace_at => "(at)", :replace_dot => "(dot)")
+ assert_dom_equal "me(at)domain.com ", mail_to("me@domain.com", nil, :encode => "hex", :replace_at => "(at)")
+ assert_dom_equal "My email ", mail_to("me@domain.com", "My email", :encode => "hex", :replace_at => "(at)")
+ assert_dom_equal "me(at)domain(dot)com ", mail_to("me@domain.com", nil, :encode => "hex", :replace_at => "(at)", :replace_dot => "(dot)")
+ assert_dom_equal "", mail_to("me@domain.com", "My email", :encode => "javascript", :replace_at => "(at)", :replace_dot => "(dot)")
+ end
+
+ def protect_against_forgery?
+ false
+ end
+end
+
+class UrlHelperWithControllerTest < Test::Unit::TestCase
+ class UrlHelperController < ActionController::Base
+ self.view_paths = [ "#{File.dirname(__FILE__)}/../fixtures/" ]
+
+ def self.controller_path; 'url_helper_with_controller' end
+
+ def show_url_for
+ render :inline => "<%= url_for :controller => 'url_helper_with_controller', :action => 'show_url_for' %>"
+ end
+
+ def show_named_route
+ render :inline => "<%= show_named_route_#{params[:kind]} %>"
+ end
+
+ def rescue_action(e) raise e end
+ end
+
+ include ActionView::Helpers::UrlHelper
+
+ def setup
+ @request = ActionController::TestRequest.new
+ @response = ActionController::TestResponse.new
+ @controller = UrlHelperController.new
+ end
+
+ def test_url_for_shows_only_path
+ get :show_url_for
+ assert_equal '/url_helper_with_controller/show_url_for', @response.body
+ end
+
+ def test_named_route_shows_host_and_path
+ with_url_helper_routing do
+ get :show_named_route, :kind => 'url'
+ assert_equal 'http://test.host/url_helper_with_controller/show_named_route', @response.body
+ end
+ end
+
+ def test_named_route_path_shows_only_path
+ with_url_helper_routing do
+ get :show_named_route, :kind => 'path'
+ assert_equal '/url_helper_with_controller/show_named_route', @response.body
+ end
+ end
+
+ protected
+ def with_url_helper_routing
+ with_routing do |set|
+ set.draw do |map|
+ map.show_named_route 'url_helper_with_controller/show_named_route', :controller => 'url_helper_with_controller', :action => 'show_named_route'
+ end
+ yield
+ end
+ end
+end
+
+class LinkToUnlessCurrentWithControllerTest < Test::Unit::TestCase
+ class TasksController < ActionController::Base
+ self.view_paths = ["#{File.dirname(__FILE__)}/../fixtures/"]
+
+ def self.controller_path; 'tasks' end
+
+ def index
+ render_default
+ end
+
+ def show
+ render_default
+ end
+
+ def rescue_action(e) raise e end
+
+ protected
+ def render_default
+ render :inline =>
+ "<%= link_to_unless_current(\"tasks\", tasks_path) %>\n" +
+ "<%= link_to_unless_current(\"tasks\", tasks_url) %>"
+ end
+ end
+
+ include ActionView::Helpers::UrlHelper
+
+ def setup
+ @request = ActionController::TestRequest.new
+ @response = ActionController::TestResponse.new
+ @controller = TasksController.new
+ end
+
+ def test_link_to_unless_current_to_current
+ with_restful_routing do
+ get :index
+ assert_equal "tasks\ntasks", @response.body
+ end
+ end
+
+ def test_link_to_unless_current_shows_link
+ with_restful_routing do
+ get :show, :id => 1
+ assert_equal "tasks \n" +
+ "tasks ",
+ @response.body
+ end
+ end
+
+ protected
+ def with_restful_routing
+ with_routing do |set|
+ set.draw do |map|
+ map.resources :tasks
+ end
+ yield
+ end
+ end
+end
+
+
+class Workshop
+ attr_accessor :id, :new_record
+
+ def initialize(id, new_record)
+ @id, @new_record = id, new_record
+ end
+
+ def new_record?
+ @new_record
+ end
+
+ def to_s
+ id.to_s
+ end
+end
+
+class Session
+ attr_accessor :id, :workshop_id, :new_record
+
+ def initialize(id, new_record)
+ @id, @new_record = id, new_record
+ end
+
+ def new_record?
+ @new_record
+ end
+
+ def to_s
+ id.to_s
+ end
+end
+
+class PolymorphicControllerTest < Test::Unit::TestCase
+ class WorkshopsController < ActionController::Base
+ self.view_paths = ["#{File.dirname(__FILE__)}/../fixtures/"]
+
+ def self.controller_path; 'workshops' end
+
+ def index
+ @workshop = Workshop.new(1, true)
+ render :inline => "<%= url_for(@workshop) %>\n<%= link_to('Workshop', @workshop) %>"
+ end
+
+ def show
+ @workshop = Workshop.new(params[:id], false)
+ render :inline => "<%= url_for(@workshop) %>\n<%= link_to('Workshop', @workshop) %>"
+ end
+
+ def rescue_action(e) raise e end
+ end
+
+ class SessionsController < ActionController::Base
+ self.view_paths = ["#{File.dirname(__FILE__)}/../fixtures/"]
+
+ def self.controller_path; 'sessions' end
+
+ def index
+ @workshop = Workshop.new(params[:workshop_id], false)
+ @session = Session.new(1, true)
+ render :inline => "<%= url_for([@workshop, @session]) %>\n<%= link_to('Session', [@workshop, @session]) %>"
+ end
+
+ def show
+ @workshop = Workshop.new(params[:workshop_id], false)
+ @session = Session.new(params[:id], false)
+ render :inline => "<%= url_for([@workshop, @session]) %>\n<%= link_to('Session', [@workshop, @session]) %>"
+ end
+
+ def rescue_action(e) raise e end
+ end
+
+ include ActionView::Helpers::UrlHelper
+
+ def setup
+ @request = ActionController::TestRequest.new
+ @response = ActionController::TestResponse.new
+ end
+
+ def test_new_resource
+ @controller = WorkshopsController.new
+
+ with_restful_routing do
+ get :index
+ assert_equal "/workshops\nWorkshop ", @response.body
+ end
+ end
+
+ def test_existing_resource
+ @controller = WorkshopsController.new
+
+ with_restful_routing do
+ get :show, :id => 1
+ assert_equal "/workshops/1\nWorkshop ", @response.body
+ end
+ end
+
+ def test_new_nested_resource
+ @controller = SessionsController.new
+
+ with_restful_routing do
+ get :index, :workshop_id => 1
+ assert_equal "/workshops/1/sessions\nSession ", @response.body
+ end
+ end
+
+ def test_existing_nested_resource
+ @controller = SessionsController.new
+
+ with_restful_routing do
+ get :show, :workshop_id => 1, :id => 1
+ assert_equal "/workshops/1/sessions/1\nSession ", @response.body
+ end
+ end
+
+ protected
+ def with_restful_routing
+ with_routing do |set|
+ set.draw do |map|
+ map.resources :workshops do |w|
+ w.resources :sessions
+ end
+ end
+ yield
+ end
+ end
+end
diff --git a/vendor/rails-2.0.2/actionpack/test/testing_sandbox.rb b/vendor/rails-2.0.2/actionpack/test/testing_sandbox.rb
new file mode 100644
index 000000000..b3b8b0f4d
--- /dev/null
+++ b/vendor/rails-2.0.2/actionpack/test/testing_sandbox.rb
@@ -0,0 +1,11 @@
+module TestingSandbox
+ # Temporarily replaces KCODE for the block
+ def with_kcode(kcode)
+ old_kcode, $KCODE = $KCODE, kcode
+ begin
+ yield
+ ensure
+ $KCODE = old_kcode
+ end
+ end
+end
--
cgit v1.2.3