actionpack 1.13.6 → 2.0.0
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of actionpack might be problematic. Click here for more details.
- data/CHANGELOG +1400 -20
- data/MIT-LICENSE +1 -1
- data/README +5 -5
- data/RUNNING_UNIT_TESTS +4 -5
- data/Rakefile +5 -6
- data/install.rb +2 -2
- data/lib/action_controller.rb +11 -15
- data/lib/action_controller/assertions.rb +12 -25
- data/lib/action_controller/assertions/dom_assertions.rb +18 -4
- data/lib/action_controller/assertions/model_assertions.rb +8 -1
- data/lib/action_controller/assertions/response_assertions.rb +35 -12
- data/lib/action_controller/assertions/routing_assertions.rb +56 -12
- data/lib/action_controller/assertions/selector_assertions.rb +105 -38
- data/lib/action_controller/assertions/tag_assertions.rb +28 -15
- data/lib/action_controller/base.rb +318 -250
- data/lib/action_controller/benchmarking.rb +33 -29
- data/lib/action_controller/caching.rb +130 -64
- data/lib/action_controller/cgi_ext.rb +16 -0
- data/lib/action_controller/cgi_ext/{cookie_performance_fix.rb → cookie.rb} +25 -40
- data/lib/action_controller/cgi_ext/query_extension.rb +22 -0
- data/lib/action_controller/cgi_ext/session.rb +73 -0
- data/lib/action_controller/cgi_ext/stdinput.rb +23 -0
- data/lib/action_controller/cgi_process.rb +34 -57
- data/lib/action_controller/components.rb +19 -36
- data/lib/action_controller/cookies.rb +10 -9
- data/lib/action_controller/dispatcher.rb +195 -0
- data/lib/action_controller/filters.rb +35 -34
- data/lib/action_controller/flash.rb +30 -35
- data/lib/action_controller/helpers.rb +121 -47
- data/lib/action_controller/http_authentication.rb +126 -0
- data/lib/action_controller/integration.rb +105 -101
- data/lib/action_controller/layout.rb +59 -47
- data/lib/action_controller/mime_responds.rb +57 -68
- data/lib/action_controller/mime_type.rb +43 -80
- data/lib/action_controller/mime_types.rb +20 -0
- data/lib/action_controller/polymorphic_routes.rb +88 -0
- data/lib/action_controller/record_identifier.rb +91 -0
- data/lib/action_controller/request.rb +553 -88
- data/lib/action_controller/request_forgery_protection.rb +126 -0
- data/lib/action_controller/request_profiler.rb +138 -0
- data/lib/action_controller/rescue.rb +185 -69
- data/lib/action_controller/resources.rb +211 -172
- data/lib/action_controller/response.rb +49 -8
- data/lib/action_controller/routing.rb +359 -236
- data/lib/action_controller/routing_optimisation.rb +119 -0
- data/lib/action_controller/session/active_record_store.rb +3 -2
- data/lib/action_controller/session/cookie_store.rb +161 -0
- data/lib/action_controller/session/mem_cache_store.rb +9 -16
- data/lib/action_controller/session_management.rb +17 -8
- data/lib/action_controller/streaming.rb +6 -3
- data/lib/action_controller/templates/rescues/_request_and_response.erb +24 -0
- data/lib/action_controller/templates/rescues/{_trace.rhtml → _trace.erb} +0 -0
- data/lib/action_controller/templates/rescues/{diagnostics.rhtml → diagnostics.erb} +2 -2
- data/lib/action_controller/templates/rescues/{layout.rhtml → layout.erb} +0 -0
- data/lib/action_controller/templates/rescues/{missing_template.rhtml → missing_template.erb} +0 -0
- data/lib/action_controller/templates/rescues/{routing_error.rhtml → routing_error.erb} +0 -0
- data/lib/action_controller/templates/rescues/{template_error.rhtml → template_error.erb} +2 -2
- data/lib/action_controller/templates/rescues/{unknown_action.rhtml → unknown_action.erb} +0 -0
- data/lib/action_controller/test_case.rb +53 -0
- data/lib/action_controller/test_process.rb +59 -46
- data/lib/action_controller/url_rewriter.rb +48 -24
- data/lib/action_controller/vendor/html-scanner/html/document.rb +7 -4
- data/lib/action_controller/vendor/html-scanner/html/sanitizer.rb +173 -0
- data/lib/action_controller/vendor/html-scanner/html/selector.rb +11 -6
- data/lib/action_controller/verification.rb +27 -21
- data/lib/action_pack.rb +1 -1
- data/lib/action_pack/version.rb +4 -4
- data/lib/action_view.rb +2 -3
- data/lib/action_view/base.rb +218 -63
- data/lib/action_view/compiled_templates.rb +1 -2
- data/lib/action_view/helpers/active_record_helper.rb +35 -17
- data/lib/action_view/helpers/asset_tag_helper.rb +395 -87
- data/lib/action_view/helpers/atom_feed_helper.rb +111 -0
- data/lib/action_view/helpers/benchmark_helper.rb +12 -5
- data/lib/action_view/helpers/cache_helper.rb +29 -0
- data/lib/action_view/helpers/capture_helper.rb +97 -63
- data/lib/action_view/helpers/date_helper.rb +295 -35
- data/lib/action_view/helpers/debug_helper.rb +6 -2
- data/lib/action_view/helpers/form_helper.rb +354 -111
- data/lib/action_view/helpers/form_options_helper.rb +171 -109
- data/lib/action_view/helpers/form_tag_helper.rb +332 -76
- data/lib/action_view/helpers/javascript_helper.rb +35 -11
- data/lib/action_view/helpers/javascripts/controls.js +484 -354
- data/lib/action_view/helpers/javascripts/dragdrop.js +88 -58
- data/lib/action_view/helpers/javascripts/effects.js +396 -364
- data/lib/action_view/helpers/javascripts/prototype.js +2817 -1107
- data/lib/action_view/helpers/number_helper.rb +84 -60
- data/lib/action_view/helpers/prototype_helper.rb +419 -43
- data/lib/action_view/helpers/record_identification_helper.rb +20 -0
- data/lib/action_view/helpers/record_tag_helper.rb +59 -0
- data/lib/action_view/helpers/sanitize_helper.rb +223 -0
- data/lib/action_view/helpers/scriptaculous_helper.rb +63 -4
- data/lib/action_view/helpers/tag_helper.rb +69 -39
- data/lib/action_view/helpers/text_helper.rb +221 -148
- data/lib/action_view/helpers/url_helper.rb +283 -165
- data/lib/action_view/partials.rb +134 -62
- data/lib/action_view/template_error.rb +4 -12
- data/lib/actionpack.rb +1 -0
- data/test/abstract_unit.rb +21 -1
- data/test/action_view_test.rb +26 -0
- data/test/active_record_unit.rb +12 -20
- data/test/activerecord/active_record_store_test.rb +2 -2
- data/test/activerecord/render_partial_with_record_identification_test.rb +74 -0
- data/test/controller/action_pack_assertions_test.rb +21 -152
- data/test/controller/addresses_render_test.rb +2 -7
- data/test/controller/assert_select_test.rb +120 -14
- data/test/controller/base_test.rb +11 -13
- data/test/controller/caching_test.rb +125 -5
- data/test/controller/capture_test.rb +23 -16
- data/test/controller/cgi_test.rb +66 -391
- data/test/controller/components_test.rb +31 -42
- data/test/controller/content_type_test.rb +1 -1
- data/test/controller/cookie_test.rb +42 -14
- data/test/controller/deprecation/deprecated_base_methods_test.rb +1 -42
- data/test/controller/dispatcher_test.rb +123 -0
- data/test/controller/fake_models.rb +5 -0
- data/test/controller/filters_test.rb +44 -7
- data/test/controller/flash_test.rb +46 -2
- data/test/controller/fragment_store_setting_test.rb +10 -8
- data/test/controller/helper_test.rb +19 -2
- data/test/controller/html-scanner/document_test.rb +124 -0
- data/test/controller/html-scanner/node_test.rb +69 -0
- data/test/controller/html-scanner/sanitizer_test.rb +250 -0
- data/test/controller/html-scanner/tag_node_test.rb +239 -0
- data/test/controller/html-scanner/text_node_test.rb +51 -0
- data/test/controller/html-scanner/tokenizer_test.rb +125 -0
- data/test/controller/http_authentication_test.rb +54 -0
- data/test/controller/integration_test.rb +12 -26
- data/test/controller/layout_test.rb +64 -12
- data/test/controller/mime_responds_test.rb +193 -38
- data/test/controller/mime_type_test.rb +30 -8
- data/test/controller/new_render_test.rb +104 -22
- data/test/controller/polymorphic_routes_test.rb +98 -0
- data/test/controller/record_identifier_test.rb +103 -0
- data/test/controller/redirect_test.rb +120 -18
- data/test/controller/render_test.rb +195 -45
- data/test/controller/request_forgery_protection_test.rb +217 -0
- data/test/controller/request_test.rb +545 -27
- data/test/controller/rescue_test.rb +501 -0
- data/test/controller/resources_test.rb +258 -132
- data/test/controller/routing_test.rb +502 -106
- data/test/controller/selector_test.rb +5 -5
- data/test/controller/send_file_test.rb +17 -7
- data/test/controller/session/cookie_store_test.rb +246 -0
- data/test/controller/session/mem_cache_store_test.rb +182 -0
- data/test/controller/session_fixation_test.rb +8 -11
- data/test/controller/session_management_test.rb +7 -7
- data/test/controller/test_test.rb +150 -38
- data/test/controller/url_rewriter_test.rb +87 -12
- data/test/controller/verification_test.rb +11 -0
- data/test/controller/view_paths_test.rb +137 -0
- data/test/controller/webservice_test.rb +11 -75
- data/test/fixtures/addresses/{list.rhtml → list.erb} +0 -0
- data/test/fixtures/db_definitions/sqlite.sql +2 -1
- data/test/fixtures/developer.rb +2 -0
- data/test/fixtures/fun/games/{hello_world.rhtml → hello_world.erb} +0 -0
- data/test/fixtures/helpers/fun/pdf_helper.rb +1 -1
- data/test/fixtures/layout_tests/alt/hello.rhtml +1 -0
- data/test/fixtures/layout_tests/layouts/multiple_extensions.html.erb +1 -0
- data/test/fixtures/layouts/{builder.rxml → builder.builder} +0 -0
- data/test/fixtures/layouts/{standard.rhtml → standard.erb} +0 -0
- data/test/fixtures/layouts/{talk_from_action.rhtml → talk_from_action.erb} +0 -0
- data/test/fixtures/layouts/{yield.rhtml → yield.erb} +0 -0
- data/test/fixtures/multipart/binary_file +0 -0
- data/test/fixtures/multipart/bracketed_param +5 -0
- data/test/fixtures/override/test/hello_world.erb +1 -0
- data/test/fixtures/override2/layouts/test/sub.erb +1 -0
- data/test/fixtures/post_test/layouts/post.html.erb +1 -0
- data/test/fixtures/post_test/layouts/super_post.iphone.erb +1 -0
- data/test/fixtures/post_test/post/index.html.erb +1 -0
- data/test/fixtures/post_test/post/index.iphone.erb +1 -0
- data/test/fixtures/post_test/super_post/index.html.erb +1 -0
- data/test/fixtures/post_test/super_post/index.iphone.erb +1 -0
- data/test/fixtures/public/404.html +1 -0
- data/test/fixtures/public/500.html +1 -0
- data/test/fixtures/public/javascripts/application.js +0 -1
- data/test/fixtures/public/javascripts/bank.js +1 -0
- data/test/fixtures/public/javascripts/robber.js +1 -0
- data/test/fixtures/public/stylesheets/bank.css +1 -0
- data/test/fixtures/public/stylesheets/robber.css +1 -0
- data/test/fixtures/replies.yml +2 -0
- data/test/fixtures/reply.rb +2 -1
- data/test/fixtures/respond_to/{all_types_with_layout.rhtml → all_types_with_layout.html.erb} +0 -0
- data/test/fixtures/respond_to/{all_types_with_layout.rjs → all_types_with_layout.js.rjs} +0 -0
- data/test/fixtures/respond_to/custom_constant_handling_without_block.mobile.erb +1 -0
- data/test/fixtures/respond_to/iphone_with_html_response_type.html.erb +1 -0
- data/test/fixtures/respond_to/iphone_with_html_response_type.iphone.erb +1 -0
- data/test/fixtures/respond_to/layouts/missing.html.erb +1 -0
- data/test/fixtures/respond_to/layouts/standard.html.erb +1 -0
- data/test/fixtures/respond_to/layouts/standard.iphone.erb +1 -0
- data/test/fixtures/respond_to/{using_defaults.rhtml → using_defaults.html.erb} +0 -0
- data/test/fixtures/respond_to/{using_defaults.rjs → using_defaults.js.rjs} +0 -0
- data/test/fixtures/respond_to/{using_defaults.rxml → using_defaults.xml.builder} +0 -0
- data/test/fixtures/respond_to/{using_defaults_with_type_list.rhtml → using_defaults_with_type_list.html.erb} +0 -0
- data/test/fixtures/respond_to/{using_defaults_with_type_list.rjs → using_defaults_with_type_list.js.rjs} +0 -0
- data/test/fixtures/respond_to/{using_defaults_with_type_list.rxml → using_defaults_with_type_list.xml.builder} +0 -0
- data/test/fixtures/scope/test/{modgreet.rhtml → modgreet.erb} +0 -0
- data/test/fixtures/test/{_customer.rhtml → _customer.erb} +0 -0
- data/test/fixtures/test/{_customer_greeting.rhtml → _customer_greeting.erb} +0 -0
- data/test/fixtures/test/_hash_greeting.erb +1 -0
- data/test/fixtures/test/_hash_object.erb +2 -0
- data/test/fixtures/test/{_hello.rxml → _hello.builder} +0 -0
- data/test/fixtures/test/_layout_for_partial.html.erb +3 -0
- data/test/fixtures/test/_partial.erb +1 -0
- data/test/fixtures/test/_partial.html.erb +1 -0
- data/test/fixtures/test/_partial.js.erb +1 -0
- data/test/fixtures/test/_partial_for_use_in_layout.html.erb +1 -0
- data/test/fixtures/test/{_partial_only.rhtml → _partial_only.erb} +0 -0
- data/test/fixtures/test/{_person.rhtml → _person.erb} +0 -0
- data/test/fixtures/test/{action_talk_to_layout.rhtml → action_talk_to_layout.erb} +0 -0
- data/test/fixtures/test/{block_content_for.rhtml → block_content_for.erb} +0 -0
- data/test/fixtures/test/calling_partial_with_layout.html.erb +1 -0
- data/test/fixtures/test/{capturing.rhtml → capturing.erb} +0 -0
- data/test/fixtures/test/{content_for.rhtml → content_for.erb} +0 -0
- data/test/fixtures/test/content_for_concatenated.erb +3 -0
- data/test/fixtures/test/content_for_with_parameter.erb +2 -0
- data/test/fixtures/test/dot.directory/{render_file_with_ivar.rhtml → render_file_with_ivar.erb} +0 -0
- data/test/fixtures/test/{erb_content_for.rhtml → erb_content_for.erb} +0 -0
- data/test/fixtures/test/formatted_html_erb.html.erb +1 -0
- data/test/fixtures/test/formatted_xml_erb.builder +1 -0
- data/test/fixtures/test/formatted_xml_erb.html.erb +1 -0
- data/test/fixtures/test/formatted_xml_erb.xml.erb +1 -0
- data/test/fixtures/test/{greeting.rhtml → greeting.erb} +0 -0
- data/test/fixtures/test/{hello.rxml → hello.builder} +0 -0
- data/test/fixtures/test/{hello_world.rxml → hello_world.builder} +0 -0
- data/test/fixtures/test/{hello_world.rhtml → hello_world.erb} +0 -0
- data/test/fixtures/test/{hello_world_container.rxml → hello_world_container.builder} +0 -0
- data/test/fixtures/test/{hello_world_with_layout_false.rhtml → hello_world_with_layout_false.erb} +0 -0
- data/test/fixtures/test/{hello_xml_world.rxml → hello_xml_world.builder} +0 -0
- data/test/fixtures/test/list.erb +1 -0
- data/test/fixtures/test/{non_erb_block_content_for.rxml → non_erb_block_content_for.builder} +0 -0
- data/test/fixtures/test/{potential_conflicts.rhtml → potential_conflicts.erb} +0 -0
- data/test/fixtures/test/{render_file_with_ivar.rhtml → render_file_with_ivar.erb} +0 -0
- data/test/fixtures/test/{render_file_with_locals.rhtml → render_file_with_locals.erb} +0 -0
- data/test/fixtures/test/{render_to_string_test.rhtml → render_to_string_test.erb} +0 -0
- data/test/fixtures/test/{update_element_with_capture.rhtml → update_element_with_capture.erb} +0 -0
- data/test/fixtures/test/using_layout_around_block.html.erb +1 -0
- data/test/fixtures/topic.rb +1 -1
- data/test/template/active_record_helper_test.rb +67 -20
- data/test/template/asset_tag_helper_test.rb +222 -54
- data/test/template/atom_feed_helper_test.rb +101 -0
- data/test/template/benchmark_helper_test.rb +2 -2
- data/test/template/compiled_templates_test.rb +76 -32
- data/test/template/date_helper_test.rb +125 -9
- data/test/template/form_helper_test.rb +326 -33
- data/test/template/form_options_helper_test.rb +822 -15
- data/test/template/form_tag_helper_test.rb +96 -30
- data/test/template/javascript_helper_test.rb +61 -13
- data/test/template/number_helper_test.rb +12 -11
- data/test/template/prototype_helper_test.rb +185 -24
- data/test/template/sanitize_helper_test.rb +49 -0
- data/test/template/scriptaculous_helper_test.rb +9 -3
- data/test/template/tag_helper_test.rb +13 -2
- data/test/template/text_helper_test.rb +38 -52
- data/test/template/url_helper_test.rb +216 -46
- metadata +144 -116
- data/examples/.htaccess +0 -24
- data/examples/address_book/index.rhtml +0 -33
- data/examples/address_book/layout.rhtml +0 -8
- data/examples/address_book_controller.cgi +0 -9
- data/examples/address_book_controller.fcgi +0 -6
- data/examples/address_book_controller.rb +0 -52
- data/examples/address_book_controller.rbx +0 -4
- data/examples/benchmark.rb +0 -52
- data/examples/benchmark_with_ar.fcgi +0 -89
- data/examples/blog_controller.cgi +0 -53
- data/examples/debate/index.rhtml +0 -14
- data/examples/debate/new_topic.rhtml +0 -22
- data/examples/debate/topic.rhtml +0 -32
- data/examples/debate_controller.cgi +0 -57
- data/lib/action_controller/assertions/deprecated_assertions.rb +0 -228
- data/lib/action_controller/cgi_ext/cgi_ext.rb +0 -36
- data/lib/action_controller/cgi_ext/cgi_methods.rb +0 -211
- data/lib/action_controller/cgi_ext/pstore_performance_fix.rb +0 -30
- data/lib/action_controller/cgi_ext/raw_post_data_fix.rb +0 -95
- data/lib/action_controller/cgi_ext/session_performance_fix.rb +0 -30
- data/lib/action_controller/deprecated_dependencies.rb +0 -65
- data/lib/action_controller/deprecated_redirects.rb +0 -17
- data/lib/action_controller/deprecated_request_methods.rb +0 -34
- data/lib/action_controller/macros/auto_complete.rb +0 -53
- data/lib/action_controller/macros/in_place_editing.rb +0 -33
- data/lib/action_controller/pagination.rb +0 -408
- data/lib/action_controller/scaffolding.rb +0 -189
- data/lib/action_controller/templates/rescues/_request_and_response.rhtml +0 -44
- data/lib/action_controller/templates/scaffolds/edit.rhtml +0 -7
- data/lib/action_controller/templates/scaffolds/layout.rhtml +0 -69
- data/lib/action_controller/templates/scaffolds/list.rhtml +0 -27
- data/lib/action_controller/templates/scaffolds/new.rhtml +0 -6
- data/lib/action_controller/templates/scaffolds/show.rhtml +0 -9
- data/lib/action_controller/vendor/xml_node.rb +0 -97
- data/lib/action_view/helpers/deprecated_helper.rb +0 -37
- data/lib/action_view/helpers/java_script_macros_helper.rb +0 -233
- data/lib/action_view/helpers/pagination_helper.rb +0 -86
- data/test/activerecord/active_record_assertions_test.rb +0 -92
- data/test/activerecord/pagination_test.rb +0 -165
- data/test/controller/deprecated_instance_variables_test.rb +0 -48
- data/test/controller/raw_post_test.rb +0 -68
- data/test/fixtures/deprecated_instance_variables/_cookies_ivar.rhtml +0 -1
- data/test/fixtures/deprecated_instance_variables/_cookies_method.rhtml +0 -1
- data/test/fixtures/deprecated_instance_variables/_flash_ivar.rhtml +0 -1
- data/test/fixtures/deprecated_instance_variables/_flash_method.rhtml +0 -1
- data/test/fixtures/deprecated_instance_variables/_headers_ivar.rhtml +0 -1
- data/test/fixtures/deprecated_instance_variables/_headers_method.rhtml +0 -1
- data/test/fixtures/deprecated_instance_variables/_params_ivar.rhtml +0 -1
- data/test/fixtures/deprecated_instance_variables/_params_method.rhtml +0 -1
- data/test/fixtures/deprecated_instance_variables/_request_ivar.rhtml +0 -1
- data/test/fixtures/deprecated_instance_variables/_request_method.rhtml +0 -1
- data/test/fixtures/deprecated_instance_variables/_response_ivar.rhtml +0 -1
- data/test/fixtures/deprecated_instance_variables/_response_method.rhtml +0 -1
- data/test/fixtures/deprecated_instance_variables/_session_ivar.rhtml +0 -1
- data/test/fixtures/deprecated_instance_variables/_session_method.rhtml +0 -1
- data/test/fixtures/respond_to/layouts/standard.rhtml +0 -1
- data/test/fixtures/test/_hash_object.rhtml +0 -1
- data/test/fixtures/test/list.rhtml +0 -1
- data/test/template/deprecated_helper_test.rb +0 -36
- data/test/template/deprecated_instance_variables_test.rb +0 -43
- data/test/template/java_script_macros_helper_test.rb +0 -109
@@ -1,165 +0,0 @@
|
|
1
|
-
require File.dirname(__FILE__) + '/../active_record_unit'
|
2
|
-
|
3
|
-
class PaginationTest < ActiveRecordTestCase
|
4
|
-
fixtures :topics, :replies, :developers, :projects, :developers_projects
|
5
|
-
|
6
|
-
class PaginationController < ActionController::Base
|
7
|
-
self.template_root = "#{File.dirname(__FILE__)}/../fixtures/"
|
8
|
-
|
9
|
-
around_filter :silence_deprecation_warnings
|
10
|
-
|
11
|
-
def simple_paginate
|
12
|
-
@topic_pages, @topics = paginate(:topics)
|
13
|
-
render :nothing => true
|
14
|
-
end
|
15
|
-
|
16
|
-
def paginate_with_per_page
|
17
|
-
@topic_pages, @topics = paginate(:topics, :per_page => 1)
|
18
|
-
render :nothing => true
|
19
|
-
end
|
20
|
-
|
21
|
-
def paginate_with_order
|
22
|
-
@topic_pages, @topics = paginate(:topics, :order => 'created_at asc')
|
23
|
-
render :nothing => true
|
24
|
-
end
|
25
|
-
|
26
|
-
def paginate_with_order_by
|
27
|
-
@topic_pages, @topics = paginate(:topics, :order_by => 'created_at asc')
|
28
|
-
render :nothing => true
|
29
|
-
end
|
30
|
-
|
31
|
-
def paginate_with_include_and_order
|
32
|
-
@topic_pages, @topics = paginate(:topics, :include => :replies, :order => 'replies.created_at asc, topics.created_at asc')
|
33
|
-
render :nothing => true
|
34
|
-
end
|
35
|
-
|
36
|
-
def paginate_with_conditions
|
37
|
-
@topic_pages, @topics = paginate(:topics, :conditions => ["created_at > ?", 30.minutes.ago])
|
38
|
-
render :nothing => true
|
39
|
-
end
|
40
|
-
|
41
|
-
def paginate_with_class_name
|
42
|
-
@developer_pages, @developers = paginate(:developers, :class_name => "DeVeLoPeR")
|
43
|
-
render :nothing => true
|
44
|
-
end
|
45
|
-
|
46
|
-
def paginate_with_singular_name
|
47
|
-
@developer_pages, @developers = paginate()
|
48
|
-
render :nothing => true
|
49
|
-
end
|
50
|
-
|
51
|
-
def paginate_with_joins
|
52
|
-
@developer_pages, @developers = paginate(:developers,
|
53
|
-
:joins => 'LEFT JOIN developers_projects ON developers.id = developers_projects.developer_id',
|
54
|
-
:conditions => 'project_id=1')
|
55
|
-
render :nothing => true
|
56
|
-
end
|
57
|
-
|
58
|
-
def paginate_with_join
|
59
|
-
@developer_pages, @developers = paginate(:developers,
|
60
|
-
:join => 'LEFT JOIN developers_projects ON developers.id = developers_projects.developer_id',
|
61
|
-
:conditions => 'project_id=1')
|
62
|
-
render :nothing => true
|
63
|
-
end
|
64
|
-
|
65
|
-
def paginate_with_join_and_count
|
66
|
-
@developer_pages, @developers = paginate(:developers,
|
67
|
-
:join => 'd LEFT JOIN developers_projects ON d.id = developers_projects.developer_id',
|
68
|
-
:conditions => 'project_id=1',
|
69
|
-
:count => "d.id")
|
70
|
-
render :nothing => true
|
71
|
-
end
|
72
|
-
|
73
|
-
|
74
|
-
def silence_deprecation_warnings
|
75
|
-
ActiveSupport::Deprecation.silence do
|
76
|
-
yield
|
77
|
-
end
|
78
|
-
end
|
79
|
-
|
80
|
-
def rescue_errors(e) raise e end
|
81
|
-
|
82
|
-
def rescue_action(e) raise end
|
83
|
-
|
84
|
-
end
|
85
|
-
|
86
|
-
def setup
|
87
|
-
@controller = PaginationController.new
|
88
|
-
@request = ActionController::TestRequest.new
|
89
|
-
@response = ActionController::TestResponse.new
|
90
|
-
super
|
91
|
-
end
|
92
|
-
|
93
|
-
# Single Action Pagination Tests
|
94
|
-
|
95
|
-
def test_simple_paginate
|
96
|
-
get :simple_paginate
|
97
|
-
assert_equal 1, assigns(:topic_pages).page_count
|
98
|
-
assert_equal 3, assigns(:topics).size
|
99
|
-
end
|
100
|
-
|
101
|
-
def test_paginate_with_per_page
|
102
|
-
get :paginate_with_per_page
|
103
|
-
assert_equal 1, assigns(:topics).size
|
104
|
-
assert_equal 3, assigns(:topic_pages).page_count
|
105
|
-
end
|
106
|
-
|
107
|
-
def test_paginate_with_order
|
108
|
-
get :paginate_with_order
|
109
|
-
expected = [topics(:futurama),
|
110
|
-
topics(:harvey_birdman),
|
111
|
-
topics(:rails)]
|
112
|
-
assert_equal expected, assigns(:topics)
|
113
|
-
assert_equal 1, assigns(:topic_pages).page_count
|
114
|
-
end
|
115
|
-
|
116
|
-
def test_paginate_with_order_by
|
117
|
-
get :paginate_with_order
|
118
|
-
expected = assigns(:topics)
|
119
|
-
get :paginate_with_order_by
|
120
|
-
assert_equal expected, assigns(:topics)
|
121
|
-
assert_equal 1, assigns(:topic_pages).page_count
|
122
|
-
end
|
123
|
-
|
124
|
-
def test_paginate_with_conditions
|
125
|
-
get :paginate_with_conditions
|
126
|
-
expected = [topics(:rails)]
|
127
|
-
assert_equal expected, assigns(:topics)
|
128
|
-
assert_equal 1, assigns(:topic_pages).page_count
|
129
|
-
end
|
130
|
-
|
131
|
-
def test_paginate_with_class_name
|
132
|
-
get :paginate_with_class_name
|
133
|
-
|
134
|
-
assert assigns(:developers).size > 0
|
135
|
-
assert_equal DeVeLoPeR, assigns(:developers).first.class
|
136
|
-
end
|
137
|
-
|
138
|
-
def test_paginate_with_joins
|
139
|
-
get :paginate_with_joins
|
140
|
-
assert_equal 2, assigns(:developers).size
|
141
|
-
developer_names = assigns(:developers).map { |d| d.name }
|
142
|
-
assert developer_names.include?('David')
|
143
|
-
assert developer_names.include?('Jamis')
|
144
|
-
end
|
145
|
-
|
146
|
-
def test_paginate_with_join_and_conditions
|
147
|
-
get :paginate_with_joins
|
148
|
-
expected = assigns(:developers)
|
149
|
-
get :paginate_with_join
|
150
|
-
assert_equal expected, assigns(:developers)
|
151
|
-
end
|
152
|
-
|
153
|
-
def test_paginate_with_join_and_count
|
154
|
-
get :paginate_with_joins
|
155
|
-
expected = assigns(:developers)
|
156
|
-
get :paginate_with_join_and_count
|
157
|
-
assert_equal expected, assigns(:developers)
|
158
|
-
end
|
159
|
-
|
160
|
-
def test_paginate_with_include_and_order
|
161
|
-
get :paginate_with_include_and_order
|
162
|
-
expected = Topic.find(:all, :include => 'replies', :order => 'replies.created_at asc, topics.created_at asc', :limit => 10)
|
163
|
-
assert_equal expected, assigns(:topics)
|
164
|
-
end
|
165
|
-
end
|
@@ -1,48 +0,0 @@
|
|
1
|
-
require File.dirname(__FILE__) + '/../abstract_unit'
|
2
|
-
|
3
|
-
class DeprecatedControllerInstanceVariablesTest < Test::Unit::TestCase
|
4
|
-
class Target < ActionController::Base
|
5
|
-
def initialize(run = nil)
|
6
|
-
instance_eval(run) if run
|
7
|
-
super()
|
8
|
-
end
|
9
|
-
|
10
|
-
def noop
|
11
|
-
render :nothing => true
|
12
|
-
end
|
13
|
-
|
14
|
-
ActionController::Base::DEPRECATED_INSTANCE_VARIABLES.each do |var|
|
15
|
-
class_eval "def old_#{var}; render :text => @#{var}.to_s end"
|
16
|
-
class_eval "def new_#{var}; render :text => #{var}.to_s end"
|
17
|
-
class_eval "def internal_#{var}; render :text => @_#{var}.to_s end"
|
18
|
-
end
|
19
|
-
|
20
|
-
def rescue_action(e) raise e end
|
21
|
-
end
|
22
|
-
|
23
|
-
def setup
|
24
|
-
@request = ActionController::TestRequest.new
|
25
|
-
@response = ActionController::TestResponse.new
|
26
|
-
@controller = Target.new
|
27
|
-
end
|
28
|
-
|
29
|
-
ActionController::Base::DEPRECATED_INSTANCE_VARIABLES.each do |var|
|
30
|
-
class_eval <<-end_eval, __FILE__, __LINE__
|
31
|
-
def test_old_#{var}_is_deprecated
|
32
|
-
assert_deprecated('@#{var}') { get :old_#{var} }
|
33
|
-
end
|
34
|
-
def test_new_#{var}_isnt_deprecated
|
35
|
-
assert_not_deprecated { get :new_#{var} }
|
36
|
-
end
|
37
|
-
def test_internal_#{var}_isnt_deprecated
|
38
|
-
assert_not_deprecated { get :internal_#{var} }
|
39
|
-
end
|
40
|
-
def test_#{var}_raises_if_already_set
|
41
|
-
assert_raise(RuntimeError) do
|
42
|
-
@controller = Target.new '@#{var} = Object.new'
|
43
|
-
get :noop
|
44
|
-
end
|
45
|
-
end
|
46
|
-
end_eval
|
47
|
-
end
|
48
|
-
end
|
@@ -1,68 +0,0 @@
|
|
1
|
-
require 'test/unit'
|
2
|
-
require 'cgi'
|
3
|
-
require 'stringio'
|
4
|
-
require File.dirname(__FILE__) + '/../../lib/action_controller/cgi_ext/raw_post_data_fix'
|
5
|
-
|
6
|
-
class RawPostDataTest < Test::Unit::TestCase
|
7
|
-
def setup
|
8
|
-
ENV.delete('RAW_POST_DATA')
|
9
|
-
@request_body = 'a=1'
|
10
|
-
end
|
11
|
-
|
12
|
-
def test_post_with_urlencoded_body
|
13
|
-
ENV['REQUEST_METHOD'] = 'POST'
|
14
|
-
ENV['CONTENT_TYPE'] = ' apPlication/x-Www-form-urlEncoded; charset=utf-8'
|
15
|
-
assert_equal ['1'], cgi_params['a']
|
16
|
-
assert_has_raw_post_data
|
17
|
-
end
|
18
|
-
|
19
|
-
def test_post_with_empty_content_type_treated_as_urlencoded
|
20
|
-
ENV['REQUEST_METHOD'] = 'POST'
|
21
|
-
ENV['CONTENT_TYPE'] = ''
|
22
|
-
assert_equal ['1'], cgi_params['a']
|
23
|
-
assert_has_raw_post_data
|
24
|
-
end
|
25
|
-
|
26
|
-
def test_post_with_unrecognized_content_type_reads_body_but_doesnt_parse_params
|
27
|
-
ENV['REQUEST_METHOD'] = 'POST'
|
28
|
-
ENV['CONTENT_TYPE'] = 'foo/bar'
|
29
|
-
assert cgi_params.empty?
|
30
|
-
assert_has_raw_post_data
|
31
|
-
end
|
32
|
-
|
33
|
-
def test_put_with_urlencoded_body
|
34
|
-
ENV['REQUEST_METHOD'] = 'PUT'
|
35
|
-
ENV['CONTENT_TYPE'] = 'application/x-www-form-urlencoded'
|
36
|
-
assert_equal ['1'], cgi_params['a']
|
37
|
-
assert_has_raw_post_data
|
38
|
-
end
|
39
|
-
|
40
|
-
def test_put_with_empty_content_type_ignores_body
|
41
|
-
ENV['REQUEST_METHOD'] = 'PUT'
|
42
|
-
ENV['CONTENT_TYPE'] = ''
|
43
|
-
assert cgi_params.empty?
|
44
|
-
assert_has_raw_post_data
|
45
|
-
end
|
46
|
-
|
47
|
-
def test_put_with_unrecognized_content_type_ignores_body
|
48
|
-
ENV['REQUEST_METHOD'] = 'PUT'
|
49
|
-
ENV['CONTENT_TYPE'] = 'foo/bar'
|
50
|
-
assert cgi_params.empty?
|
51
|
-
assert_has_raw_post_data
|
52
|
-
end
|
53
|
-
|
54
|
-
private
|
55
|
-
def cgi_params
|
56
|
-
old_stdin, $stdin = $stdin, StringIO.new(@request_body.dup)
|
57
|
-
ENV['CONTENT_LENGTH'] = $stdin.size.to_s
|
58
|
-
CGI.new.params
|
59
|
-
ensure
|
60
|
-
$stdin = old_stdin
|
61
|
-
end
|
62
|
-
|
63
|
-
def assert_has_raw_post_data(expected_body = @request_body)
|
64
|
-
assert_not_nil ENV['RAW_POST_DATA']
|
65
|
-
assert ENV['RAW_POST_DATA'].frozen?
|
66
|
-
assert_equal expected_body, ENV['RAW_POST_DATA']
|
67
|
-
end
|
68
|
-
end
|
@@ -1 +0,0 @@
|
|
1
|
-
<%= @cookies[:test] %>
|
@@ -1 +0,0 @@
|
|
1
|
-
<%= cookies[:test] %>
|
@@ -1 +0,0 @@
|
|
1
|
-
<%= @flash[:test] %>
|
@@ -1 +0,0 @@
|
|
1
|
-
<%= flash[:test] %>
|
@@ -1 +0,0 @@
|
|
1
|
-
<%= @headers[:test] %>
|
@@ -1 +0,0 @@
|
|
1
|
-
<%= headers[:test] %>
|
@@ -1 +0,0 @@
|
|
1
|
-
<%= @params[:test] %>
|
@@ -1 +0,0 @@
|
|
1
|
-
<%= params[:test] %>
|
@@ -1 +0,0 @@
|
|
1
|
-
<%= @request.method %>
|
@@ -1 +0,0 @@
|
|
1
|
-
<%= request.method %>
|
@@ -1 +0,0 @@
|
|
1
|
-
<%= @response.body %>
|
@@ -1 +0,0 @@
|
|
1
|
-
<%= response.body %>
|
@@ -1 +0,0 @@
|
|
1
|
-
<%= @session[:test] %>
|
@@ -1 +0,0 @@
|
|
1
|
-
<%= session[:test] %>
|
@@ -1 +0,0 @@
|
|
1
|
-
<html><%= @content_for_layout %></html>
|
@@ -1 +0,0 @@
|
|
1
|
-
<%= hash_object[:first_name] %>
|
@@ -1 +0,0 @@
|
|
1
|
-
<%= @test_unchanged = 'goodbye' %><%= render_collection_of_partials "customer", @customers %><%= @test_unchanged %>
|
@@ -1,36 +0,0 @@
|
|
1
|
-
require File.dirname(__FILE__) + '/../abstract_unit'
|
2
|
-
|
3
|
-
class DeprecatedHelperTest < Test::Unit::TestCase
|
4
|
-
include ActionView::Helpers::JavaScriptHelper
|
5
|
-
include ActionView::Helpers::CaptureHelper
|
6
|
-
|
7
|
-
def test_update_element_function
|
8
|
-
assert_deprecated 'update_element_function' do
|
9
|
-
|
10
|
-
assert_equal %($('myelement').innerHTML = 'blub';\n),
|
11
|
-
update_element_function('myelement', :content => 'blub')
|
12
|
-
assert_equal %($('myelement').innerHTML = 'blub';\n),
|
13
|
-
update_element_function('myelement', :action => :update, :content => 'blub')
|
14
|
-
assert_equal %($('myelement').innerHTML = '';\n),
|
15
|
-
update_element_function('myelement', :action => :empty)
|
16
|
-
assert_equal %(Element.remove('myelement');\n),
|
17
|
-
update_element_function('myelement', :action => :remove)
|
18
|
-
|
19
|
-
assert_equal %(new Insertion.Bottom('myelement','blub');\n),
|
20
|
-
update_element_function('myelement', :position => 'bottom', :content => 'blub')
|
21
|
-
assert_equal %(new Insertion.Bottom('myelement','blub');\n),
|
22
|
-
update_element_function('myelement', :action => :update, :position => :bottom, :content => 'blub')
|
23
|
-
|
24
|
-
_erbout = ""
|
25
|
-
assert_equal %($('myelement').innerHTML = 'test';\n),
|
26
|
-
update_element_function('myelement') { _erbout << "test" }
|
27
|
-
|
28
|
-
_erbout = ""
|
29
|
-
assert_equal %($('myelement').innerHTML = 'blockstuff';\n),
|
30
|
-
update_element_function('myelement', :content => 'paramstuff') { _erbout << "blockstuff" }
|
31
|
-
|
32
|
-
end
|
33
|
-
end
|
34
|
-
|
35
|
-
end
|
36
|
-
|
@@ -1,43 +0,0 @@
|
|
1
|
-
require File.dirname(__FILE__) + '/../abstract_unit'
|
2
|
-
|
3
|
-
class DeprecatedViewInstanceVariablesTest < Test::Unit::TestCase
|
4
|
-
class DeprecatedInstanceVariablesController < ActionController::Base
|
5
|
-
self.template_root = "#{File.dirname(__FILE__)}/../fixtures/"
|
6
|
-
|
7
|
-
def self.controller_path; 'deprecated_instance_variables' end
|
8
|
-
|
9
|
-
ActionController::Base::DEPRECATED_INSTANCE_VARIABLES.each do |var|
|
10
|
-
class_eval <<-end_eval
|
11
|
-
def old_#{var}_inline; render :inline => '<%= @#{var}.to_s %>' end
|
12
|
-
def new_#{var}_inline; render :inline => '<%= #{var}.to_s %>' end
|
13
|
-
def old_#{var}_partial; render :partial => '#{var}_ivar' end
|
14
|
-
def new_#{var}_partial; render :partial => '#{var}_method' end
|
15
|
-
end_eval
|
16
|
-
end
|
17
|
-
|
18
|
-
def rescue_action(e) raise e end
|
19
|
-
end
|
20
|
-
|
21
|
-
def setup
|
22
|
-
@request = ActionController::TestRequest.new
|
23
|
-
@response = ActionController::TestResponse.new
|
24
|
-
@controller = DeprecatedInstanceVariablesController.new
|
25
|
-
end
|
26
|
-
|
27
|
-
ActionController::Base::DEPRECATED_INSTANCE_VARIABLES.each do |var|
|
28
|
-
class_eval <<-end_eval, __FILE__, __LINE__
|
29
|
-
def test_old_#{var}_is_deprecated
|
30
|
-
assert_deprecated('@#{var}') { get :old_#{var}_inline }
|
31
|
-
end
|
32
|
-
def test_new_#{var}_isnt_deprecated
|
33
|
-
assert_not_deprecated { get :new_#{var}_inline }
|
34
|
-
end
|
35
|
-
def test_old_#{var}_partial_is_deprecated
|
36
|
-
assert_deprecated('@#{var}') { get :old_#{var}_partial }
|
37
|
-
end
|
38
|
-
def test_new_#{var}_partial_isnt_deprecated
|
39
|
-
assert_not_deprecated { get :new_#{var}_partial }
|
40
|
-
end
|
41
|
-
end_eval
|
42
|
-
end
|
43
|
-
end
|
@@ -1,109 +0,0 @@
|
|
1
|
-
require File.dirname(__FILE__) + '/../abstract_unit'
|
2
|
-
|
3
|
-
class JavaScriptMacrosHelperTest < Test::Unit::TestCase
|
4
|
-
include ActionView::Helpers::JavaScriptHelper
|
5
|
-
include ActionView::Helpers::JavaScriptMacrosHelper
|
6
|
-
|
7
|
-
include ActionView::Helpers::UrlHelper
|
8
|
-
include ActionView::Helpers::TagHelper
|
9
|
-
include ActionView::Helpers::TextHelper
|
10
|
-
include ActionView::Helpers::FormHelper
|
11
|
-
include ActionView::Helpers::CaptureHelper
|
12
|
-
|
13
|
-
def setup
|
14
|
-
@controller = Class.new do
|
15
|
-
def url_for(options, *parameters_for_method_reference)
|
16
|
-
url = "http://www.example.com/"
|
17
|
-
url << options[:action].to_s if options and options[:action]
|
18
|
-
url
|
19
|
-
end
|
20
|
-
end
|
21
|
-
@controller = @controller.new
|
22
|
-
end
|
23
|
-
|
24
|
-
|
25
|
-
def test_auto_complete_field
|
26
|
-
assert_dom_equal %(<script type=\"text/javascript\">\n//<![CDATA[\nvar some_input_auto_completer = new Ajax.Autocompleter('some_input', 'some_input_auto_complete', 'http://www.example.com/autocomplete', {})\n//]]>\n</script>),
|
27
|
-
auto_complete_field("some_input", :url => { :action => "autocomplete" });
|
28
|
-
assert_dom_equal %(<script type=\"text/javascript\">\n//<![CDATA[\nvar some_input_auto_completer = new Ajax.Autocompleter('some_input', 'some_input_auto_complete', 'http://www.example.com/autocomplete', {tokens:','})\n//]]>\n</script>),
|
29
|
-
auto_complete_field("some_input", :url => { :action => "autocomplete" }, :tokens => ',');
|
30
|
-
assert_dom_equal %(<script type=\"text/javascript\">\n//<![CDATA[\nvar some_input_auto_completer = new Ajax.Autocompleter('some_input', 'some_input_auto_complete', 'http://www.example.com/autocomplete', {tokens:[',']})\n//]]>\n</script>),
|
31
|
-
auto_complete_field("some_input", :url => { :action => "autocomplete" }, :tokens => [',']);
|
32
|
-
assert_dom_equal %(<script type=\"text/javascript\">\n//<![CDATA[\nvar some_input_auto_completer = new Ajax.Autocompleter('some_input', 'some_input_auto_complete', 'http://www.example.com/autocomplete', {minChars:3})\n//]]>\n</script>),
|
33
|
-
auto_complete_field("some_input", :url => { :action => "autocomplete" }, :min_chars => 3);
|
34
|
-
assert_dom_equal %(<script type=\"text/javascript\">\n//<![CDATA[\nvar some_input_auto_completer = new Ajax.Autocompleter('some_input', 'some_input_auto_complete', 'http://www.example.com/autocomplete', {onHide:function(element, update){alert('me');}})\n//]]>\n</script>),
|
35
|
-
auto_complete_field("some_input", :url => { :action => "autocomplete" }, :on_hide => "function(element, update){alert('me');}");
|
36
|
-
assert_dom_equal %(<script type=\"text/javascript\">\n//<![CDATA[\nvar some_input_auto_completer = new Ajax.Autocompleter('some_input', 'some_input_auto_complete', 'http://www.example.com/autocomplete', {frequency:2})\n//]]>\n</script>),
|
37
|
-
auto_complete_field("some_input", :url => { :action => "autocomplete" }, :frequency => 2);
|
38
|
-
assert_dom_equal %(<script type=\"text/javascript\">\n//<![CDATA[\nvar some_input_auto_completer = new Ajax.Autocompleter('some_input', 'some_input_auto_complete', 'http://www.example.com/autocomplete', {afterUpdateElement:function(element,value){alert('You have chosen: '+value)}})\n//]]>\n</script>),
|
39
|
-
auto_complete_field("some_input", :url => { :action => "autocomplete" },
|
40
|
-
:after_update_element => "function(element,value){alert('You have chosen: '+value)}");
|
41
|
-
assert_dom_equal %(<script type=\"text/javascript\">\n//<![CDATA[\nvar some_input_auto_completer = new Ajax.Autocompleter('some_input', 'some_input_auto_complete', 'http://www.example.com/autocomplete', {paramName:'huidriwusch'})\n//]]>\n</script>),
|
42
|
-
auto_complete_field("some_input", :url => { :action => "autocomplete" }, :param_name => 'huidriwusch');
|
43
|
-
end
|
44
|
-
|
45
|
-
def test_auto_complete_result
|
46
|
-
result = [ { :title => 'test1' }, { :title => 'test2' } ]
|
47
|
-
assert_equal %(<ul><li>test1</li><li>test2</li></ul>),
|
48
|
-
auto_complete_result(result, :title)
|
49
|
-
assert_equal %(<ul><li>t<strong class=\"highlight\">est</strong>1</li><li>t<strong class=\"highlight\">est</strong>2</li></ul>),
|
50
|
-
auto_complete_result(result, :title, "est")
|
51
|
-
|
52
|
-
resultuniq = [ { :title => 'test1' }, { :title => 'test1' } ]
|
53
|
-
assert_equal %(<ul><li>t<strong class=\"highlight\">est</strong>1</li></ul>),
|
54
|
-
auto_complete_result(resultuniq, :title, "est")
|
55
|
-
end
|
56
|
-
|
57
|
-
def test_text_field_with_auto_complete
|
58
|
-
assert_match %(<style type="text/css">),
|
59
|
-
text_field_with_auto_complete(:message, :recipient)
|
60
|
-
|
61
|
-
assert_dom_equal %(<input id=\"message_recipient\" name=\"message[recipient]\" size=\"30\" type=\"text\" /><div class=\"auto_complete\" id=\"message_recipient_auto_complete\"></div><script type=\"text/javascript\">\n//<![CDATA[\nvar message_recipient_auto_completer = new Ajax.Autocompleter('message_recipient', 'message_recipient_auto_complete', 'http://www.example.com/auto_complete_for_message_recipient', {})\n//]]>\n</script>),
|
62
|
-
text_field_with_auto_complete(:message, :recipient, {}, :skip_style => true)
|
63
|
-
end
|
64
|
-
|
65
|
-
def test_in_place_editor_external_control
|
66
|
-
assert_dom_equal %(<script type=\"text/javascript\">\n//<![CDATA[\nnew Ajax.InPlaceEditor('some_input', 'http://www.example.com/inplace_edit', {externalControl:'blah'})\n//]]>\n</script>),
|
67
|
-
in_place_editor('some_input', {:url => {:action => 'inplace_edit'}, :external_control => 'blah'})
|
68
|
-
end
|
69
|
-
|
70
|
-
def test_in_place_editor_size
|
71
|
-
assert_dom_equal %(<script type=\"text/javascript\">\n//<![CDATA[\nnew Ajax.InPlaceEditor('some_input', 'http://www.example.com/inplace_edit', {size:4})\n//]]>\n</script>),
|
72
|
-
in_place_editor('some_input', {:url => {:action => 'inplace_edit'}, :size => 4})
|
73
|
-
end
|
74
|
-
|
75
|
-
def test_in_place_editor_cols_no_rows
|
76
|
-
assert_dom_equal %(<script type=\"text/javascript\">\n//<![CDATA[\nnew Ajax.InPlaceEditor('some_input', 'http://www.example.com/inplace_edit', {cols:4})\n//]]>\n</script>),
|
77
|
-
in_place_editor('some_input', {:url => {:action => 'inplace_edit'}, :cols => 4})
|
78
|
-
end
|
79
|
-
|
80
|
-
def test_in_place_editor_cols_with_rows
|
81
|
-
assert_dom_equal %(<script type=\"text/javascript\">\n//<![CDATA[\nnew Ajax.InPlaceEditor('some_input', 'http://www.example.com/inplace_edit', {cols:40, rows:5})\n//]]>\n</script>),
|
82
|
-
in_place_editor('some_input', {:url => {:action => 'inplace_edit'}, :rows => 5, :cols => 40})
|
83
|
-
end
|
84
|
-
|
85
|
-
def test_inplace_editor_loading_text
|
86
|
-
assert_dom_equal %(<script type=\"text/javascript\">\n//<![CDATA[\nnew Ajax.InPlaceEditor('some_input', 'http://www.example.com/inplace_edit', {loadingText:'Why are we waiting?'})\n//]]>\n</script>),
|
87
|
-
in_place_editor('some_input', {:url => {:action => 'inplace_edit'}, :loading_text => 'Why are we waiting?'})
|
88
|
-
end
|
89
|
-
|
90
|
-
def test_in_place_editor_url
|
91
|
-
assert_match "Ajax.InPlaceEditor('id-goes-here', 'http://www.example.com/action_to_set_value')",
|
92
|
-
in_place_editor( 'id-goes-here', :url => { :action => "action_to_set_value" })
|
93
|
-
end
|
94
|
-
|
95
|
-
def test_in_place_editor_load_text_url
|
96
|
-
assert_match "Ajax.InPlaceEditor('id-goes-here', 'http://www.example.com/action_to_set_value', {loadTextURL:'http://www.example.com/action_to_get_value'})",
|
97
|
-
in_place_editor( 'id-goes-here',
|
98
|
-
:url => { :action => "action_to_set_value" },
|
99
|
-
:load_text_url => { :action => "action_to_get_value" })
|
100
|
-
end
|
101
|
-
|
102
|
-
def test_in_place_editor_eval_scripts
|
103
|
-
assert_match "Ajax.InPlaceEditor('id-goes-here', 'http://www.example.com/action_to_set_value', {evalScripts:true})",
|
104
|
-
in_place_editor( 'id-goes-here',
|
105
|
-
:url => { :action => "action_to_set_value" },
|
106
|
-
:script => true )
|
107
|
-
end
|
108
|
-
|
109
|
-
end
|