activejob-lock 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +14 -0
- data/Gemfile +21 -0
- data/LICENSE.txt +22 -0
- data/README.md +48 -0
- data/Rakefile +77 -0
- data/activejob-lock.gemspec +30 -0
- data/lib/activejob/lock/queue_adapters/resque_adapter.rb +44 -0
- data/lib/activejob/lock/queue_adapters.rb +1 -0
- data/lib/activejob/lock/version.rb +5 -0
- data/lib/activejob/lock.rb +38 -0
- data/rails/.gitignore +21 -0
- data/rails/.travis.yml +62 -0
- data/rails/.yardopts +4 -0
- data/rails/CONTRIBUTING.md +17 -0
- data/rails/Gemfile +126 -0
- data/rails/Gemfile.lock +273 -0
- data/rails/RAILS_VERSION +1 -0
- data/rails/README.md +85 -0
- data/rails/RELEASING_RAILS.rdoc +217 -0
- data/rails/Rakefile +67 -0
- data/rails/actionmailer/CHANGELOG.md +63 -0
- data/rails/actionmailer/MIT-LICENSE +21 -0
- data/rails/actionmailer/README.rdoc +176 -0
- data/rails/actionmailer/Rakefile +35 -0
- data/rails/actionmailer/actionmailer.gemspec +28 -0
- data/rails/actionmailer/lib/action_mailer/base.rb +947 -0
- data/rails/actionmailer/lib/action_mailer/collector.rb +30 -0
- data/rails/actionmailer/lib/action_mailer/delivery_job.rb +13 -0
- data/rails/actionmailer/lib/action_mailer/delivery_methods.rb +84 -0
- data/rails/actionmailer/lib/action_mailer/gem_version.rb +15 -0
- data/rails/actionmailer/lib/action_mailer/log_subscriber.rb +39 -0
- data/rails/actionmailer/lib/action_mailer/mail_helper.rb +58 -0
- data/rails/actionmailer/lib/action_mailer/message_delivery.rb +115 -0
- data/rails/actionmailer/lib/action_mailer/preview.rb +118 -0
- data/rails/actionmailer/lib/action_mailer/railtie.rb +64 -0
- data/rails/actionmailer/lib/action_mailer/test_case.rb +104 -0
- data/rails/actionmailer/lib/action_mailer/test_helper.rb +62 -0
- data/rails/actionmailer/lib/action_mailer/version.rb +9 -0
- data/rails/actionmailer/lib/action_mailer.rb +50 -0
- data/rails/actionmailer/lib/rails/generators/mailer/USAGE +17 -0
- data/rails/actionmailer/lib/rails/generators/mailer/mailer_generator.rb +19 -0
- data/rails/actionmailer/lib/rails/generators/mailer/templates/application_mailer.rb +4 -0
- data/rails/actionmailer/lib/rails/generators/mailer/templates/mailer.rb +17 -0
- data/rails/actionmailer/test/abstract_unit.rb +49 -0
- data/rails/actionmailer/test/assert_select_email_test.rb +47 -0
- data/rails/actionmailer/test/asset_host_test.rb +37 -0
- data/rails/actionmailer/test/base_test.rb +885 -0
- data/rails/actionmailer/test/delivery_methods_test.rb +237 -0
- data/rails/actionmailer/test/fixtures/anonymous/welcome.erb +1 -0
- data/rails/actionmailer/test/fixtures/another.path/base_mailer/welcome.erb +1 -0
- data/rails/actionmailer/test/fixtures/asset_host_mailer/email_with_asset.html.erb +1 -0
- data/rails/actionmailer/test/fixtures/asset_mailer/welcome.html.erb +1 -0
- data/rails/actionmailer/test/fixtures/async_mailer/welcome.erb +1 -0
- data/rails/actionmailer/test/fixtures/attachments/foo.jpg +0 -0
- data/rails/actionmailer/test/fixtures/attachments/test.jpg +0 -0
- data/rails/actionmailer/test/fixtures/auto_layout_mailer/hello.html.erb +1 -0
- data/rails/actionmailer/test/fixtures/auto_layout_mailer/multipart.html.erb +1 -0
- data/rails/actionmailer/test/fixtures/auto_layout_mailer/multipart.text.erb +1 -0
- data/rails/actionmailer/test/fixtures/base_mailer/attachment_with_content.erb +1 -0
- data/rails/actionmailer/test/fixtures/base_mailer/attachment_with_hash.html.erb +0 -0
- data/rails/actionmailer/test/fixtures/base_mailer/attachment_with_hash_default_encoding.html.erb +0 -0
- data/rails/actionmailer/test/fixtures/base_mailer/different_layout.html.erb +1 -0
- data/rails/actionmailer/test/fixtures/base_mailer/different_layout.text.erb +1 -0
- data/rails/actionmailer/test/fixtures/base_mailer/email_custom_layout.text.html.erb +1 -0
- data/rails/actionmailer/test/fixtures/base_mailer/email_with_translations.html.erb +1 -0
- data/rails/actionmailer/test/fixtures/base_mailer/explicit_multipart_templates.html.erb +1 -0
- data/rails/actionmailer/test/fixtures/base_mailer/explicit_multipart_templates.text.erb +1 -0
- data/rails/actionmailer/test/fixtures/base_mailer/explicit_multipart_with_one_template.erb +1 -0
- data/rails/actionmailer/test/fixtures/base_mailer/html_only.html.erb +1 -0
- data/rails/actionmailer/test/fixtures/base_mailer/implicit_multipart.html.erb +1 -0
- data/rails/actionmailer/test/fixtures/base_mailer/implicit_multipart.text.erb +1 -0
- data/rails/actionmailer/test/fixtures/base_mailer/implicit_with_locale.en.html.erb +1 -0
- data/rails/actionmailer/test/fixtures/base_mailer/implicit_with_locale.html.erb +1 -0
- data/rails/actionmailer/test/fixtures/base_mailer/implicit_with_locale.pl.text.erb +1 -0
- data/rails/actionmailer/test/fixtures/base_mailer/implicit_with_locale.text.erb +1 -0
- data/rails/actionmailer/test/fixtures/base_mailer/inline_attachment.html.erb +5 -0
- data/rails/actionmailer/test/fixtures/base_mailer/inline_attachment.text.erb +4 -0
- data/rails/actionmailer/test/fixtures/base_mailer/plain_text_only.text.erb +1 -0
- data/rails/actionmailer/test/fixtures/base_mailer/welcome.erb +1 -0
- data/rails/actionmailer/test/fixtures/base_mailer/welcome_with_headers.html.erb +0 -0
- data/rails/actionmailer/test/fixtures/base_mailer/without_mail_call.erb +1 -0
- data/rails/actionmailer/test/fixtures/base_test/after_action_mailer/welcome.html.erb +0 -0
- data/rails/actionmailer/test/fixtures/base_test/before_action_mailer/welcome.html.erb +0 -0
- data/rails/actionmailer/test/fixtures/base_test/default_inline_attachment_mailer/welcome.html.erb +0 -0
- data/rails/actionmailer/test/fixtures/base_test/late_inline_attachment_mailer/on_render.erb +7 -0
- data/rails/actionmailer/test/fixtures/explicit_layout_mailer/logout.html.erb +1 -0
- data/rails/actionmailer/test/fixtures/explicit_layout_mailer/signup.html.erb +1 -0
- data/rails/actionmailer/test/fixtures/first_mailer/share.erb +1 -0
- data/rails/actionmailer/test/fixtures/i18n_test_mailer/mail_with_i18n_subject.erb +4 -0
- data/rails/actionmailer/test/fixtures/layouts/auto_layout_mailer.html.erb +1 -0
- data/rails/actionmailer/test/fixtures/layouts/auto_layout_mailer.text.erb +1 -0
- data/rails/actionmailer/test/fixtures/layouts/different_layout.html.erb +1 -0
- data/rails/actionmailer/test/fixtures/layouts/different_layout.text.erb +1 -0
- data/rails/actionmailer/test/fixtures/layouts/spam.html.erb +1 -0
- data/rails/actionmailer/test/fixtures/mail_delivery_test/delivery_mailer/welcome.html.erb +0 -0
- data/rails/actionmailer/test/fixtures/nested_layout_mailer/signup.html.erb +1 -0
- data/rails/actionmailer/test/fixtures/path.with.dots/funky_path_mailer/multipart_with_template_path_with_dots.erb +1 -0
- data/rails/actionmailer/test/fixtures/proc_mailer/welcome.html.erb +0 -0
- data/rails/actionmailer/test/fixtures/raw_email +14 -0
- data/rails/actionmailer/test/fixtures/second_mailer/share.erb +1 -0
- data/rails/actionmailer/test/fixtures/templates/signed_up.erb +3 -0
- data/rails/actionmailer/test/fixtures/test_helper_mailer/welcome +1 -0
- data/rails/actionmailer/test/fixtures/test_mailer/_subtemplate.text.erb +1 -0
- data/rails/actionmailer/test/fixtures/test_mailer/custom_templating_extension.html.haml +6 -0
- data/rails/actionmailer/test/fixtures/test_mailer/custom_templating_extension.text.haml +6 -0
- data/rails/actionmailer/test/fixtures/test_mailer/implicitly_multipart_example.html.erb +10 -0
- data/rails/actionmailer/test/fixtures/test_mailer/implicitly_multipart_example.html.erb~ +10 -0
- data/rails/actionmailer/test/fixtures/test_mailer/implicitly_multipart_example.ignored.erb +1 -0
- data/rails/actionmailer/test/fixtures/test_mailer/implicitly_multipart_example.rhtml.bak +1 -0
- data/rails/actionmailer/test/fixtures/test_mailer/implicitly_multipart_example.text.erb +2 -0
- data/rails/actionmailer/test/fixtures/test_mailer/implicitly_multipart_example.yaml.erb +1 -0
- data/rails/actionmailer/test/fixtures/test_mailer/included_subtemplate.text.erb +1 -0
- data/rails/actionmailer/test/fixtures/test_mailer/multipart_alternative.html.erb +1 -0
- data/rails/actionmailer/test/fixtures/test_mailer/multipart_alternative.plain.erb +1 -0
- data/rails/actionmailer/test/fixtures/test_mailer/rxml_template.rxml +2 -0
- data/rails/actionmailer/test/fixtures/test_mailer/signed_up.html.erb +3 -0
- data/rails/actionmailer/test/fixtures/url_test_mailer/exercise_url_for.erb +1 -0
- data/rails/actionmailer/test/fixtures/url_test_mailer/signed_up_with_url.erb +5 -0
- data/rails/actionmailer/test/i18n_with_controller_test.rb +70 -0
- data/rails/actionmailer/test/log_subscriber_test.rb +47 -0
- data/rails/actionmailer/test/mail_helper_test.rb +111 -0
- data/rails/actionmailer/test/mail_layout_test.rb +95 -0
- data/rails/actionmailer/test/mailers/asset_mailer.rb +7 -0
- data/rails/actionmailer/test/mailers/base_mailer.rb +130 -0
- data/rails/actionmailer/test/mailers/delayed_mailer.rb +6 -0
- data/rails/actionmailer/test/mailers/proc_mailer.rb +17 -0
- data/rails/actionmailer/test/message_delivery_test.rb +104 -0
- data/rails/actionmailer/test/test_case_test.rb +28 -0
- data/rails/actionmailer/test/test_helper_test.rb +135 -0
- data/rails/actionmailer/test/url_test.rb +138 -0
- data/rails/actionpack/CHANGELOG.md +501 -0
- data/rails/actionpack/MIT-LICENSE +21 -0
- data/rails/actionpack/README.rdoc +58 -0
- data/rails/actionpack/Rakefile +53 -0
- data/rails/actionpack/actionpack.gemspec +31 -0
- data/rails/actionpack/lib/abstract_controller/asset_paths.rb +10 -0
- data/rails/actionpack/lib/abstract_controller/base.rb +269 -0
- data/rails/actionpack/lib/abstract_controller/callbacks.rb +196 -0
- data/rails/actionpack/lib/abstract_controller/collector.rb +46 -0
- data/rails/actionpack/lib/abstract_controller/helpers.rb +194 -0
- data/rails/actionpack/lib/abstract_controller/logger.rb +12 -0
- data/rails/actionpack/lib/abstract_controller/railties/routes_helpers.rb +18 -0
- data/rails/actionpack/lib/abstract_controller/rendering.rb +120 -0
- data/rails/actionpack/lib/abstract_controller/translation.rb +28 -0
- data/rails/actionpack/lib/abstract_controller/url_for.rb +33 -0
- data/rails/actionpack/lib/abstract_controller.rb +20 -0
- data/rails/actionpack/lib/action_controller/base.rb +268 -0
- data/rails/actionpack/lib/action_controller/caching/fragments.rb +103 -0
- data/rails/actionpack/lib/action_controller/caching.rb +89 -0
- data/rails/actionpack/lib/action_controller/log_subscriber.rb +83 -0
- data/rails/actionpack/lib/action_controller/metal/conditional_get.rb +200 -0
- data/rails/actionpack/lib/action_controller/metal/cookies.rb +16 -0
- data/rails/actionpack/lib/action_controller/metal/data_streaming.rb +171 -0
- data/rails/actionpack/lib/action_controller/metal/etag_with_template_digest.rb +50 -0
- data/rails/actionpack/lib/action_controller/metal/exceptions.rb +59 -0
- data/rails/actionpack/lib/action_controller/metal/flash.rb +60 -0
- data/rails/actionpack/lib/action_controller/metal/force_ssl.rb +97 -0
- data/rails/actionpack/lib/action_controller/metal/head.rb +56 -0
- data/rails/actionpack/lib/action_controller/metal/helpers.rb +113 -0
- data/rails/actionpack/lib/action_controller/metal/hide_actions.rb +40 -0
- data/rails/actionpack/lib/action_controller/metal/http_authentication.rb +507 -0
- data/rails/actionpack/lib/action_controller/metal/implicit_render.rb +19 -0
- data/rails/actionpack/lib/action_controller/metal/instrumentation.rb +109 -0
- data/rails/actionpack/lib/action_controller/metal/live.rb +328 -0
- data/rails/actionpack/lib/action_controller/metal/mime_responds.rb +324 -0
- data/rails/actionpack/lib/action_controller/metal/params_wrapper.rb +285 -0
- data/rails/actionpack/lib/action_controller/metal/rack_delegation.rb +32 -0
- data/rails/actionpack/lib/action_controller/metal/redirecting.rb +112 -0
- data/rails/actionpack/lib/action_controller/metal/renderers.rb +140 -0
- data/rails/actionpack/lib/action_controller/metal/rendering.rb +100 -0
- data/rails/actionpack/lib/action_controller/metal/request_forgery_protection.rb +334 -0
- data/rails/actionpack/lib/action_controller/metal/rescue.rb +35 -0
- data/rails/actionpack/lib/action_controller/metal/streaming.rb +221 -0
- data/rails/actionpack/lib/action_controller/metal/strong_parameters.rb +667 -0
- data/rails/actionpack/lib/action_controller/metal/testing.rb +31 -0
- data/rails/actionpack/lib/action_controller/metal/url_for.rb +49 -0
- data/rails/actionpack/lib/action_controller/metal.rb +241 -0
- data/rails/actionpack/lib/action_controller/middleware.rb +39 -0
- data/rails/actionpack/lib/action_controller/model_naming.rb +12 -0
- data/rails/actionpack/lib/action_controller/railtie.rb +71 -0
- data/rails/actionpack/lib/action_controller/railties/helpers.rb +22 -0
- data/rails/actionpack/lib/action_controller/test_case.rb +754 -0
- data/rails/actionpack/lib/action_controller.rb +58 -0
- data/rails/actionpack/lib/action_dispatch/http/cache.rb +176 -0
- data/rails/actionpack/lib/action_dispatch/http/filter_parameters.rb +78 -0
- data/rails/actionpack/lib/action_dispatch/http/filter_redirect.rb +38 -0
- data/rails/actionpack/lib/action_dispatch/http/headers.rb +99 -0
- data/rails/actionpack/lib/action_dispatch/http/mime_negotiation.rb +156 -0
- data/rails/actionpack/lib/action_dispatch/http/mime_type.rb +315 -0
- data/rails/actionpack/lib/action_dispatch/http/mime_types.rb +36 -0
- data/rails/actionpack/lib/action_dispatch/http/parameter_filter.rb +72 -0
- data/rails/actionpack/lib/action_dispatch/http/parameters.rb +67 -0
- data/rails/actionpack/lib/action_dispatch/http/rack_cache.rb +61 -0
- data/rails/actionpack/lib/action_dispatch/http/request.rb +348 -0
- data/rails/actionpack/lib/action_dispatch/http/response.rb +406 -0
- data/rails/actionpack/lib/action_dispatch/http/upload.rb +72 -0
- data/rails/actionpack/lib/action_dispatch/http/url.rb +268 -0
- data/rails/actionpack/lib/action_dispatch/journey/backwards.rb +5 -0
- data/rails/actionpack/lib/action_dispatch/journey/formatter.rb +166 -0
- data/rails/actionpack/lib/action_dispatch/journey/gtg/builder.rb +162 -0
- data/rails/actionpack/lib/action_dispatch/journey/gtg/simulator.rb +47 -0
- data/rails/actionpack/lib/action_dispatch/journey/gtg/transition_table.rb +157 -0
- data/rails/actionpack/lib/action_dispatch/journey/nfa/builder.rb +76 -0
- data/rails/actionpack/lib/action_dispatch/journey/nfa/dot.rb +36 -0
- data/rails/actionpack/lib/action_dispatch/journey/nfa/simulator.rb +47 -0
- data/rails/actionpack/lib/action_dispatch/journey/nfa/transition_table.rb +163 -0
- data/rails/actionpack/lib/action_dispatch/journey/nodes/node.rb +128 -0
- data/rails/actionpack/lib/action_dispatch/journey/parser.rb +198 -0
- data/rails/actionpack/lib/action_dispatch/journey/parser.y +49 -0
- data/rails/actionpack/lib/action_dispatch/journey/parser_extras.rb +23 -0
- data/rails/actionpack/lib/action_dispatch/journey/path/pattern.rb +193 -0
- data/rails/actionpack/lib/action_dispatch/journey/route.rb +125 -0
- data/rails/actionpack/lib/action_dispatch/journey/router/strexp.rb +27 -0
- data/rails/actionpack/lib/action_dispatch/journey/router/utils.rb +93 -0
- data/rails/actionpack/lib/action_dispatch/journey/router.rb +144 -0
- data/rails/actionpack/lib/action_dispatch/journey/routes.rb +76 -0
- data/rails/actionpack/lib/action_dispatch/journey/scanner.rb +61 -0
- data/rails/actionpack/lib/action_dispatch/journey/visitors.rb +221 -0
- data/rails/actionpack/lib/action_dispatch/journey/visualizer/fsm.css +30 -0
- data/rails/actionpack/lib/action_dispatch/journey/visualizer/fsm.js +134 -0
- data/rails/actionpack/lib/action_dispatch/journey/visualizer/index.html.erb +52 -0
- data/rails/actionpack/lib/action_dispatch/journey.rb +5 -0
- data/rails/actionpack/lib/action_dispatch/middleware/callbacks.rb +37 -0
- data/rails/actionpack/lib/action_dispatch/middleware/cookies.rb +574 -0
- data/rails/actionpack/lib/action_dispatch/middleware/debug_exceptions.rb +110 -0
- data/rails/actionpack/lib/action_dispatch/middleware/exception_wrapper.rb +148 -0
- data/rails/actionpack/lib/action_dispatch/middleware/flash.rb +276 -0
- data/rails/actionpack/lib/action_dispatch/middleware/params_parser.rb +60 -0
- data/rails/actionpack/lib/action_dispatch/middleware/public_exceptions.rb +55 -0
- data/rails/actionpack/lib/action_dispatch/middleware/reloader.rb +98 -0
- data/rails/actionpack/lib/action_dispatch/middleware/remote_ip.rb +173 -0
- data/rails/actionpack/lib/action_dispatch/middleware/request_id.rb +35 -0
- data/rails/actionpack/lib/action_dispatch/middleware/session/abstract_store.rb +90 -0
- data/rails/actionpack/lib/action_dispatch/middleware/session/cache_store.rb +49 -0
- data/rails/actionpack/lib/action_dispatch/middleware/session/cookie_store.rb +123 -0
- data/rails/actionpack/lib/action_dispatch/middleware/session/mem_cache_store.rb +22 -0
- data/rails/actionpack/lib/action_dispatch/middleware/show_exceptions.rb +58 -0
- data/rails/actionpack/lib/action_dispatch/middleware/ssl.rb +72 -0
- data/rails/actionpack/lib/action_dispatch/middleware/stack.rb +129 -0
- data/rails/actionpack/lib/action_dispatch/middleware/static.rb +116 -0
- data/rails/actionpack/lib/action_dispatch/middleware/templates/rescues/_request_and_response.html.erb +34 -0
- data/rails/actionpack/lib/action_dispatch/middleware/templates/rescues/_request_and_response.text.erb +23 -0
- data/rails/actionpack/lib/action_dispatch/middleware/templates/rescues/_source.erb +27 -0
- data/rails/actionpack/lib/action_dispatch/middleware/templates/rescues/_trace.html.erb +52 -0
- data/rails/actionpack/lib/action_dispatch/middleware/templates/rescues/_trace.text.erb +9 -0
- data/rails/actionpack/lib/action_dispatch/middleware/templates/rescues/diagnostics.html.erb +16 -0
- data/rails/actionpack/lib/action_dispatch/middleware/templates/rescues/diagnostics.text.erb +9 -0
- data/rails/actionpack/lib/action_dispatch/middleware/templates/rescues/layout.erb +160 -0
- data/rails/actionpack/lib/action_dispatch/middleware/templates/rescues/missing_template.html.erb +11 -0
- data/rails/actionpack/lib/action_dispatch/middleware/templates/rescues/missing_template.text.erb +3 -0
- data/rails/actionpack/lib/action_dispatch/middleware/templates/rescues/routing_error.html.erb +32 -0
- data/rails/actionpack/lib/action_dispatch/middleware/templates/rescues/routing_error.text.erb +11 -0
- data/rails/actionpack/lib/action_dispatch/middleware/templates/rescues/template_error.html.erb +20 -0
- data/rails/actionpack/lib/action_dispatch/middleware/templates/rescues/template_error.text.erb +7 -0
- data/rails/actionpack/lib/action_dispatch/middleware/templates/rescues/unknown_action.html.erb +6 -0
- data/rails/actionpack/lib/action_dispatch/middleware/templates/rescues/unknown_action.text.erb +3 -0
- data/rails/actionpack/lib/action_dispatch/middleware/templates/routes/_route.html.erb +16 -0
- data/rails/actionpack/lib/action_dispatch/middleware/templates/routes/_table.html.erb +200 -0
- data/rails/actionpack/lib/action_dispatch/railtie.rb +45 -0
- data/rails/actionpack/lib/action_dispatch/request/session.rb +193 -0
- data/rails/actionpack/lib/action_dispatch/request/utils.rb +35 -0
- data/rails/actionpack/lib/action_dispatch/routing/endpoint.rb +10 -0
- data/rails/actionpack/lib/action_dispatch/routing/inspector.rb +234 -0
- data/rails/actionpack/lib/action_dispatch/routing/mapper.rb +1979 -0
- data/rails/actionpack/lib/action_dispatch/routing/polymorphic_routes.rb +330 -0
- data/rails/actionpack/lib/action_dispatch/routing/redirection.rb +191 -0
- data/rails/actionpack/lib/action_dispatch/routing/route_set.rb +862 -0
- data/rails/actionpack/lib/action_dispatch/routing/routes_proxy.rb +41 -0
- data/rails/actionpack/lib/action_dispatch/routing/url_for.rb +195 -0
- data/rails/actionpack/lib/action_dispatch/routing.rb +261 -0
- data/rails/actionpack/lib/action_dispatch/testing/assertions/dom.rb +3 -0
- data/rails/actionpack/lib/action_dispatch/testing/assertions/response.rb +82 -0
- data/rails/actionpack/lib/action_dispatch/testing/assertions/routing.rb +212 -0
- data/rails/actionpack/lib/action_dispatch/testing/assertions/selector.rb +3 -0
- data/rails/actionpack/lib/action_dispatch/testing/assertions/tag.rb +3 -0
- data/rails/actionpack/lib/action_dispatch/testing/assertions.rb +22 -0
- data/rails/actionpack/lib/action_dispatch/testing/integration.rb +511 -0
- data/rails/actionpack/lib/action_dispatch/testing/test_process.rb +44 -0
- data/rails/actionpack/lib/action_dispatch/testing/test_request.rb +78 -0
- data/rails/actionpack/lib/action_dispatch/testing/test_response.rb +36 -0
- data/rails/actionpack/lib/action_dispatch.rb +105 -0
- data/rails/actionpack/lib/action_pack/gem_version.rb +15 -0
- data/rails/actionpack/lib/action_pack/version.rb +8 -0
- data/rails/actionpack/lib/action_pack.rb +24 -0
- data/rails/actionpack/test/abstract/callbacks_test.rb +315 -0
- data/rails/actionpack/test/abstract/collector_test.rb +63 -0
- data/rails/actionpack/test/abstract/translation_test.rb +50 -0
- data/rails/actionpack/test/abstract_unit.rb +521 -0
- data/rails/actionpack/test/assertions/response_assertions_test.rb +63 -0
- data/rails/actionpack/test/controller/action_pack_assertions_test.rb +657 -0
- data/rails/actionpack/test/controller/base_test.rb +342 -0
- data/rails/actionpack/test/controller/caching_test.rb +351 -0
- data/rails/actionpack/test/controller/content_type_test.rb +167 -0
- data/rails/actionpack/test/controller/controller_fixtures/app/controllers/admin/user_controller.rb +0 -0
- data/rails/actionpack/test/controller/controller_fixtures/app/controllers/user_controller.rb +0 -0
- data/rails/actionpack/test/controller/controller_fixtures/vendor/plugins/bad_plugin/lib/plugin_controller.rb +0 -0
- data/rails/actionpack/test/controller/default_url_options_with_before_action_test.rb +29 -0
- data/rails/actionpack/test/controller/filters_test.rb +1047 -0
- data/rails/actionpack/test/controller/flash_hash_test.rb +211 -0
- data/rails/actionpack/test/controller/flash_test.rb +335 -0
- data/rails/actionpack/test/controller/force_ssl_test.rb +324 -0
- data/rails/actionpack/test/controller/helper_test.rb +297 -0
- data/rails/actionpack/test/controller/http_basic_authentication_test.rb +144 -0
- data/rails/actionpack/test/controller/http_digest_authentication_test.rb +289 -0
- data/rails/actionpack/test/controller/http_token_authentication_test.rb +200 -0
- data/rails/actionpack/test/controller/integration_test.rb +899 -0
- data/rails/actionpack/test/controller/live_stream_test.rb +454 -0
- data/rails/actionpack/test/controller/localized_templates_test.rb +46 -0
- data/rails/actionpack/test/controller/log_subscriber_test.rb +345 -0
- data/rails/actionpack/test/controller/mime/accept_format_test.rb +92 -0
- data/rails/actionpack/test/controller/mime/respond_to_test.rb +784 -0
- data/rails/actionpack/test/controller/mime/responders_test.rb +32 -0
- data/rails/actionpack/test/controller/new_base/bare_metal_test.rb +153 -0
- data/rails/actionpack/test/controller/new_base/base_test.rb +132 -0
- data/rails/actionpack/test/controller/new_base/content_negotiation_test.rb +27 -0
- data/rails/actionpack/test/controller/new_base/content_type_test.rb +112 -0
- data/rails/actionpack/test/controller/new_base/metal_test.rb +45 -0
- data/rails/actionpack/test/controller/new_base/middleware_test.rb +110 -0
- data/rails/actionpack/test/controller/new_base/render_action_test.rb +315 -0
- data/rails/actionpack/test/controller/new_base/render_body_test.rb +170 -0
- data/rails/actionpack/test/controller/new_base/render_context_test.rb +54 -0
- data/rails/actionpack/test/controller/new_base/render_file_test.rb +70 -0
- data/rails/actionpack/test/controller/new_base/render_html_test.rb +190 -0
- data/rails/actionpack/test/controller/new_base/render_implicit_action_test.rb +57 -0
- data/rails/actionpack/test/controller/new_base/render_layout_test.rb +127 -0
- data/rails/actionpack/test/controller/new_base/render_partial_test.rb +63 -0
- data/rails/actionpack/test/controller/new_base/render_plain_test.rb +168 -0
- data/rails/actionpack/test/controller/new_base/render_streaming_test.rb +114 -0
- data/rails/actionpack/test/controller/new_base/render_template_test.rb +239 -0
- data/rails/actionpack/test/controller/new_base/render_test.rb +136 -0
- data/rails/actionpack/test/controller/new_base/render_text_test.rb +158 -0
- data/rails/actionpack/test/controller/new_base/render_xml_test.rb +11 -0
- data/rails/actionpack/test/controller/output_escaping_test.rb +17 -0
- data/rails/actionpack/test/controller/parameters/accessors_test.rb +125 -0
- data/rails/actionpack/test/controller/parameters/always_permitted_parameters_test.rb +29 -0
- data/rails/actionpack/test/controller/parameters/log_on_unpermitted_params_test.rb +72 -0
- data/rails/actionpack/test/controller/parameters/multi_parameter_attributes_test.rb +38 -0
- data/rails/actionpack/test/controller/parameters/mutators_test.rb +99 -0
- data/rails/actionpack/test/controller/parameters/nested_parameters_test.rb +187 -0
- data/rails/actionpack/test/controller/parameters/parameters_permit_test.rb +289 -0
- data/rails/actionpack/test/controller/parameters/raise_on_unpermitted_params_test.rb +33 -0
- data/rails/actionpack/test/controller/params_wrapper_test.rb +362 -0
- data/rails/actionpack/test/controller/permitted_params_test.rb +25 -0
- data/rails/actionpack/test/controller/redirect_test.rb +354 -0
- data/rails/actionpack/test/controller/render_js_test.rb +34 -0
- data/rails/actionpack/test/controller/render_json_test.rb +136 -0
- data/rails/actionpack/test/controller/render_other_test.rb +24 -0
- data/rails/actionpack/test/controller/render_test.rb +579 -0
- data/rails/actionpack/test/controller/render_xml_test.rb +97 -0
- data/rails/actionpack/test/controller/request/test_request_test.rb +35 -0
- data/rails/actionpack/test/controller/request_forgery_protection_test.rb +510 -0
- data/rails/actionpack/test/controller/required_params_test.rb +51 -0
- data/rails/actionpack/test/controller/rescue_test.rb +348 -0
- data/rails/actionpack/test/controller/resources_test.rb +1334 -0
- data/rails/actionpack/test/controller/routing_test.rb +2026 -0
- data/rails/actionpack/test/controller/runner_test.rb +22 -0
- data/rails/actionpack/test/controller/send_file_test.rb +209 -0
- data/rails/actionpack/test/controller/show_exceptions_test.rb +112 -0
- data/rails/actionpack/test/controller/streaming_test.rb +26 -0
- data/rails/actionpack/test/controller/test_case_test.rb +913 -0
- data/rails/actionpack/test/controller/url_for_integration_test.rb +188 -0
- data/rails/actionpack/test/controller/url_for_test.rb +446 -0
- data/rails/actionpack/test/controller/url_rewriter_test.rb +90 -0
- data/rails/actionpack/test/controller/webservice_test.rb +114 -0
- data/rails/actionpack/test/dispatch/callbacks_test.rb +58 -0
- data/rails/actionpack/test/dispatch/cookies_test.rb +1159 -0
- data/rails/actionpack/test/dispatch/debug_exceptions_test.rb +350 -0
- data/rails/actionpack/test/dispatch/exception_wrapper_test.rb +97 -0
- data/rails/actionpack/test/dispatch/header_test.rb +139 -0
- data/rails/actionpack/test/dispatch/live_response_test.rb +94 -0
- data/rails/actionpack/test/dispatch/mapper_test.rb +112 -0
- data/rails/actionpack/test/dispatch/middleware_stack/middleware_test.rb +77 -0
- data/rails/actionpack/test/dispatch/middleware_stack_test.rb +117 -0
- data/rails/actionpack/test/dispatch/mime_type_test.rb +203 -0
- data/rails/actionpack/test/dispatch/mount_test.rb +93 -0
- data/rails/actionpack/test/dispatch/prefix_generation_test.rb +465 -0
- data/rails/actionpack/test/dispatch/rack_cache_test.rb +21 -0
- data/rails/actionpack/test/dispatch/reloader_test.rb +176 -0
- data/rails/actionpack/test/dispatch/request/json_params_parsing_test.rb +164 -0
- data/rails/actionpack/test/dispatch/request/multipart_params_parsing_test.rb +186 -0
- data/rails/actionpack/test/dispatch/request/query_string_parsing_test.rb +171 -0
- data/rails/actionpack/test/dispatch/request/session_test.rb +116 -0
- data/rails/actionpack/test/dispatch/request/url_encoded_params_parsing_test.rb +177 -0
- data/rails/actionpack/test/dispatch/request_id_test.rb +65 -0
- data/rails/actionpack/test/dispatch/request_test.rb +1159 -0
- data/rails/actionpack/test/dispatch/response_test.rb +344 -0
- data/rails/actionpack/test/dispatch/routing/concerns_test.rb +120 -0
- data/rails/actionpack/test/dispatch/routing/inspector_test.rb +326 -0
- data/rails/actionpack/test/dispatch/routing/route_set_test.rb +205 -0
- data/rails/actionpack/test/dispatch/routing_assertions_test.rb +131 -0
- data/rails/actionpack/test/dispatch/routing_test.rb +4475 -0
- data/rails/actionpack/test/dispatch/session/abstract_store_test.rb +56 -0
- data/rails/actionpack/test/dispatch/session/cache_store_test.rb +179 -0
- data/rails/actionpack/test/dispatch/session/cookie_store_test.rb +356 -0
- data/rails/actionpack/test/dispatch/session/mem_cache_store_test.rb +201 -0
- data/rails/actionpack/test/dispatch/session/test_session_test.rb +43 -0
- data/rails/actionpack/test/dispatch/show_exceptions_test.rb +115 -0
- data/rails/actionpack/test/dispatch/ssl_test.rb +219 -0
- data/rails/actionpack/test/dispatch/static_test.rb +239 -0
- data/rails/actionpack/test/dispatch/template_assertions_test.rb +110 -0
- data/rails/actionpack/test/dispatch/test_request_test.rb +99 -0
- data/rails/actionpack/test/dispatch/test_response_test.rb +21 -0
- data/rails/actionpack/test/dispatch/uploaded_file_test.rb +105 -0
- data/rails/actionpack/test/dispatch/url_generation_test.rb +134 -0
- data/rails/actionpack/test/fixtures/_top_level_partial_only.erb +1 -0
- data/rails/actionpack/test/fixtures/alternate_helpers/foo_helper.rb +3 -0
- data/rails/actionpack/test/fixtures/bad_customers/_bad_customer.html.erb +1 -0
- data/rails/actionpack/test/fixtures/company.rb +9 -0
- data/rails/actionpack/test/fixtures/filter_test/implicit_actions/edit.html.erb +1 -0
- data/rails/actionpack/test/fixtures/filter_test/implicit_actions/show.html.erb +1 -0
- data/rails/actionpack/test/fixtures/functional_caching/_partial.erb +3 -0
- data/rails/actionpack/test/fixtures/functional_caching/formatted_fragment_cached.html.erb +3 -0
- data/rails/actionpack/test/fixtures/functional_caching/formatted_fragment_cached.xml.builder +5 -0
- data/rails/actionpack/test/fixtures/functional_caching/formatted_fragment_cached_with_variant.html+phone.erb +3 -0
- data/rails/actionpack/test/fixtures/functional_caching/fragment_cached.html.erb +3 -0
- data/rails/actionpack/test/fixtures/functional_caching/fragment_cached_without_digest.html.erb +3 -0
- data/rails/actionpack/test/fixtures/functional_caching/html_fragment_cached_with_partial.html.erb +1 -0
- data/rails/actionpack/test/fixtures/functional_caching/inline_fragment_cached.html.erb +2 -0
- data/rails/actionpack/test/fixtures/helpers/abc_helper.rb +3 -0
- data/rails/actionpack/test/fixtures/helpers/fun/games_helper.rb +5 -0
- data/rails/actionpack/test/fixtures/helpers/fun/pdf_helper.rb +5 -0
- data/rails/actionpack/test/fixtures/helpers/just_me_helper.rb +3 -0
- data/rails/actionpack/test/fixtures/helpers/me_too_helper.rb +3 -0
- data/rails/actionpack/test/fixtures/helpers1_pack/pack1_helper.rb +5 -0
- data/rails/actionpack/test/fixtures/helpers2_pack/pack2_helper.rb +5 -0
- data/rails/actionpack/test/fixtures/helpers_typo/admin/users_helper.rb +5 -0
- data/rails/actionpack/test/fixtures/layouts/_customers.erb +1 -0
- data/rails/actionpack/test/fixtures/layouts/block_with_layout.erb +3 -0
- data/rails/actionpack/test/fixtures/layouts/builder.builder +3 -0
- data/rails/actionpack/test/fixtures/layouts/partial_with_layout.erb +3 -0
- data/rails/actionpack/test/fixtures/layouts/standard.html.erb +1 -0
- data/rails/actionpack/test/fixtures/layouts/talk_from_action.erb +2 -0
- data/rails/actionpack/test/fixtures/layouts/with_html_partial.html.erb +1 -0
- data/rails/actionpack/test/fixtures/layouts/xhr.html.erb +2 -0
- data/rails/actionpack/test/fixtures/layouts/yield.erb +2 -0
- data/rails/actionpack/test/fixtures/localized/hello_world.de.html +1 -0
- data/rails/actionpack/test/fixtures/localized/hello_world.en.html +1 -0
- data/rails/actionpack/test/fixtures/localized/hello_world.it.erb +1 -0
- data/rails/actionpack/test/fixtures/multipart/binary_file +0 -0
- data/rails/actionpack/test/fixtures/multipart/boundary_problem_file +10 -0
- data/rails/actionpack/test/fixtures/multipart/bracketed_param +5 -0
- data/rails/actionpack/test/fixtures/multipart/bracketed_utf8_param +5 -0
- data/rails/actionpack/test/fixtures/multipart/empty +10 -0
- data/rails/actionpack/test/fixtures/multipart/hello.txt +1 -0
- data/rails/actionpack/test/fixtures/multipart/large_text_file +10 -0
- data/rails/actionpack/test/fixtures/multipart/mixed_files +0 -0
- data/rails/actionpack/test/fixtures/multipart/mona_lisa.jpg +0 -0
- data/rails/actionpack/test/fixtures/multipart/none +9 -0
- data/rails/actionpack/test/fixtures/multipart/single_parameter +5 -0
- data/rails/actionpack/test/fixtures/multipart/single_utf8_param +5 -0
- data/rails/actionpack/test/fixtures/multipart/text_file +10 -0
- data/rails/actionpack/test/fixtures/old_content_type/render_default_content_types_for_respond_to.xml.erb +1 -0
- data/rails/actionpack/test/fixtures/old_content_type/render_default_for_builder.builder +1 -0
- data/rails/actionpack/test/fixtures/old_content_type/render_default_for_erb.erb +1 -0
- data/rails/actionpack/test/fixtures/post_test/layouts/post.html.erb +1 -0
- data/rails/actionpack/test/fixtures/post_test/layouts/super_post.iphone.erb +1 -0
- data/rails/actionpack/test/fixtures/post_test/post/index.html.erb +1 -0
- data/rails/actionpack/test/fixtures/post_test/post/index.iphone.erb +1 -0
- data/rails/actionpack/test/fixtures/post_test/super_post/index.html.erb +1 -0
- data/rails/actionpack/test/fixtures/post_test/super_post/index.iphone.erb +1 -0
- data/rails/actionpack/test/fixtures/public/400.html +1 -0
- data/rails/actionpack/test/fixtures/public/404.html +1 -0
- data/rails/actionpack/test/fixtures/public/500.da.html +1 -0
- data/rails/actionpack/test/fixtures/public/500.html +1 -0
- data/rails/actionpack/test/fixtures/public/bar/index.html +1 -0
- data/rails/actionpack/test/fixtures/public/bar.html +1 -0
- data/rails/actionpack/test/fixtures/public/foo/bar.html +1 -0
- data/rails/actionpack/test/fixtures/public/foo/baz.css +3 -0
- data/rails/actionpack/test/fixtures/public/foo/index.html +1 -0
- data/rails/actionpack/test/fixtures/public/foo//343/201/223/343/202/223/343/201/253/343/201/241/343/201/257.html +1 -0
- data/rails/actionpack/test/fixtures/public/gzip/application-a71b3024f80aea3181c09774ca17e712.js +4 -0
- data/rails/actionpack/test/fixtures/public/gzip/application-a71b3024f80aea3181c09774ca17e712.js.gz +0 -0
- data/rails/actionpack/test/fixtures/public/gzip/foo.zoo +4 -0
- data/rails/actionpack/test/fixtures/public/gzip/foo.zoo.gz +0 -0
- data/rails/actionpack/test/fixtures/public/index.html +1 -0
- data/rails/actionpack/test/fixtures/respond_to/all_types_with_layout.html.erb +1 -0
- data/rails/actionpack/test/fixtures/respond_to/custom_constant_handling_without_block.mobile.erb +1 -0
- data/rails/actionpack/test/fixtures/respond_to/iphone_with_html_response_type.html.erb +1 -0
- data/rails/actionpack/test/fixtures/respond_to/iphone_with_html_response_type.iphone.erb +1 -0
- data/rails/actionpack/test/fixtures/respond_to/layouts/missing.html.erb +1 -0
- data/rails/actionpack/test/fixtures/respond_to/layouts/standard.html.erb +1 -0
- data/rails/actionpack/test/fixtures/respond_to/layouts/standard.iphone.erb +1 -0
- data/rails/actionpack/test/fixtures/respond_to/using_defaults.html.erb +1 -0
- data/rails/actionpack/test/fixtures/respond_to/using_defaults.xml.builder +1 -0
- data/rails/actionpack/test/fixtures/respond_to/using_defaults_with_all.html.erb +1 -0
- data/rails/actionpack/test/fixtures/respond_to/using_defaults_with_type_list.html.erb +1 -0
- data/rails/actionpack/test/fixtures/respond_to/using_defaults_with_type_list.xml.builder +1 -0
- data/rails/actionpack/test/fixtures/respond_to/variant_any_implicit_render.html+phablet.erb +1 -0
- data/rails/actionpack/test/fixtures/respond_to/variant_any_implicit_render.html+tablet.erb +1 -0
- data/rails/actionpack/test/fixtures/respond_to/variant_inline_syntax_without_block.html+phone.erb +1 -0
- data/rails/actionpack/test/fixtures/respond_to/variant_plus_none_for_format.html.erb +1 -0
- data/rails/actionpack/test/fixtures/respond_to/variant_with_implicit_rendering.html+mobile.erb +1 -0
- data/rails/actionpack/test/fixtures/ruby_template.ruby +2 -0
- data/rails/actionpack/test/fixtures/session_autoload_test/session_autoload_test/foo.rb +10 -0
- data/rails/actionpack/test/fixtures/shared.html.erb +1 -0
- data/rails/actionpack/test/fixtures/star_star_mime/index.js.erb +1 -0
- data/rails/actionpack/test/fixtures/symlink_parent/symlinked_layout.erb +5 -0
- data/rails/actionpack/test/fixtures/test/_partial.erb +1 -0
- data/rails/actionpack/test/fixtures/test/_partial.html.erb +1 -0
- data/rails/actionpack/test/fixtures/test/_partial.js.erb +1 -0
- data/rails/actionpack/test/fixtures/test/dot.directory/render_file_with_ivar.erb +1 -0
- data/rails/actionpack/test/fixtures/test/formatted_xml_erb.builder +1 -0
- data/rails/actionpack/test/fixtures/test/formatted_xml_erb.html.erb +1 -0
- data/rails/actionpack/test/fixtures/test/formatted_xml_erb.xml.erb +1 -0
- data/rails/actionpack/test/fixtures/test/hello/hello.erb +1 -0
- data/rails/actionpack/test/fixtures/test/hello_world.erb +1 -0
- data/rails/actionpack/test/fixtures/test/hello_world_with_partial.html.erb +2 -0
- data/rails/actionpack/test/fixtures/test/hello_xml_world.builder +11 -0
- data/rails/actionpack/test/fixtures/test/implicit_content_type.atom.builder +2 -0
- data/rails/actionpack/test/fixtures/test/render_file_with_ivar.erb +1 -0
- data/rails/actionpack/test/fixtures/test/render_file_with_locals.erb +1 -0
- data/rails/actionpack/test/fixtures//345/205/254/345/205/261/bar/index.html +1 -0
- data/rails/actionpack/test/fixtures//345/205/254/345/205/261/bar.html +1 -0
- data/rails/actionpack/test/fixtures//345/205/254/345/205/261/foo/bar.html +1 -0
- data/rails/actionpack/test/fixtures//345/205/254/345/205/261/foo/baz.css +3 -0
- data/rails/actionpack/test/fixtures//345/205/254/345/205/261/foo/index.html +1 -0
- data/rails/actionpack/test/fixtures//345/205/254/345/205/261/foo//343/201/223/343/202/223/343/201/253/343/201/241/343/201/257.html +1 -0
- data/rails/actionpack/test/fixtures//345/205/254/345/205/261/gzip/application-a71b3024f80aea3181c09774ca17e712.js +4 -0
- data/rails/actionpack/test/fixtures//345/205/254/345/205/261/gzip/application-a71b3024f80aea3181c09774ca17e712.js.gz +0 -0
- data/rails/actionpack/test/fixtures//345/205/254/345/205/261/gzip/foo.zoo +4 -0
- data/rails/actionpack/test/fixtures//345/205/254/345/205/261/gzip/foo.zoo.gz +0 -0
- data/rails/actionpack/test/fixtures//345/205/254/345/205/261/index.html +1 -0
- data/rails/actionpack/test/journey/gtg/builder_test.rb +79 -0
- data/rails/actionpack/test/journey/gtg/transition_table_test.rb +115 -0
- data/rails/actionpack/test/journey/nfa/simulator_test.rb +98 -0
- data/rails/actionpack/test/journey/nfa/transition_table_test.rb +72 -0
- data/rails/actionpack/test/journey/nodes/symbol_test.rb +17 -0
- data/rails/actionpack/test/journey/path/pattern_test.rb +284 -0
- data/rails/actionpack/test/journey/route/definition/parser_test.rb +110 -0
- data/rails/actionpack/test/journey/route/definition/scanner_test.rb +69 -0
- data/rails/actionpack/test/journey/route_test.rb +106 -0
- data/rails/actionpack/test/journey/router/utils_test.rb +38 -0
- data/rails/actionpack/test/journey/router_test.rb +622 -0
- data/rails/actionpack/test/journey/routes_test.rb +53 -0
- data/rails/actionpack/test/lib/controller/fake_controllers.rb +35 -0
- data/rails/actionpack/test/lib/controller/fake_models.rb +73 -0
- data/rails/actionpack/test/routing/helper_test.rb +45 -0
- data/rails/actionpack/test/tmp/.gitignore +0 -0
- data/rails/actionview/CHANGELOG.md +228 -0
- data/rails/actionview/MIT-LICENSE +21 -0
- data/rails/actionview/README.rdoc +39 -0
- data/rails/actionview/RUNNING_UNIT_TESTS.rdoc +27 -0
- data/rails/actionview/Rakefile +83 -0
- data/rails/actionview/actionview.gemspec +31 -0
- data/rails/actionview/lib/action_view/base.rb +205 -0
- data/rails/actionview/lib/action_view/buffers.rb +50 -0
- data/rails/actionview/lib/action_view/context.rb +36 -0
- data/rails/actionview/lib/action_view/dependency_tracker.rb +141 -0
- data/rails/actionview/lib/action_view/digestor.rb +122 -0
- data/rails/actionview/lib/action_view/flows.rb +76 -0
- data/rails/actionview/lib/action_view/gem_version.rb +15 -0
- data/rails/actionview/lib/action_view/helpers/active_model_helper.rb +49 -0
- data/rails/actionview/lib/action_view/helpers/asset_tag_helper.rb +329 -0
- data/rails/actionview/lib/action_view/helpers/asset_url_helper.rb +366 -0
- data/rails/actionview/lib/action_view/helpers/atom_feed_helper.rb +203 -0
- data/rails/actionview/lib/action_view/helpers/cache_helper.rb +200 -0
- data/rails/actionview/lib/action_view/helpers/capture_helper.rb +207 -0
- data/rails/actionview/lib/action_view/helpers/controller_helper.rb +25 -0
- data/rails/actionview/lib/action_view/helpers/csrf_helper.rb +33 -0
- data/rails/actionview/lib/action_view/helpers/date_helper.rb +1098 -0
- data/rails/actionview/lib/action_view/helpers/debug_helper.rb +35 -0
- data/rails/actionview/lib/action_view/helpers/form_helper.rb +1942 -0
- data/rails/actionview/lib/action_view/helpers/form_options_helper.rb +841 -0
- data/rails/actionview/lib/action_view/helpers/form_tag_helper.rb +877 -0
- data/rails/actionview/lib/action_view/helpers/javascript_helper.rb +81 -0
- data/rails/actionview/lib/action_view/helpers/number_helper.rb +432 -0
- data/rails/actionview/lib/action_view/helpers/output_safety_helper.rb +38 -0
- data/rails/actionview/lib/action_view/helpers/record_tag_helper.rb +108 -0
- data/rails/actionview/lib/action_view/helpers/rendering_helper.rb +98 -0
- data/rails/actionview/lib/action_view/helpers/sanitize_helper.rb +172 -0
- data/rails/actionview/lib/action_view/helpers/tag_helper.rb +188 -0
- data/rails/actionview/lib/action_view/helpers/tags/base.rb +155 -0
- data/rails/actionview/lib/action_view/helpers/tags/check_box.rb +64 -0
- data/rails/actionview/lib/action_view/helpers/tags/checkable.rb +16 -0
- data/rails/actionview/lib/action_view/helpers/tags/collection_check_boxes.rb +57 -0
- data/rails/actionview/lib/action_view/helpers/tags/collection_helpers.rb +85 -0
- data/rails/actionview/lib/action_view/helpers/tags/collection_radio_buttons.rb +36 -0
- data/rails/actionview/lib/action_view/helpers/tags/collection_select.rb +28 -0
- data/rails/actionview/lib/action_view/helpers/tags/color_field.rb +25 -0
- data/rails/actionview/lib/action_view/helpers/tags/date_field.rb +13 -0
- data/rails/actionview/lib/action_view/helpers/tags/date_select.rb +72 -0
- data/rails/actionview/lib/action_view/helpers/tags/datetime_field.rb +30 -0
- data/rails/actionview/lib/action_view/helpers/tags/datetime_local_field.rb +19 -0
- data/rails/actionview/lib/action_view/helpers/tags/datetime_select.rb +8 -0
- data/rails/actionview/lib/action_view/helpers/tags/email_field.rb +8 -0
- data/rails/actionview/lib/action_view/helpers/tags/file_field.rb +8 -0
- data/rails/actionview/lib/action_view/helpers/tags/grouped_collection_select.rb +29 -0
- data/rails/actionview/lib/action_view/helpers/tags/hidden_field.rb +8 -0
- data/rails/actionview/lib/action_view/helpers/tags/label.rb +79 -0
- data/rails/actionview/lib/action_view/helpers/tags/month_field.rb +13 -0
- data/rails/actionview/lib/action_view/helpers/tags/number_field.rb +18 -0
- data/rails/actionview/lib/action_view/helpers/tags/password_field.rb +12 -0
- data/rails/actionview/lib/action_view/helpers/tags/placeholderable.rb +22 -0
- data/rails/actionview/lib/action_view/helpers/tags/radio_button.rb +31 -0
- data/rails/actionview/lib/action_view/helpers/tags/range_field.rb +8 -0
- data/rails/actionview/lib/action_view/helpers/tags/search_field.rb +22 -0
- data/rails/actionview/lib/action_view/helpers/tags/select.rb +41 -0
- data/rails/actionview/lib/action_view/helpers/tags/tel_field.rb +8 -0
- data/rails/actionview/lib/action_view/helpers/tags/text_area.rb +22 -0
- data/rails/actionview/lib/action_view/helpers/tags/text_field.rb +33 -0
- data/rails/actionview/lib/action_view/helpers/tags/time_field.rb +13 -0
- data/rails/actionview/lib/action_view/helpers/tags/time_select.rb +8 -0
- data/rails/actionview/lib/action_view/helpers/tags/time_zone_select.rb +20 -0
- data/rails/actionview/lib/action_view/helpers/tags/translator.rb +40 -0
- data/rails/actionview/lib/action_view/helpers/tags/url_field.rb +8 -0
- data/rails/actionview/lib/action_view/helpers/tags/week_field.rb +13 -0
- data/rails/actionview/lib/action_view/helpers/tags.rb +42 -0
- data/rails/actionview/lib/action_view/helpers/text_helper.rb +467 -0
- data/rails/actionview/lib/action_view/helpers/translation_helper.rb +106 -0
- data/rails/actionview/lib/action_view/helpers/url_helper.rb +620 -0
- data/rails/actionview/lib/action_view/helpers.rb +64 -0
- data/rails/actionview/lib/action_view/layouts.rb +426 -0
- data/rails/actionview/lib/action_view/locale/en.yml +56 -0
- data/rails/actionview/lib/action_view/log_subscriber.rb +44 -0
- data/rails/actionview/lib/action_view/lookup_context.rb +255 -0
- data/rails/actionview/lib/action_view/model_naming.rb +12 -0
- data/rails/actionview/lib/action_view/path_set.rb +77 -0
- data/rails/actionview/lib/action_view/railtie.rb +49 -0
- data/rails/actionview/lib/action_view/record_identifier.rb +84 -0
- data/rails/actionview/lib/action_view/renderer/abstract_renderer.rb +49 -0
- data/rails/actionview/lib/action_view/renderer/partial_renderer.rb +548 -0
- data/rails/actionview/lib/action_view/renderer/renderer.rb +50 -0
- data/rails/actionview/lib/action_view/renderer/streaming_template_renderer.rb +103 -0
- data/rails/actionview/lib/action_view/renderer/template_renderer.rb +101 -0
- data/rails/actionview/lib/action_view/rendering.rb +146 -0
- data/rails/actionview/lib/action_view/routing_url_for.rb +134 -0
- data/rails/actionview/lib/action_view/tasks/dependencies.rake +21 -0
- data/rails/actionview/lib/action_view/template/error.rb +141 -0
- data/rails/actionview/lib/action_view/template/handlers/builder.rb +26 -0
- data/rails/actionview/lib/action_view/template/handlers/erb.rb +145 -0
- data/rails/actionview/lib/action_view/template/handlers/raw.rb +11 -0
- data/rails/actionview/lib/action_view/template/handlers.rb +62 -0
- data/rails/actionview/lib/action_view/template/html.rb +34 -0
- data/rails/actionview/lib/action_view/template/resolver.rb +349 -0
- data/rails/actionview/lib/action_view/template/text.rb +34 -0
- data/rails/actionview/lib/action_view/template/types.rb +57 -0
- data/rails/actionview/lib/action_view/template.rb +336 -0
- data/rails/actionview/lib/action_view/test_case.rb +278 -0
- data/rails/actionview/lib/action_view/testing/resolvers.rb +54 -0
- data/rails/actionview/lib/action_view/version.rb +8 -0
- data/rails/actionview/lib/action_view/view_paths.rb +111 -0
- data/rails/actionview/lib/action_view.rb +96 -0
- data/rails/actionview/test/abstract_unit.rb +345 -0
- data/rails/actionview/test/actionpack/abstract/abstract_controller_test.rb +310 -0
- data/rails/actionview/test/actionpack/abstract/helper_test.rb +127 -0
- data/rails/actionview/test/actionpack/abstract/layouts_test.rb +384 -0
- data/rails/actionview/test/actionpack/abstract/render_test.rb +103 -0
- data/rails/actionview/test/actionpack/abstract/views/abstract_controller/testing/me3/formatted.html.erb +1 -0
- data/rails/actionview/test/actionpack/abstract/views/abstract_controller/testing/me3/index.erb +1 -0
- data/rails/actionview/test/actionpack/abstract/views/abstract_controller/testing/me4/index.erb +1 -0
- data/rails/actionview/test/actionpack/abstract/views/abstract_controller/testing/me5/index.erb +1 -0
- data/rails/actionview/test/actionpack/abstract/views/action_with_ivars.erb +1 -0
- data/rails/actionview/test/actionpack/abstract/views/helper_test.erb +1 -0
- data/rails/actionview/test/actionpack/abstract/views/index.erb +1 -0
- data/rails/actionview/test/actionpack/abstract/views/layouts/abstract_controller/testing/me4.erb +1 -0
- data/rails/actionview/test/actionpack/abstract/views/layouts/application.erb +1 -0
- data/rails/actionview/test/actionpack/abstract/views/naked_render.erb +1 -0
- data/rails/actionview/test/actionpack/controller/capture_test.rb +81 -0
- data/rails/actionview/test/actionpack/controller/layout_test.rb +269 -0
- data/rails/actionview/test/actionpack/controller/render_test.rb +1344 -0
- data/rails/actionview/test/actionpack/controller/view_paths_test.rb +174 -0
- data/rails/actionview/test/active_record_unit.rb +91 -0
- data/rails/actionview/test/activerecord/controller_runtime_test.rb +93 -0
- data/rails/actionview/test/activerecord/debug_helper_test.rb +8 -0
- data/rails/actionview/test/activerecord/form_helper_activerecord_test.rb +92 -0
- data/rails/actionview/test/activerecord/polymorphic_routes_test.rb +733 -0
- data/rails/actionview/test/activerecord/render_partial_with_record_identification_test.rb +210 -0
- data/rails/actionview/test/fixtures/_top_level_partial.html.erb +1 -0
- data/rails/actionview/test/fixtures/_top_level_partial_only.erb +1 -0
- data/rails/actionview/test/fixtures/actionpack/bad_customers/_bad_customer.html.erb +1 -0
- data/rails/actionview/test/fixtures/actionpack/customers/_customer.html.erb +1 -0
- data/rails/actionview/test/fixtures/actionpack/fun/games/_form.erb +1 -0
- data/rails/actionview/test/fixtures/actionpack/fun/games/hello_world.erb +1 -0
- data/rails/actionview/test/fixtures/actionpack/good_customers/_good_customer.html.erb +1 -0
- data/rails/actionview/test/fixtures/actionpack/hello.html +1 -0
- data/rails/actionview/test/fixtures/actionpack/layout_tests/alt/layouts/alt.erb +0 -0
- data/rails/actionview/test/fixtures/actionpack/layout_tests/layouts/controller_name_space/nested.erb +1 -0
- data/rails/actionview/test/fixtures/actionpack/layout_tests/layouts/item.erb +1 -0
- data/rails/actionview/test/fixtures/actionpack/layout_tests/layouts/layout_test.erb +1 -0
- data/rails/actionview/test/fixtures/actionpack/layout_tests/layouts/multiple_extensions.html.erb +1 -0
- data/rails/actionview/test/fixtures/actionpack/layout_tests/layouts/symlinked/symlinked_layout.erb +5 -0
- data/rails/actionview/test/fixtures/actionpack/layout_tests/layouts/third_party_template_library.mab +1 -0
- data/rails/actionview/test/fixtures/actionpack/layout_tests/views/goodbye.erb +1 -0
- data/rails/actionview/test/fixtures/actionpack/layout_tests/views/hello.erb +1 -0
- data/rails/actionview/test/fixtures/actionpack/layouts/_column.html.erb +2 -0
- data/rails/actionview/test/fixtures/actionpack/layouts/_customers.erb +1 -0
- data/rails/actionview/test/fixtures/actionpack/layouts/_partial_and_yield.erb +2 -0
- data/rails/actionview/test/fixtures/actionpack/layouts/_yield_only.erb +1 -0
- data/rails/actionview/test/fixtures/actionpack/layouts/_yield_with_params.erb +1 -0
- data/rails/actionview/test/fixtures/actionpack/layouts/block_with_layout.erb +3 -0
- data/rails/actionview/test/fixtures/actionpack/layouts/builder.builder +3 -0
- data/rails/actionview/test/fixtures/actionpack/layouts/partial_with_layout.erb +3 -0
- data/rails/actionview/test/fixtures/actionpack/layouts/standard.html.erb +1 -0
- data/rails/actionview/test/fixtures/actionpack/layouts/streaming.erb +4 -0
- data/rails/actionview/test/fixtures/actionpack/layouts/talk_from_action.erb +2 -0
- data/rails/actionview/test/fixtures/actionpack/layouts/with_html_partial.html.erb +1 -0
- data/rails/actionview/test/fixtures/actionpack/layouts/xhr.html.erb +2 -0
- data/rails/actionview/test/fixtures/actionpack/layouts/yield.erb +2 -0
- data/rails/actionview/test/fixtures/actionpack/layouts/yield_with_render_inline_inside.erb +2 -0
- data/rails/actionview/test/fixtures/actionpack/layouts/yield_with_render_partial_inside.erb +2 -0
- data/rails/actionview/test/fixtures/actionpack/quiz/questions/_question.html.erb +1 -0
- data/rails/actionview/test/fixtures/actionpack/shared.html.erb +1 -0
- data/rails/actionview/test/fixtures/actionpack/test/_changing_priority.html.erb +1 -0
- data/rails/actionview/test/fixtures/actionpack/test/_changing_priority.json.erb +1 -0
- data/rails/actionview/test/fixtures/actionpack/test/_counter.html.erb +1 -0
- data/rails/actionview/test/fixtures/actionpack/test/_customer.erb +1 -0
- data/rails/actionview/test/fixtures/actionpack/test/_customer_counter.erb +1 -0
- data/rails/actionview/test/fixtures/actionpack/test/_customer_counter_with_as.erb +1 -0
- data/rails/actionview/test/fixtures/actionpack/test/_customer_greeting.erb +1 -0
- data/rails/actionview/test/fixtures/actionpack/test/_customer_iteration.erb +1 -0
- data/rails/actionview/test/fixtures/actionpack/test/_customer_iteration_with_as.erb +1 -0
- data/rails/actionview/test/fixtures/actionpack/test/_customer_with_var.erb +1 -0
- data/rails/actionview/test/fixtures/actionpack/test/_directory/_partial_with_locales.html.erb +1 -0
- data/rails/actionview/test/fixtures/actionpack/test/_first_json_partial.json.erb +1 -0
- data/rails/actionview/test/fixtures/actionpack/test/_form.erb +1 -0
- data/rails/actionview/test/fixtures/actionpack/test/_hash_greeting.erb +1 -0
- data/rails/actionview/test/fixtures/actionpack/test/_hash_object.erb +2 -0
- data/rails/actionview/test/fixtures/actionpack/test/_hello.builder +1 -0
- data/rails/actionview/test/fixtures/actionpack/test/_json_change_priority.json.erb +0 -0
- data/rails/actionview/test/fixtures/actionpack/test/_labelling_form.erb +1 -0
- data/rails/actionview/test/fixtures/actionpack/test/_layout_for_partial.html.erb +3 -0
- data/rails/actionview/test/fixtures/actionpack/test/_partial.erb +1 -0
- data/rails/actionview/test/fixtures/actionpack/test/_partial.html.erb +1 -0
- data/rails/actionview/test/fixtures/actionpack/test/_partial.js.erb +1 -0
- data/rails/actionview/test/fixtures/actionpack/test/_partial_for_use_in_layout.html.erb +1 -0
- data/rails/actionview/test/fixtures/actionpack/test/_partial_html_erb.html.erb +1 -0
- data/rails/actionview/test/fixtures/actionpack/test/_partial_name_local_variable.erb +1 -0
- data/rails/actionview/test/fixtures/actionpack/test/_partial_only.erb +1 -0
- data/rails/actionview/test/fixtures/actionpack/test/_partial_only_html.html +1 -0
- data/rails/actionview/test/fixtures/actionpack/test/_partial_with_partial.erb +2 -0
- data/rails/actionview/test/fixtures/actionpack/test/_person.erb +2 -0
- data/rails/actionview/test/fixtures/actionpack/test/_raise_indentation.html.erb +13 -0
- data/rails/actionview/test/fixtures/actionpack/test/_second_json_partial.json.erb +1 -0
- data/rails/actionview/test/fixtures/actionpack/test/action_talk_to_layout.erb +2 -0
- data/rails/actionview/test/fixtures/actionpack/test/calling_partial_with_layout.html.erb +1 -0
- data/rails/actionview/test/fixtures/actionpack/test/capturing.erb +4 -0
- data/rails/actionview/test/fixtures/actionpack/test/change_priority.html.erb +2 -0
- data/rails/actionview/test/fixtures/actionpack/test/content_for.erb +1 -0
- data/rails/actionview/test/fixtures/actionpack/test/content_for_concatenated.erb +3 -0
- data/rails/actionview/test/fixtures/actionpack/test/content_for_with_parameter.erb +2 -0
- data/rails/actionview/test/fixtures/actionpack/test/dot.directory/render_file_with_ivar.erb +1 -0
- data/rails/actionview/test/fixtures/actionpack/test/formatted_html_erb.html.erb +1 -0
- data/rails/actionview/test/fixtures/actionpack/test/formatted_xml_erb.builder +1 -0
- data/rails/actionview/test/fixtures/actionpack/test/formatted_xml_erb.html.erb +1 -0
- data/rails/actionview/test/fixtures/actionpack/test/formatted_xml_erb.xml.erb +1 -0
- data/rails/actionview/test/fixtures/actionpack/test/greeting.html.erb +1 -0
- data/rails/actionview/test/fixtures/actionpack/test/greeting.xml.erb +1 -0
- data/rails/actionview/test/fixtures/actionpack/test/hello/hello.erb +1 -0
- data/rails/actionview/test/fixtures/actionpack/test/hello,world.erb +1 -0
- data/rails/actionview/test/fixtures/actionpack/test/hello.builder +4 -0
- data/rails/actionview/test/fixtures/actionpack/test/hello_world.erb +1 -0
- data/rails/actionview/test/fixtures/actionpack/test/hello_world_container.builder +3 -0
- data/rails/actionview/test/fixtures/actionpack/test/hello_world_from_rxml.builder +3 -0
- data/rails/actionview/test/fixtures/actionpack/test/hello_world_with_layout_false.erb +1 -0
- data/rails/actionview/test/fixtures/actionpack/test/hello_world_with_partial.html.erb +2 -0
- data/rails/actionview/test/fixtures/actionpack/test/hello_xml_world.builder +11 -0
- data/rails/actionview/test/fixtures/actionpack/test/html_template.html.erb +1 -0
- data/rails/actionview/test/fixtures/actionpack/test/hyphen-ated.erb +1 -0
- data/rails/actionview/test/fixtures/actionpack/test/implicit_content_type.atom.builder +2 -0
- data/rails/actionview/test/fixtures/actionpack/test/list.erb +1 -0
- data/rails/actionview/test/fixtures/actionpack/test/non_erb_block_content_for.builder +4 -0
- data/rails/actionview/test/fixtures/actionpack/test/potential_conflicts.erb +4 -0
- data/rails/actionview/test/fixtures/actionpack/test/proper_block_detection.erb +1 -0
- data/rails/actionview/test/fixtures/actionpack/test/render_file_from_template.html.erb +1 -0
- data/rails/actionview/test/fixtures/actionpack/test/render_file_with_ivar.erb +1 -0
- data/rails/actionview/test/fixtures/actionpack/test/render_file_with_locals.erb +1 -0
- data/rails/actionview/test/fixtures/actionpack/test/render_file_with_locals_and_default.erb +1 -0
- data/rails/actionview/test/fixtures/actionpack/test/render_implicit_html_template_from_xhr_request.da.html.erb +1 -0
- data/rails/actionview/test/fixtures/actionpack/test/render_implicit_html_template_from_xhr_request.html.erb +1 -0
- data/rails/actionview/test/fixtures/actionpack/test/render_implicit_js_template_without_layout.js.erb +1 -0
- data/rails/actionview/test/fixtures/actionpack/test/render_partial_inside_directory.html.erb +1 -0
- data/rails/actionview/test/fixtures/actionpack/test/render_to_string_test.erb +1 -0
- data/rails/actionview/test/fixtures/actionpack/test/render_two_partials.html.erb +2 -0
- data/rails/actionview/test/fixtures/actionpack/test/using_layout_around_block.html.erb +1 -0
- data/rails/actionview/test/fixtures/actionpack/test/with_html_partial.html.erb +1 -0
- data/rails/actionview/test/fixtures/actionpack/test/with_partial.html.erb +1 -0
- data/rails/actionview/test/fixtures/actionpack/test/with_partial.text.erb +1 -0
- data/rails/actionview/test/fixtures/actionpack/test/with_xml_template.html.erb +1 -0
- data/rails/actionview/test/fixtures/blog_public/.gitignore +1 -0
- data/rails/actionview/test/fixtures/blog_public/blog.html +1 -0
- data/rails/actionview/test/fixtures/blog_public/index.html +1 -0
- data/rails/actionview/test/fixtures/blog_public/subdir/index.html +1 -0
- data/rails/actionview/test/fixtures/comments/empty.de.html.erb +1 -0
- data/rails/actionview/test/fixtures/comments/empty.html.builder +1 -0
- data/rails/actionview/test/fixtures/comments/empty.html.erb +1 -0
- data/rails/actionview/test/fixtures/comments/empty.xml.erb +1 -0
- data/rails/actionview/test/fixtures/companies.yml +24 -0
- data/rails/actionview/test/fixtures/company.rb +9 -0
- data/rails/actionview/test/fixtures/custom_pattern/another.html.erb +1 -0
- data/rails/actionview/test/fixtures/custom_pattern/html/another.erb +1 -0
- data/rails/actionview/test/fixtures/custom_pattern/html/path.erb +1 -0
- data/rails/actionview/test/fixtures/customers/_customer.html.erb +1 -0
- data/rails/actionview/test/fixtures/customers/_customer.xml.erb +1 -0
- data/rails/actionview/test/fixtures/db_definitions/sqlite.sql +49 -0
- data/rails/actionview/test/fixtures/developer.rb +6 -0
- data/rails/actionview/test/fixtures/developers/_developer.erb +1 -0
- data/rails/actionview/test/fixtures/developers.yml +21 -0
- data/rails/actionview/test/fixtures/developers_projects.yml +13 -0
- data/rails/actionview/test/fixtures/digestor/comments/_comment.html.erb +1 -0
- data/rails/actionview/test/fixtures/digestor/comments/_comments.html.erb +1 -0
- data/rails/actionview/test/fixtures/digestor/events/_event.html.erb +0 -0
- data/rails/actionview/test/fixtures/digestor/level/_recursion.html.erb +1 -0
- data/rails/actionview/test/fixtures/digestor/level/below/_header.html.erb +0 -0
- data/rails/actionview/test/fixtures/digestor/level/below/index.html.erb +1 -0
- data/rails/actionview/test/fixtures/digestor/level/recursion.html.erb +1 -0
- data/rails/actionview/test/fixtures/digestor/messages/_form.html.erb +0 -0
- data/rails/actionview/test/fixtures/digestor/messages/_header.html.erb +0 -0
- data/rails/actionview/test/fixtures/digestor/messages/_message.html.erb +1 -0
- data/rails/actionview/test/fixtures/digestor/messages/actions/_move.html.erb +0 -0
- data/rails/actionview/test/fixtures/digestor/messages/edit.html.erb +5 -0
- data/rails/actionview/test/fixtures/digestor/messages/index.html.erb +2 -0
- data/rails/actionview/test/fixtures/digestor/messages/new.html+iphone.erb +15 -0
- data/rails/actionview/test/fixtures/digestor/messages/show.html.erb +14 -0
- data/rails/actionview/test/fixtures/fun/games/_game.erb +1 -0
- data/rails/actionview/test/fixtures/fun/games/hello_world.erb +1 -0
- data/rails/actionview/test/fixtures/fun/serious/games/_game.erb +1 -0
- data/rails/actionview/test/fixtures/functional_caching/fragment_cached_without_digest.html.erb +3 -0
- data/rails/actionview/test/fixtures/games/_game.erb +1 -0
- data/rails/actionview/test/fixtures/good_customers/_good_customer.html.erb +1 -0
- data/rails/actionview/test/fixtures/happy_path/render_action/hello_world.erb +1 -0
- data/rails/actionview/test/fixtures/helpers/abc_helper.rb +3 -0
- data/rails/actionview/test/fixtures/helpers/helpery_test_helper.rb +5 -0
- data/rails/actionview/test/fixtures/helpers_missing/invalid_require_helper.rb +5 -0
- data/rails/actionview/test/fixtures/layout_tests/alt/hello.erb +1 -0
- data/rails/actionview/test/fixtures/layouts/_column.html.erb +2 -0
- data/rails/actionview/test/fixtures/layouts/_customers.erb +1 -0
- data/rails/actionview/test/fixtures/layouts/_partial_and_yield.erb +2 -0
- data/rails/actionview/test/fixtures/layouts/_yield_only.erb +1 -0
- data/rails/actionview/test/fixtures/layouts/_yield_with_params.erb +1 -0
- data/rails/actionview/test/fixtures/layouts/streaming.erb +4 -0
- data/rails/actionview/test/fixtures/layouts/yield.erb +2 -0
- data/rails/actionview/test/fixtures/layouts/yield_with_render_inline_inside.erb +2 -0
- data/rails/actionview/test/fixtures/layouts/yield_with_render_partial_inside.erb +2 -0
- data/rails/actionview/test/fixtures/mascot.rb +3 -0
- data/rails/actionview/test/fixtures/mascots/_mascot.html.erb +1 -0
- data/rails/actionview/test/fixtures/mascots.yml +4 -0
- data/rails/actionview/test/fixtures/multipart/bracketed_utf8_param +5 -0
- data/rails/actionview/test/fixtures/multipart/single_utf8_param +5 -0
- data/rails/actionview/test/fixtures/override/test/hello_world.erb +1 -0
- data/rails/actionview/test/fixtures/override2/layouts/test/sub.erb +1 -0
- data/rails/actionview/test/fixtures/plain_text.raw +1 -0
- data/rails/actionview/test/fixtures/plain_text_with_characters.raw +1 -0
- data/rails/actionview/test/fixtures/project.rb +3 -0
- data/rails/actionview/test/fixtures/projects/_project.erb +1 -0
- data/rails/actionview/test/fixtures/projects.yml +7 -0
- data/rails/actionview/test/fixtures/public/.gitignore +1 -0
- data/rails/actionview/test/fixtures/public/elsewhere/cools.js +1 -0
- data/rails/actionview/test/fixtures/public/elsewhere/file.css +1 -0
- data/rails/actionview/test/fixtures/public/foo/baz.css +3 -0
- data/rails/actionview/test/fixtures/public/javascripts/application.js +1 -0
- data/rails/actionview/test/fixtures/public/javascripts/bank.js +1 -0
- data/rails/actionview/test/fixtures/public/javascripts/common.javascript +1 -0
- data/rails/actionview/test/fixtures/public/javascripts/controls.js +1 -0
- data/rails/actionview/test/fixtures/public/javascripts/dragdrop.js +1 -0
- data/rails/actionview/test/fixtures/public/javascripts/effects.js +1 -0
- data/rails/actionview/test/fixtures/public/javascripts/prototype.js +1 -0
- data/rails/actionview/test/fixtures/public/javascripts/robber.js +1 -0
- data/rails/actionview/test/fixtures/public/javascripts/subdir/subdir.js +1 -0
- data/rails/actionview/test/fixtures/public/javascripts/version.1.0.js +1 -0
- data/rails/actionview/test/fixtures/public/stylesheets/bank.css +1 -0
- data/rails/actionview/test/fixtures/public/stylesheets/random.styles +1 -0
- data/rails/actionview/test/fixtures/public/stylesheets/robber.css +1 -0
- data/rails/actionview/test/fixtures/public/stylesheets/subdir/subdir.css +1 -0
- data/rails/actionview/test/fixtures/public/stylesheets/version.1.0.css +1 -0
- data/rails/actionview/test/fixtures/replies/_reply.erb +1 -0
- data/rails/actionview/test/fixtures/replies.yml +15 -0
- data/rails/actionview/test/fixtures/reply.rb +7 -0
- data/rails/actionview/test/fixtures/respond_to/using_defaults_with_all.html.erb +1 -0
- data/rails/actionview/test/fixtures/ruby_template.ruby +2 -0
- data/rails/actionview/test/fixtures/scope/test/modgreet.erb +1 -0
- data/rails/actionview/test/fixtures/shared.html.erb +1 -0
- data/rails/actionview/test/fixtures/test/_200.html.erb +1 -0
- data/rails/actionview/test/fixtures/test/_b_layout_for_partial.html.erb +1 -0
- data/rails/actionview/test/fixtures/test/_b_layout_for_partial_with_object.html.erb +1 -0
- data/rails/actionview/test/fixtures/test/_b_layout_for_partial_with_object_counter.html.erb +1 -0
- data/rails/actionview/test/fixtures/test/_changing_priority.html.erb +1 -0
- data/rails/actionview/test/fixtures/test/_changing_priority.json.erb +1 -0
- data/rails/actionview/test/fixtures/test/_content_tag_nested_in_content_tag.erb +3 -0
- data/rails/actionview/test/fixtures/test/_counter.html.erb +1 -0
- data/rails/actionview/test/fixtures/test/_customer.erb +1 -0
- data/rails/actionview/test/fixtures/test/_customer_greeting.erb +1 -0
- data/rails/actionview/test/fixtures/test/_customer_with_var.erb +1 -0
- data/rails/actionview/test/fixtures/test/_directory/_partial_with_locales.html.erb +1 -0
- data/rails/actionview/test/fixtures/test/_first_json_partial.json.erb +1 -0
- data/rails/actionview/test/fixtures/test/_from_helper.erb +1 -0
- data/rails/actionview/test/fixtures/test/_json_change_priority.json.erb +0 -0
- data/rails/actionview/test/fixtures/test/_label_with_block.erb +4 -0
- data/rails/actionview/test/fixtures/test/_layout_for_block_with_args.html.erb +3 -0
- data/rails/actionview/test/fixtures/test/_layout_for_partial.html.erb +3 -0
- data/rails/actionview/test/fixtures/test/_layout_with_partial_and_yield.html.erb +4 -0
- data/rails/actionview/test/fixtures/test/_local_inspector.html.erb +1 -0
- data/rails/actionview/test/fixtures/test/_object_inspector.erb +1 -0
- data/rails/actionview/test/fixtures/test/_one.html.erb +1 -0
- data/rails/actionview/test/fixtures/test/_partial.erb +1 -0
- data/rails/actionview/test/fixtures/test/_partial.html.erb +1 -0
- data/rails/actionview/test/fixtures/test/_partial.js.erb +1 -0
- data/rails/actionview/test/fixtures/test/_partial_for_use_in_layout.html.erb +1 -0
- data/rails/actionview/test/fixtures/test/_partial_name_local_variable.erb +1 -0
- data/rails/actionview/test/fixtures/test/_partial_only.erb +1 -0
- data/rails/actionview/test/fixtures/test/_partial_with_layout.erb +2 -0
- data/rails/actionview/test/fixtures/test/_partial_with_layout_block_content.erb +4 -0
- data/rails/actionview/test/fixtures/test/_partial_with_layout_block_partial.erb +4 -0
- data/rails/actionview/test/fixtures/test/_partial_with_only_html_version.html.erb +1 -0
- data/rails/actionview/test/fixtures/test/_partial_with_partial.erb +2 -0
- data/rails/actionview/test/fixtures/test/_raise.html.erb +1 -0
- data/rails/actionview/test/fixtures/test/_raise_indentation.html.erb +13 -0
- data/rails/actionview/test/fixtures/test/_second_json_partial.json.erb +1 -0
- data/rails/actionview/test/fixtures/test/_two.html.erb +1 -0
- data/rails/actionview/test/fixtures/test/_utf8_partial.html.erb +1 -0
- data/rails/actionview/test/fixtures/test/_utf8_partial_magic.html.erb +2 -0
- data/rails/actionview/test/fixtures/test/basic.html.erb +1 -0
- data/rails/actionview/test/fixtures/test/calling_partial_with_layout.html.erb +1 -0
- data/rails/actionview/test/fixtures/test/change_priority.html.erb +2 -0
- data/rails/actionview/test/fixtures/test/dont_pick_me +1 -0
- data/rails/actionview/test/fixtures/test/dot.directory/render_file_with_ivar.erb +1 -0
- data/rails/actionview/test/fixtures/test/greeting.xml.erb +1 -0
- data/rails/actionview/test/fixtures/test/hello/hello.erb +1 -0
- data/rails/actionview/test/fixtures/test/hello.builder +4 -0
- data/rails/actionview/test/fixtures/test/hello_world.da.html.erb +1 -0
- data/rails/actionview/test/fixtures/test/hello_world.erb +1 -0
- data/rails/actionview/test/fixtures/test/hello_world.erb~ +1 -0
- data/rails/actionview/test/fixtures/test/hello_world.html+phone.erb +1 -0
- data/rails/actionview/test/fixtures/test/hello_world.pt-BR.html.erb +1 -0
- data/rails/actionview/test/fixtures/test/hello_world.text+phone.erb +1 -0
- data/rails/actionview/test/fixtures/test/hello_world_with_partial.html.erb +2 -0
- data/rails/actionview/test/fixtures/test/html_template.html.erb +1 -0
- data/rails/actionview/test/fixtures/test/layout_render_file.erb +2 -0
- data/rails/actionview/test/fixtures/test/layout_render_object.erb +1 -0
- data/rails/actionview/test/fixtures/test/list.erb +1 -0
- data/rails/actionview/test/fixtures/test/malformed/malformed.en.html.erb~ +1 -0
- data/rails/actionview/test/fixtures/test/malformed/malformed.erb~ +1 -0
- data/rails/actionview/test/fixtures/test/malformed/malformed.html.erb~ +1 -0
- data/rails/actionview/test/fixtures/test/malformed/malformed~ +1 -0
- data/rails/actionview/test/fixtures/test/nested_layout.erb +3 -0
- data/rails/actionview/test/fixtures/test/nested_streaming.erb +3 -0
- data/rails/actionview/test/fixtures/test/nil_return.erb +1 -0
- data/rails/actionview/test/fixtures/test/one.html.erb +1 -0
- data/rails/actionview/test/fixtures/test/render_file_with_ivar.erb +1 -0
- data/rails/actionview/test/fixtures/test/render_file_with_locals.erb +1 -0
- data/rails/actionview/test/fixtures/test/render_file_with_locals_and_default.erb +1 -0
- data/rails/actionview/test/fixtures/test/render_partial_inside_directory.html.erb +1 -0
- data/rails/actionview/test/fixtures/test/render_two_partials.html.erb +2 -0
- data/rails/actionview/test/fixtures/test/streaming.erb +3 -0
- data/rails/actionview/test/fixtures/test/streaming_buster.erb +3 -0
- data/rails/actionview/test/fixtures/test/sub_template_raise.html.erb +1 -0
- data/rails/actionview/test/fixtures/test/template.erb +1 -0
- data/rails/actionview/test/fixtures/test/update_element_with_capture.erb +9 -0
- data/rails/actionview/test/fixtures/test/utf8.html.erb +4 -0
- data/rails/actionview/test/fixtures/test/utf8_magic.html.erb +5 -0
- data/rails/actionview/test/fixtures/test/utf8_magic_with_bare_partial.html.erb +5 -0
- data/rails/actionview/test/fixtures/topic.rb +3 -0
- data/rails/actionview/test/fixtures/topics/_topic.html.erb +1 -0
- data/rails/actionview/test/fixtures/topics.yml +22 -0
- data/rails/actionview/test/fixtures/translations/templates/array.erb +1 -0
- data/rails/actionview/test/fixtures/translations/templates/default.erb +1 -0
- data/rails/actionview/test/fixtures/translations/templates/found.erb +1 -0
- data/rails/actionview/test/fixtures/translations/templates/missing.erb +1 -0
- data/rails/actionview/test/fixtures/with_format.json.erb +1 -0
- data/rails/actionview/test/lib/controller/fake_models.rb +201 -0
- data/rails/actionview/test/template/active_model_helper_test.rb +99 -0
- data/rails/actionview/test/template/asset_tag_helper_test.rb +796 -0
- data/rails/actionview/test/template/atom_feed_helper_test.rb +349 -0
- data/rails/actionview/test/template/capture_helper_test.rb +219 -0
- data/rails/actionview/test/template/compiled_templates_test.rb +59 -0
- data/rails/actionview/test/template/date_helper_i18n_test.rb +148 -0
- data/rails/actionview/test/template/date_helper_test.rb +3228 -0
- data/rails/actionview/test/template/dependency_tracker_test.rb +196 -0
- data/rails/actionview/test/template/digestor_test.rb +312 -0
- data/rails/actionview/test/template/erb/form_for_test.rb +11 -0
- data/rails/actionview/test/template/erb/helper.rb +24 -0
- data/rails/actionview/test/template/erb/tag_helper_test.rb +30 -0
- data/rails/actionview/test/template/erb_util_test.rb +107 -0
- data/rails/actionview/test/template/form_collections_helper_test.rb +459 -0
- data/rails/actionview/test/template/form_helper_test.rb +3461 -0
- data/rails/actionview/test/template/form_options_helper_i18n_test.rb +27 -0
- data/rails/actionview/test/template/form_options_helper_test.rb +1358 -0
- data/rails/actionview/test/template/form_tag_helper_test.rb +656 -0
- data/rails/actionview/test/template/html_test.rb +17 -0
- data/rails/actionview/test/template/javascript_helper_test.rb +69 -0
- data/rails/actionview/test/template/log_subscriber_test.rb +91 -0
- data/rails/actionview/test/template/lookup_context_test.rb +282 -0
- data/rails/actionview/test/template/number_helper_test.rb +197 -0
- data/rails/actionview/test/template/output_safety_helper_test.rb +35 -0
- data/rails/actionview/test/template/partial_iteration_test.rb +33 -0
- data/rails/actionview/test/template/record_identifier_test.rb +49 -0
- data/rails/actionview/test/template/record_tag_helper_test.rb +117 -0
- data/rails/actionview/test/template/render_test.rb +600 -0
- data/rails/actionview/test/template/resolver_patterns_test.rb +31 -0
- data/rails/actionview/test/template/sanitize_helper_test.rb +35 -0
- data/rails/actionview/test/template/streaming_render_test.rb +108 -0
- data/rails/actionview/test/template/tag_helper_test.rb +166 -0
- data/rails/actionview/test/template/template_error_test.rb +20 -0
- data/rails/actionview/test/template/template_test.rb +200 -0
- data/rails/actionview/test/template/test_case_test.rb +378 -0
- data/rails/actionview/test/template/test_test.rb +92 -0
- data/rails/actionview/test/template/testing/fixture_resolver_test.rb +18 -0
- data/rails/actionview/test/template/testing/null_resolver_test.rb +12 -0
- data/rails/actionview/test/template/text_helper_test.rb +510 -0
- data/rails/actionview/test/template/text_test.rb +17 -0
- data/rails/actionview/test/template/translation_helper_test.rb +193 -0
- data/rails/actionview/test/template/url_helper_test.rb +798 -0
- data/rails/actionview/test/tmp/.gitkeep +0 -0
- data/rails/activejob/.gitignore +1 -0
- data/rails/activejob/CHANGELOG.md +7 -0
- data/rails/activejob/MIT-LICENSE +21 -0
- data/rails/activejob/README.md +131 -0
- data/rails/activejob/Rakefile +90 -0
- data/rails/activejob/activejob.gemspec +23 -0
- data/rails/activejob/lib/active_job/arguments.rb +144 -0
- data/rails/activejob/lib/active_job/base.rb +66 -0
- data/rails/activejob/lib/active_job/callbacks.rb +146 -0
- data/rails/activejob/lib/active_job/configured_job.rb +16 -0
- data/rails/activejob/lib/active_job/core.rb +88 -0
- data/rails/activejob/lib/active_job/enqueuing.rb +77 -0
- data/rails/activejob/lib/active_job/execution.rb +42 -0
- data/rails/activejob/lib/active_job/gem_version.rb +15 -0
- data/rails/activejob/lib/active_job/logging.rb +107 -0
- data/rails/activejob/lib/active_job/queue_adapter.rb +35 -0
- data/rails/activejob/lib/active_job/queue_adapters/backburner_adapter.rb +36 -0
- data/rails/activejob/lib/active_job/queue_adapters/delayed_job_adapter.rb +39 -0
- data/rails/activejob/lib/active_job/queue_adapters/inline_adapter.rb +23 -0
- data/rails/activejob/lib/active_job/queue_adapters/qu_adapter.rb +42 -0
- data/rails/activejob/lib/active_job/queue_adapters/que_adapter.rb +35 -0
- data/rails/activejob/lib/active_job/queue_adapters/queue_classic_adapter.rb +54 -0
- data/rails/activejob/lib/active_job/queue_adapters/resque_adapter.rb +52 -0
- data/rails/activejob/lib/active_job/queue_adapters/sidekiq_adapter.rb +45 -0
- data/rails/activejob/lib/active_job/queue_adapters/sneakers_adapter.rb +46 -0
- data/rails/activejob/lib/active_job/queue_adapters/sucker_punch_adapter.rb +40 -0
- data/rails/activejob/lib/active_job/queue_adapters/test_adapter.rb +51 -0
- data/rails/activejob/lib/active_job/queue_adapters.rb +52 -0
- data/rails/activejob/lib/active_job/queue_name.rb +51 -0
- data/rails/activejob/lib/active_job/railtie.rb +23 -0
- data/rails/activejob/lib/active_job/test_case.rb +7 -0
- data/rails/activejob/lib/active_job/test_helper.rb +230 -0
- data/rails/activejob/lib/active_job/version.rb +8 -0
- data/rails/activejob/lib/active_job.rb +37 -0
- data/rails/activejob/lib/rails/generators/job/job_generator.rb +24 -0
- data/rails/activejob/lib/rails/generators/job/templates/job.rb +9 -0
- data/rails/activejob/test/adapters/backburner.rb +3 -0
- data/rails/activejob/test/adapters/delayed_job.rb +7 -0
- data/rails/activejob/test/adapters/inline.rb +1 -0
- data/rails/activejob/test/adapters/qu.rb +3 -0
- data/rails/activejob/test/adapters/que.rb +4 -0
- data/rails/activejob/test/adapters/queue_classic.rb +2 -0
- data/rails/activejob/test/adapters/resque.rb +2 -0
- data/rails/activejob/test/adapters/sidekiq.rb +2 -0
- data/rails/activejob/test/adapters/sneakers.rb +2 -0
- data/rails/activejob/test/adapters/sucker_punch.rb +2 -0
- data/rails/activejob/test/adapters/test.rb +3 -0
- data/rails/activejob/test/cases/adapter_test.rb +7 -0
- data/rails/activejob/test/cases/argument_serialization_test.rb +105 -0
- data/rails/activejob/test/cases/callbacks_test.rb +23 -0
- data/rails/activejob/test/cases/job_serialization_test.rb +15 -0
- data/rails/activejob/test/cases/logging_test.rb +114 -0
- data/rails/activejob/test/cases/queue_naming_test.rb +102 -0
- data/rails/activejob/test/cases/queuing_test.rb +44 -0
- data/rails/activejob/test/cases/rescue_test.rb +34 -0
- data/rails/activejob/test/cases/test_case_test.rb +14 -0
- data/rails/activejob/test/cases/test_helper_test.rb +265 -0
- data/rails/activejob/test/helper.rb +30 -0
- data/rails/activejob/test/integration/queuing_test.rb +47 -0
- data/rails/activejob/test/jobs/callback_job.rb +29 -0
- data/rails/activejob/test/jobs/gid_job.rb +8 -0
- data/rails/activejob/test/jobs/hello_job.rb +7 -0
- data/rails/activejob/test/jobs/kwargs_job.rb +7 -0
- data/rails/activejob/test/jobs/logging_job.rb +10 -0
- data/rails/activejob/test/jobs/nested_job.rb +10 -0
- data/rails/activejob/test/jobs/rescue_job.rb +27 -0
- data/rails/activejob/test/models/person.rb +20 -0
- data/rails/activejob/test/support/backburner/inline.rb +8 -0
- data/rails/activejob/test/support/delayed_job/delayed/backend/test.rb +113 -0
- data/rails/activejob/test/support/delayed_job/delayed/serialization/test.rb +0 -0
- data/rails/activejob/test/support/integration/adapters/backburner.rb +38 -0
- data/rails/activejob/test/support/integration/adapters/delayed_job.rb +20 -0
- data/rails/activejob/test/support/integration/adapters/inline.rb +15 -0
- data/rails/activejob/test/support/integration/adapters/qu.rb +38 -0
- data/rails/activejob/test/support/integration/adapters/que.rb +37 -0
- data/rails/activejob/test/support/integration/adapters/queue_classic.rb +39 -0
- data/rails/activejob/test/support/integration/adapters/resque.rb +49 -0
- data/rails/activejob/test/support/integration/adapters/sidekiq.rb +57 -0
- data/rails/activejob/test/support/integration/adapters/sneakers.rb +90 -0
- data/rails/activejob/test/support/integration/adapters/sucker_punch.rb +6 -0
- data/rails/activejob/test/support/integration/dummy_app_template.rb +27 -0
- data/rails/activejob/test/support/integration/helper.rb +30 -0
- data/rails/activejob/test/support/integration/jobs_manager.rb +27 -0
- data/rails/activejob/test/support/integration/test_case_helpers.rb +48 -0
- data/rails/activejob/test/support/job_buffer.rb +19 -0
- data/rails/activejob/test/support/que/inline.rb +9 -0
- data/rails/activejob/test/support/queue_classic/inline.rb +23 -0
- data/rails/activejob/test/support/sneakers/inline.rb +12 -0
- data/rails/activemodel/CHANGELOG.md +61 -0
- data/rails/activemodel/MIT-LICENSE +21 -0
- data/rails/activemodel/README.rdoc +272 -0
- data/rails/activemodel/Rakefile +36 -0
- data/rails/activemodel/activemodel.gemspec +24 -0
- data/rails/activemodel/lib/active_model/attribute_methods.rb +478 -0
- data/rails/activemodel/lib/active_model/callbacks.rb +149 -0
- data/rails/activemodel/lib/active_model/conversion.rb +100 -0
- data/rails/activemodel/lib/active_model/dirty.rb +267 -0
- data/rails/activemodel/lib/active_model/errors.rb +475 -0
- data/rails/activemodel/lib/active_model/forbidden_attributes_protection.rb +28 -0
- data/rails/activemodel/lib/active_model/gem_version.rb +15 -0
- data/rails/activemodel/lib/active_model/lint.rb +113 -0
- data/rails/activemodel/lib/active_model/locale/en.yml +35 -0
- data/rails/activemodel/lib/active_model/model.rb +99 -0
- data/rails/activemodel/lib/active_model/naming.rb +316 -0
- data/rails/activemodel/lib/active_model/railtie.rb +12 -0
- data/rails/activemodel/lib/active_model/secure_password.rb +134 -0
- data/rails/activemodel/lib/active_model/serialization.rb +163 -0
- data/rails/activemodel/lib/active_model/serializers/json.rb +145 -0
- data/rails/activemodel/lib/active_model/serializers/xml.rb +238 -0
- data/rails/activemodel/lib/active_model/test_case.rb +4 -0
- data/rails/activemodel/lib/active_model/translation.rb +69 -0
- data/rails/activemodel/lib/active_model/validations/absence.rb +31 -0
- data/rails/activemodel/lib/active_model/validations/acceptance.rb +55 -0
- data/rails/activemodel/lib/active_model/validations/callbacks.rb +117 -0
- data/rails/activemodel/lib/active_model/validations/clusivity.rb +51 -0
- data/rails/activemodel/lib/active_model/validations/confirmation.rb +67 -0
- data/rails/activemodel/lib/active_model/validations/exclusion.rb +46 -0
- data/rails/activemodel/lib/active_model/validations/format.rb +113 -0
- data/rails/activemodel/lib/active_model/validations/inclusion.rb +46 -0
- data/rails/activemodel/lib/active_model/validations/length.rb +126 -0
- data/rails/activemodel/lib/active_model/validations/numericality.rb +159 -0
- data/rails/activemodel/lib/active_model/validations/presence.rb +39 -0
- data/rails/activemodel/lib/active_model/validations/validates.rb +173 -0
- data/rails/activemodel/lib/active_model/validations/with.rb +153 -0
- data/rails/activemodel/lib/active_model/validations.rb +401 -0
- data/rails/activemodel/lib/active_model/validator.rb +182 -0
- data/rails/activemodel/lib/active_model/version.rb +8 -0
- data/rails/activemodel/lib/active_model.rb +71 -0
- data/rails/activemodel/test/cases/attribute_methods_test.rb +281 -0
- data/rails/activemodel/test/cases/callbacks_test.rb +114 -0
- data/rails/activemodel/test/cases/conversion_test.rb +50 -0
- data/rails/activemodel/test/cases/dirty_test.rb +228 -0
- data/rails/activemodel/test/cases/errors_test.rb +326 -0
- data/rails/activemodel/test/cases/forbidden_attributes_protection_test.rb +36 -0
- data/rails/activemodel/test/cases/helper.rb +20 -0
- data/rails/activemodel/test/cases/lint_test.rb +20 -0
- data/rails/activemodel/test/cases/model_test.rb +75 -0
- data/rails/activemodel/test/cases/naming_test.rb +280 -0
- data/rails/activemodel/test/cases/railtie_test.rb +32 -0
- data/rails/activemodel/test/cases/secure_password_test.rb +218 -0
- data/rails/activemodel/test/cases/serialization_test.rb +168 -0
- data/rails/activemodel/test/cases/serializers/json_serialization_test.rb +198 -0
- data/rails/activemodel/test/cases/serializers/xml_serialization_test.rb +250 -0
- data/rails/activemodel/test/cases/translation_test.rb +108 -0
- data/rails/activemodel/test/cases/validations/absence_validation_test.rb +68 -0
- data/rails/activemodel/test/cases/validations/acceptance_validation_test.rb +68 -0
- data/rails/activemodel/test/cases/validations/callbacks_test.rb +98 -0
- data/rails/activemodel/test/cases/validations/conditional_validation_test.rb +139 -0
- data/rails/activemodel/test/cases/validations/confirmation_validation_test.rb +108 -0
- data/rails/activemodel/test/cases/validations/exclusion_validation_test.rb +92 -0
- data/rails/activemodel/test/cases/validations/format_validation_test.rb +149 -0
- data/rails/activemodel/test/cases/validations/i18n_generate_message_validation_test.rb +150 -0
- data/rails/activemodel/test/cases/validations/i18n_validation_test.rb +373 -0
- data/rails/activemodel/test/cases/validations/inclusion_validation_test.rb +147 -0
- data/rails/activemodel/test/cases/validations/length_validation_test.rb +424 -0
- data/rails/activemodel/test/cases/validations/numericality_validation_test.rb +211 -0
- data/rails/activemodel/test/cases/validations/presence_validation_test.rb +107 -0
- data/rails/activemodel/test/cases/validations/validates_test.rb +158 -0
- data/rails/activemodel/test/cases/validations/validations_context_test.rb +50 -0
- data/rails/activemodel/test/cases/validations/with_validation_test.rb +172 -0
- data/rails/activemodel/test/cases/validations_test.rb +429 -0
- data/rails/activemodel/test/config.rb +3 -0
- data/rails/activemodel/test/models/account.rb +5 -0
- data/rails/activemodel/test/models/blog_post.rb +9 -0
- data/rails/activemodel/test/models/contact.rb +41 -0
- data/rails/activemodel/test/models/custom_reader.rb +15 -0
- data/rails/activemodel/test/models/helicopter.rb +7 -0
- data/rails/activemodel/test/models/person.rb +17 -0
- data/rails/activemodel/test/models/person_with_validator.rb +24 -0
- data/rails/activemodel/test/models/project.rb +3 -0
- data/rails/activemodel/test/models/reply.rb +32 -0
- data/rails/activemodel/test/models/sheep.rb +3 -0
- data/rails/activemodel/test/models/topic.rb +40 -0
- data/rails/activemodel/test/models/track_back.rb +11 -0
- data/rails/activemodel/test/models/user.rb +10 -0
- data/rails/activemodel/test/models/visitor.rb +10 -0
- data/rails/activemodel/test/validators/email_validator.rb +6 -0
- data/rails/activemodel/test/validators/namespace/email_validator.rb +6 -0
- data/rails/activerecord/CHANGELOG.md +1568 -0
- data/rails/activerecord/MIT-LICENSE +20 -0
- data/rails/activerecord/README.rdoc +218 -0
- data/rails/activerecord/RUNNING_UNIT_TESTS.rdoc +44 -0
- data/rails/activerecord/Rakefile +168 -0
- data/rails/activerecord/activerecord.gemspec +28 -0
- data/rails/activerecord/examples/.gitignore +1 -0
- data/rails/activerecord/examples/performance.rb +184 -0
- data/rails/activerecord/examples/simple.rb +14 -0
- data/rails/activerecord/lib/active_record/aggregations.rb +266 -0
- data/rails/activerecord/lib/active_record/association_relation.rb +22 -0
- data/rails/activerecord/lib/active_record/associations/alias_tracker.rb +87 -0
- data/rails/activerecord/lib/active_record/associations/association.rb +253 -0
- data/rails/activerecord/lib/active_record/associations/association_scope.rb +194 -0
- data/rails/activerecord/lib/active_record/associations/belongs_to_association.rb +115 -0
- data/rails/activerecord/lib/active_record/associations/belongs_to_polymorphic_association.rb +40 -0
- data/rails/activerecord/lib/active_record/associations/builder/association.rb +149 -0
- data/rails/activerecord/lib/active_record/associations/builder/belongs_to.rb +116 -0
- data/rails/activerecord/lib/active_record/associations/builder/collection_association.rb +95 -0
- data/rails/activerecord/lib/active_record/associations/builder/has_and_belongs_to_many.rb +124 -0
- data/rails/activerecord/lib/active_record/associations/builder/has_many.rb +15 -0
- data/rails/activerecord/lib/active_record/associations/builder/has_one.rb +23 -0
- data/rails/activerecord/lib/active_record/associations/builder/singular_association.rb +38 -0
- data/rails/activerecord/lib/active_record/associations/collection_association.rb +639 -0
- data/rails/activerecord/lib/active_record/associations/collection_proxy.rb +1028 -0
- data/rails/activerecord/lib/active_record/associations/foreign_association.rb +11 -0
- data/rails/activerecord/lib/active_record/associations/has_many_association.rb +192 -0
- data/rails/activerecord/lib/active_record/associations/has_many_through_association.rb +238 -0
- data/rails/activerecord/lib/active_record/associations/has_one_association.rb +106 -0
- data/rails/activerecord/lib/active_record/associations/has_one_through_association.rb +36 -0
- data/rails/activerecord/lib/active_record/associations/join_dependency/join_association.rb +122 -0
- data/rails/activerecord/lib/active_record/associations/join_dependency/join_base.rb +22 -0
- data/rails/activerecord/lib/active_record/associations/join_dependency/join_part.rb +71 -0
- data/rails/activerecord/lib/active_record/associations/join_dependency.rb +282 -0
- data/rails/activerecord/lib/active_record/associations/preloader/association.rb +162 -0
- data/rails/activerecord/lib/active_record/associations/preloader/belongs_to.rb +17 -0
- data/rails/activerecord/lib/active_record/associations/preloader/collection_association.rb +24 -0
- data/rails/activerecord/lib/active_record/associations/preloader/has_many.rb +17 -0
- data/rails/activerecord/lib/active_record/associations/preloader/has_many_through.rb +19 -0
- data/rails/activerecord/lib/active_record/associations/preloader/has_one.rb +23 -0
- data/rails/activerecord/lib/active_record/associations/preloader/has_one_through.rb +9 -0
- data/rails/activerecord/lib/active_record/associations/preloader/singular_association.rb +21 -0
- data/rails/activerecord/lib/active_record/associations/preloader/through_association.rb +96 -0
- data/rails/activerecord/lib/active_record/associations/preloader.rb +203 -0
- data/rails/activerecord/lib/active_record/associations/singular_association.rb +86 -0
- data/rails/activerecord/lib/active_record/associations/through_association.rb +107 -0
- data/rails/activerecord/lib/active_record/associations.rb +1725 -0
- data/rails/activerecord/lib/active_record/attribute.rb +163 -0
- data/rails/activerecord/lib/active_record/attribute_assignment.rb +212 -0
- data/rails/activerecord/lib/active_record/attribute_decorators.rb +66 -0
- data/rails/activerecord/lib/active_record/attribute_methods/before_type_cast.rb +76 -0
- data/rails/activerecord/lib/active_record/attribute_methods/dirty.rb +185 -0
- data/rails/activerecord/lib/active_record/attribute_methods/primary_key.rb +128 -0
- data/rails/activerecord/lib/active_record/attribute_methods/query.rb +40 -0
- data/rails/activerecord/lib/active_record/attribute_methods/read.rb +103 -0
- data/rails/activerecord/lib/active_record/attribute_methods/serialization.rb +70 -0
- data/rails/activerecord/lib/active_record/attribute_methods/time_zone_conversion.rb +69 -0
- data/rails/activerecord/lib/active_record/attribute_methods/write.rb +83 -0
- data/rails/activerecord/lib/active_record/attribute_methods.rb +439 -0
- data/rails/activerecord/lib/active_record/attribute_set/builder.rb +96 -0
- data/rails/activerecord/lib/active_record/attribute_set.rb +77 -0
- data/rails/activerecord/lib/active_record/attributes.rb +146 -0
- data/rails/activerecord/lib/active_record/autosave_association.rb +454 -0
- data/rails/activerecord/lib/active_record/base.rb +317 -0
- data/rails/activerecord/lib/active_record/callbacks.rb +313 -0
- data/rails/activerecord/lib/active_record/coders/json.rb +13 -0
- data/rails/activerecord/lib/active_record/coders/yaml_column.rb +38 -0
- data/rails/activerecord/lib/active_record/connection_adapters/abstract/connection_pool.rb +661 -0
- data/rails/activerecord/lib/active_record/connection_adapters/abstract/database_limits.rb +67 -0
- data/rails/activerecord/lib/active_record/connection_adapters/abstract/database_statements.rb +384 -0
- data/rails/activerecord/lib/active_record/connection_adapters/abstract/query_cache.rb +95 -0
- data/rails/activerecord/lib/active_record/connection_adapters/abstract/quoting.rb +133 -0
- data/rails/activerecord/lib/active_record/connection_adapters/abstract/savepoints.rb +21 -0
- data/rails/activerecord/lib/active_record/connection_adapters/abstract/schema_creation.rb +125 -0
- data/rails/activerecord/lib/active_record/connection_adapters/abstract/schema_definitions.rb +592 -0
- data/rails/activerecord/lib/active_record/connection_adapters/abstract/schema_dumper.rb +50 -0
- data/rails/activerecord/lib/active_record/connection_adapters/abstract/schema_statements.rb +1023 -0
- data/rails/activerecord/lib/active_record/connection_adapters/abstract/transaction.rb +219 -0
- data/rails/activerecord/lib/active_record/connection_adapters/abstract_adapter.rb +494 -0
- data/rails/activerecord/lib/active_record/connection_adapters/abstract_mysql_adapter.rb +905 -0
- data/rails/activerecord/lib/active_record/connection_adapters/column.rb +82 -0
- data/rails/activerecord/lib/active_record/connection_adapters/connection_specification.rb +275 -0
- data/rails/activerecord/lib/active_record/connection_adapters/mysql2_adapter.rb +282 -0
- data/rails/activerecord/lib/active_record/connection_adapters/mysql_adapter.rb +491 -0
- data/rails/activerecord/lib/active_record/connection_adapters/postgresql/array_parser.rb +93 -0
- data/rails/activerecord/lib/active_record/connection_adapters/postgresql/column.rb +20 -0
- data/rails/activerecord/lib/active_record/connection_adapters/postgresql/database_statements.rb +232 -0
- data/rails/activerecord/lib/active_record/connection_adapters/postgresql/oid/array.rb +99 -0
- data/rails/activerecord/lib/active_record/connection_adapters/postgresql/oid/bit.rb +52 -0
- data/rails/activerecord/lib/active_record/connection_adapters/postgresql/oid/bit_varying.rb +13 -0
- data/rails/activerecord/lib/active_record/connection_adapters/postgresql/oid/bytea.rb +15 -0
- data/rails/activerecord/lib/active_record/connection_adapters/postgresql/oid/cidr.rb +46 -0
- data/rails/activerecord/lib/active_record/connection_adapters/postgresql/oid/date.rb +11 -0
- data/rails/activerecord/lib/active_record/connection_adapters/postgresql/oid/date_time.rb +36 -0
- data/rails/activerecord/lib/active_record/connection_adapters/postgresql/oid/decimal.rb +13 -0
- data/rails/activerecord/lib/active_record/connection_adapters/postgresql/oid/enum.rb +17 -0
- data/rails/activerecord/lib/active_record/connection_adapters/postgresql/oid/float.rb +21 -0
- data/rails/activerecord/lib/active_record/connection_adapters/postgresql/oid/hstore.rb +59 -0
- data/rails/activerecord/lib/active_record/connection_adapters/postgresql/oid/inet.rb +13 -0
- data/rails/activerecord/lib/active_record/connection_adapters/postgresql/oid/infinity.rb +13 -0
- data/rails/activerecord/lib/active_record/connection_adapters/postgresql/oid/integer.rb +11 -0
- data/rails/activerecord/lib/active_record/connection_adapters/postgresql/oid/json.rb +35 -0
- data/rails/activerecord/lib/active_record/connection_adapters/postgresql/oid/jsonb.rb +23 -0
- data/rails/activerecord/lib/active_record/connection_adapters/postgresql/oid/money.rb +43 -0
- data/rails/activerecord/lib/active_record/connection_adapters/postgresql/oid/point.rb +43 -0
- data/rails/activerecord/lib/active_record/connection_adapters/postgresql/oid/range.rb +79 -0
- data/rails/activerecord/lib/active_record/connection_adapters/postgresql/oid/specialized_string.rb +19 -0
- data/rails/activerecord/lib/active_record/connection_adapters/postgresql/oid/time.rb +11 -0
- data/rails/activerecord/lib/active_record/connection_adapters/postgresql/oid/type_map_initializer.rb +97 -0
- data/rails/activerecord/lib/active_record/connection_adapters/postgresql/oid/uuid.rb +21 -0
- data/rails/activerecord/lib/active_record/connection_adapters/postgresql/oid/vector.rb +26 -0
- data/rails/activerecord/lib/active_record/connection_adapters/postgresql/oid/xml.rb +28 -0
- data/rails/activerecord/lib/active_record/connection_adapters/postgresql/oid.rb +36 -0
- data/rails/activerecord/lib/active_record/connection_adapters/postgresql/quoting.rb +108 -0
- data/rails/activerecord/lib/active_record/connection_adapters/postgresql/referential_integrity.rb +30 -0
- data/rails/activerecord/lib/active_record/connection_adapters/postgresql/schema_definitions.rb +152 -0
- data/rails/activerecord/lib/active_record/connection_adapters/postgresql/schema_statements.rb +587 -0
- data/rails/activerecord/lib/active_record/connection_adapters/postgresql/utils.rb +77 -0
- data/rails/activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb +754 -0
- data/rails/activerecord/lib/active_record/connection_adapters/schema_cache.rb +94 -0
- data/rails/activerecord/lib/active_record/connection_adapters/sqlite3_adapter.rb +622 -0
- data/rails/activerecord/lib/active_record/connection_adapters/statement_pool.rb +40 -0
- data/rails/activerecord/lib/active_record/connection_handling.rb +132 -0
- data/rails/activerecord/lib/active_record/core.rb +572 -0
- data/rails/activerecord/lib/active_record/counter_cache.rb +175 -0
- data/rails/activerecord/lib/active_record/dynamic_matchers.rb +140 -0
- data/rails/activerecord/lib/active_record/enum.rb +198 -0
- data/rails/activerecord/lib/active_record/errors.rb +252 -0
- data/rails/activerecord/lib/active_record/explain.rb +38 -0
- data/rails/activerecord/lib/active_record/explain_registry.rb +30 -0
- data/rails/activerecord/lib/active_record/explain_subscriber.rb +29 -0
- data/rails/activerecord/lib/active_record/fixture_set/file.rb +56 -0
- data/rails/activerecord/lib/active_record/fixtures.rb +1007 -0
- data/rails/activerecord/lib/active_record/gem_version.rb +15 -0
- data/rails/activerecord/lib/active_record/inheritance.rb +247 -0
- data/rails/activerecord/lib/active_record/integration.rb +113 -0
- data/rails/activerecord/lib/active_record/locale/en.yml +47 -0
- data/rails/activerecord/lib/active_record/locking/optimistic.rb +206 -0
- data/rails/activerecord/lib/active_record/locking/pessimistic.rb +77 -0
- data/rails/activerecord/lib/active_record/log_subscriber.rb +75 -0
- data/rails/activerecord/lib/active_record/migration/command_recorder.rb +197 -0
- data/rails/activerecord/lib/active_record/migration/join_table.rb +15 -0
- data/rails/activerecord/lib/active_record/migration.rb +1051 -0
- data/rails/activerecord/lib/active_record/model_schema.rb +340 -0
- data/rails/activerecord/lib/active_record/nested_attributes.rb +548 -0
- data/rails/activerecord/lib/active_record/no_touching.rb +52 -0
- data/rails/activerecord/lib/active_record/null_relation.rb +81 -0
- data/rails/activerecord/lib/active_record/persistence.rb +532 -0
- data/rails/activerecord/lib/active_record/query_cache.rb +56 -0
- data/rails/activerecord/lib/active_record/querying.rb +68 -0
- data/rails/activerecord/lib/active_record/railtie.rb +162 -0
- data/rails/activerecord/lib/active_record/railties/console_sandbox.rb +5 -0
- data/rails/activerecord/lib/active_record/railties/controller_runtime.rb +50 -0
- data/rails/activerecord/lib/active_record/railties/databases.rake +391 -0
- data/rails/activerecord/lib/active_record/railties/jdbcmysql_error.rb +16 -0
- data/rails/activerecord/lib/active_record/readonly_attributes.rb +23 -0
- data/rails/activerecord/lib/active_record/reflection.rb +881 -0
- data/rails/activerecord/lib/active_record/relation/batches.rb +138 -0
- data/rails/activerecord/lib/active_record/relation/calculations.rb +403 -0
- data/rails/activerecord/lib/active_record/relation/delegation.rb +140 -0
- data/rails/activerecord/lib/active_record/relation/finder_methods.rb +528 -0
- data/rails/activerecord/lib/active_record/relation/merger.rb +170 -0
- data/rails/activerecord/lib/active_record/relation/predicate_builder/array_handler.rb +47 -0
- data/rails/activerecord/lib/active_record/relation/predicate_builder/relation_handler.rb +13 -0
- data/rails/activerecord/lib/active_record/relation/predicate_builder.rb +141 -0
- data/rails/activerecord/lib/active_record/relation/query_methods.rb +1177 -0
- data/rails/activerecord/lib/active_record/relation/spawn_methods.rb +75 -0
- data/rails/activerecord/lib/active_record/relation.rb +681 -0
- data/rails/activerecord/lib/active_record/result.rb +131 -0
- data/rails/activerecord/lib/active_record/runtime_registry.rb +22 -0
- data/rails/activerecord/lib/active_record/sanitization.rb +191 -0
- data/rails/activerecord/lib/active_record/schema.rb +64 -0
- data/rails/activerecord/lib/active_record/schema_dumper.rb +251 -0
- data/rails/activerecord/lib/active_record/schema_migration.rb +56 -0
- data/rails/activerecord/lib/active_record/scoping/default.rb +134 -0
- data/rails/activerecord/lib/active_record/scoping/named.rb +164 -0
- data/rails/activerecord/lib/active_record/scoping.rb +87 -0
- data/rails/activerecord/lib/active_record/serialization.rb +22 -0
- data/rails/activerecord/lib/active_record/serializers/xml_serializer.rb +193 -0
- data/rails/activerecord/lib/active_record/statement_cache.rb +111 -0
- data/rails/activerecord/lib/active_record/store.rb +205 -0
- data/rails/activerecord/lib/active_record/tasks/database_tasks.rb +296 -0
- data/rails/activerecord/lib/active_record/tasks/mysql_database_tasks.rb +145 -0
- data/rails/activerecord/lib/active_record/tasks/postgresql_database_tasks.rb +90 -0
- data/rails/activerecord/lib/active_record/tasks/sqlite_database_tasks.rb +55 -0
- data/rails/activerecord/lib/active_record/timestamp.rb +121 -0
- data/rails/activerecord/lib/active_record/transactions.rb +415 -0
- data/rails/activerecord/lib/active_record/translation.rb +22 -0
- data/rails/activerecord/lib/active_record/type/big_integer.rb +13 -0
- data/rails/activerecord/lib/active_record/type/binary.rb +50 -0
- data/rails/activerecord/lib/active_record/type/boolean.rb +30 -0
- data/rails/activerecord/lib/active_record/type/date.rb +46 -0
- data/rails/activerecord/lib/active_record/type/date_time.rb +54 -0
- data/rails/activerecord/lib/active_record/type/decimal.rb +48 -0
- data/rails/activerecord/lib/active_record/type/decimal_without_scale.rb +11 -0
- data/rails/activerecord/lib/active_record/type/decorator.rb +14 -0
- data/rails/activerecord/lib/active_record/type/float.rb +19 -0
- data/rails/activerecord/lib/active_record/type/hash_lookup_type_map.rb +17 -0
- data/rails/activerecord/lib/active_record/type/integer.rb +59 -0
- data/rails/activerecord/lib/active_record/type/mutable.rb +16 -0
- data/rails/activerecord/lib/active_record/type/numeric.rb +36 -0
- data/rails/activerecord/lib/active_record/type/serialized.rb +56 -0
- data/rails/activerecord/lib/active_record/type/string.rb +40 -0
- data/rails/activerecord/lib/active_record/type/text.rb +11 -0
- data/rails/activerecord/lib/active_record/type/time.rb +26 -0
- data/rails/activerecord/lib/active_record/type/time_value.rb +38 -0
- data/rails/activerecord/lib/active_record/type/type_map.rb +64 -0
- data/rails/activerecord/lib/active_record/type/unsigned_integer.rb +15 -0
- data/rails/activerecord/lib/active_record/type/value.rb +105 -0
- data/rails/activerecord/lib/active_record/type.rb +23 -0
- data/rails/activerecord/lib/active_record/validations/associated.rb +51 -0
- data/rails/activerecord/lib/active_record/validations/presence.rb +67 -0
- data/rails/activerecord/lib/active_record/validations/uniqueness.rb +229 -0
- data/rails/activerecord/lib/active_record/validations.rb +90 -0
- data/rails/activerecord/lib/active_record/version.rb +8 -0
- data/rails/activerecord/lib/active_record.rb +173 -0
- data/rails/activerecord/lib/rails/generators/active_record/migration/migration_generator.rb +70 -0
- data/rails/activerecord/lib/rails/generators/active_record/migration/templates/create_table_migration.rb +19 -0
- data/rails/activerecord/lib/rails/generators/active_record/migration/templates/migration.rb +39 -0
- data/rails/activerecord/lib/rails/generators/active_record/migration.rb +18 -0
- data/rails/activerecord/lib/rails/generators/active_record/model/model_generator.rb +52 -0
- data/rails/activerecord/lib/rails/generators/active_record/model/templates/model.rb +10 -0
- data/rails/activerecord/lib/rails/generators/active_record/model/templates/module.rb +7 -0
- data/rails/activerecord/lib/rails/generators/active_record.rb +17 -0
- data/rails/activerecord/test/.gitignore +1 -0
- data/rails/activerecord/test/active_record/connection_adapters/fake_adapter.rb +46 -0
- data/rails/activerecord/test/assets/example.log +1 -0
- data/rails/activerecord/test/assets/flowers.jpg +0 -0
- data/rails/activerecord/test/assets/test.txt +1 -0
- data/rails/activerecord/test/cases/adapter_test.rb +261 -0
- data/rails/activerecord/test/cases/adapters/mysql/active_schema_test.rb +155 -0
- data/rails/activerecord/test/cases/adapters/mysql/case_sensitivity_test.rb +55 -0
- data/rails/activerecord/test/cases/adapters/mysql/connection_test.rb +184 -0
- data/rails/activerecord/test/cases/adapters/mysql/consistency_test.rb +49 -0
- data/rails/activerecord/test/cases/adapters/mysql/datetime_test.rb +87 -0
- data/rails/activerecord/test/cases/adapters/mysql/enum_test.rb +10 -0
- data/rails/activerecord/test/cases/adapters/mysql/mysql_adapter_test.rb +153 -0
- data/rails/activerecord/test/cases/adapters/mysql/quoting_test.rb +25 -0
- data/rails/activerecord/test/cases/adapters/mysql/reserved_word_test.rb +153 -0
- data/rails/activerecord/test/cases/adapters/mysql/schema_test.rb +100 -0
- data/rails/activerecord/test/cases/adapters/mysql/sp_test.rb +15 -0
- data/rails/activerecord/test/cases/adapters/mysql/sql_types_test.rb +14 -0
- data/rails/activerecord/test/cases/adapters/mysql/statement_pool_test.rb +23 -0
- data/rails/activerecord/test/cases/adapters/mysql/unsigned_type_test.rb +30 -0
- data/rails/activerecord/test/cases/adapters/mysql2/active_schema_test.rb +155 -0
- data/rails/activerecord/test/cases/adapters/mysql2/bind_parameter_test.rb +50 -0
- data/rails/activerecord/test/cases/adapters/mysql2/boolean_test.rb +92 -0
- data/rails/activerecord/test/cases/adapters/mysql2/case_sensitivity_test.rb +55 -0
- data/rails/activerecord/test/cases/adapters/mysql2/connection_test.rb +134 -0
- data/rails/activerecord/test/cases/adapters/mysql2/datetime_test.rb +87 -0
- data/rails/activerecord/test/cases/adapters/mysql2/enum_test.rb +10 -0
- data/rails/activerecord/test/cases/adapters/mysql2/explain_test.rb +27 -0
- data/rails/activerecord/test/cases/adapters/mysql2/reserved_word_test.rb +152 -0
- data/rails/activerecord/test/cases/adapters/mysql2/schema_migrations_test.rb +47 -0
- data/rails/activerecord/test/cases/adapters/mysql2/schema_test.rb +81 -0
- data/rails/activerecord/test/cases/adapters/mysql2/sql_types_test.rb +14 -0
- data/rails/activerecord/test/cases/adapters/mysql2/unsigned_type_test.rb +30 -0
- data/rails/activerecord/test/cases/adapters/postgresql/active_schema_test.rb +58 -0
- data/rails/activerecord/test/cases/adapters/postgresql/array_test.rb +295 -0
- data/rails/activerecord/test/cases/adapters/postgresql/bit_string_test.rb +78 -0
- data/rails/activerecord/test/cases/adapters/postgresql/bytea_test.rb +125 -0
- data/rails/activerecord/test/cases/adapters/postgresql/change_schema_test.rb +31 -0
- data/rails/activerecord/test/cases/adapters/postgresql/citext_test.rb +71 -0
- data/rails/activerecord/test/cases/adapters/postgresql/composite_test.rb +131 -0
- data/rails/activerecord/test/cases/adapters/postgresql/connection_test.rb +215 -0
- data/rails/activerecord/test/cases/adapters/postgresql/datatype_test.rb +126 -0
- data/rails/activerecord/test/cases/adapters/postgresql/domain_test.rb +47 -0
- data/rails/activerecord/test/cases/adapters/postgresql/enum_test.rb +83 -0
- data/rails/activerecord/test/cases/adapters/postgresql/explain_test.rb +26 -0
- data/rails/activerecord/test/cases/adapters/postgresql/extension_migration_test.rb +63 -0
- data/rails/activerecord/test/cases/adapters/postgresql/full_text_test.rb +26 -0
- data/rails/activerecord/test/cases/adapters/postgresql/geometric_test.rb +72 -0
- data/rails/activerecord/test/cases/adapters/postgresql/hstore_test.rb +345 -0
- data/rails/activerecord/test/cases/adapters/postgresql/infinity_test.rb +60 -0
- data/rails/activerecord/test/cases/adapters/postgresql/integer_test.rb +25 -0
- data/rails/activerecord/test/cases/adapters/postgresql/json_test.rb +206 -0
- data/rails/activerecord/test/cases/adapters/postgresql/ltree_test.rb +46 -0
- data/rails/activerecord/test/cases/adapters/postgresql/money_test.rb +96 -0
- data/rails/activerecord/test/cases/adapters/postgresql/network_test.rb +71 -0
- data/rails/activerecord/test/cases/adapters/postgresql/postgresql_adapter_test.rb +462 -0
- data/rails/activerecord/test/cases/adapters/postgresql/quoting_test.rb +74 -0
- data/rails/activerecord/test/cases/adapters/postgresql/range_test.rb +323 -0
- data/rails/activerecord/test/cases/adapters/postgresql/rename_table_test.rb +34 -0
- data/rails/activerecord/test/cases/adapters/postgresql/schema_authorization_test.rb +114 -0
- data/rails/activerecord/test/cases/adapters/postgresql/schema_test.rb +462 -0
- data/rails/activerecord/test/cases/adapters/postgresql/statement_pool_test.rb +41 -0
- data/rails/activerecord/test/cases/adapters/postgresql/timestamp_test.rb +170 -0
- data/rails/activerecord/test/cases/adapters/postgresql/type_lookup_test.rb +33 -0
- data/rails/activerecord/test/cases/adapters/postgresql/utils_test.rb +61 -0
- data/rails/activerecord/test/cases/adapters/postgresql/uuid_test.rb +315 -0
- data/rails/activerecord/test/cases/adapters/postgresql/view_test.rb +63 -0
- data/rails/activerecord/test/cases/adapters/postgresql/xml_test.rb +48 -0
- data/rails/activerecord/test/cases/adapters/sqlite3/copy_table_test.rb +98 -0
- data/rails/activerecord/test/cases/adapters/sqlite3/explain_test.rb +27 -0
- data/rails/activerecord/test/cases/adapters/sqlite3/quoting_test.rb +116 -0
- data/rails/activerecord/test/cases/adapters/sqlite3/sqlite3_adapter_test.rb +461 -0
- data/rails/activerecord/test/cases/adapters/sqlite3/sqlite3_create_folder_test.rb +21 -0
- data/rails/activerecord/test/cases/adapters/sqlite3/statement_pool_test.rb +25 -0
- data/rails/activerecord/test/cases/aggregations_test.rb +158 -0
- data/rails/activerecord/test/cases/ar_schema_test.rb +161 -0
- data/rails/activerecord/test/cases/associations/association_scope_test.rb +21 -0
- data/rails/activerecord/test/cases/associations/belongs_to_associations_test.rb +978 -0
- data/rails/activerecord/test/cases/associations/callbacks_test.rb +190 -0
- data/rails/activerecord/test/cases/associations/cascaded_eager_loading_test.rb +188 -0
- data/rails/activerecord/test/cases/associations/deprecated_counter_cache_on_has_many_through_test.rb +26 -0
- data/rails/activerecord/test/cases/associations/eager_load_includes_full_sti_class_test.rb +36 -0
- data/rails/activerecord/test/cases/associations/eager_load_nested_include_test.rb +128 -0
- data/rails/activerecord/test/cases/associations/eager_singularization_test.rb +148 -0
- data/rails/activerecord/test/cases/associations/eager_test.rb +1366 -0
- data/rails/activerecord/test/cases/associations/extension_test.rb +82 -0
- data/rails/activerecord/test/cases/associations/has_and_belongs_to_many_associations_test.rb +905 -0
- data/rails/activerecord/test/cases/associations/has_many_associations_test.rb +2099 -0
- data/rails/activerecord/test/cases/associations/has_many_through_associations_test.rb +1163 -0
- data/rails/activerecord/test/cases/associations/has_one_associations_test.rb +610 -0
- data/rails/activerecord/test/cases/associations/has_one_through_associations_test.rb +346 -0
- data/rails/activerecord/test/cases/associations/inner_join_association_test.rb +139 -0
- data/rails/activerecord/test/cases/associations/inverse_associations_test.rb +693 -0
- data/rails/activerecord/test/cases/associations/join_model_test.rb +751 -0
- data/rails/activerecord/test/cases/associations/nested_through_associations_test.rb +579 -0
- data/rails/activerecord/test/cases/associations/required_test.rb +82 -0
- data/rails/activerecord/test/cases/associations_test.rb +380 -0
- data/rails/activerecord/test/cases/attribute_decorators_test.rb +125 -0
- data/rails/activerecord/test/cases/attribute_methods/read_test.rb +60 -0
- data/rails/activerecord/test/cases/attribute_methods_test.rb +941 -0
- data/rails/activerecord/test/cases/attribute_set_test.rb +200 -0
- data/rails/activerecord/test/cases/attribute_test.rb +180 -0
- data/rails/activerecord/test/cases/attributes_test.rb +115 -0
- data/rails/activerecord/test/cases/autosave_association_test.rb +1588 -0
- data/rails/activerecord/test/cases/base_test.rb +1627 -0
- data/rails/activerecord/test/cases/batches_test.rb +212 -0
- data/rails/activerecord/test/cases/binary_test.rb +49 -0
- data/rails/activerecord/test/cases/bind_parameter_test.rb +100 -0
- data/rails/activerecord/test/cases/calculations_test.rb +634 -0
- data/rails/activerecord/test/cases/callbacks_test.rb +539 -0
- data/rails/activerecord/test/cases/clone_test.rb +40 -0
- data/rails/activerecord/test/cases/coders/yaml_column_test.rb +63 -0
- data/rails/activerecord/test/cases/column_alias_test.rb +17 -0
- data/rails/activerecord/test/cases/column_definition_test.rb +123 -0
- data/rails/activerecord/test/cases/connection_adapters/adapter_leasing_test.rb +54 -0
- data/rails/activerecord/test/cases/connection_adapters/connection_handler_test.rb +53 -0
- data/rails/activerecord/test/cases/connection_adapters/connection_specification_test.rb +12 -0
- data/rails/activerecord/test/cases/connection_adapters/merge_and_resolve_default_url_config_test.rb +293 -0
- data/rails/activerecord/test/cases/connection_adapters/mysql_type_lookup_test.rb +65 -0
- data/rails/activerecord/test/cases/connection_adapters/quoting_test.rb +13 -0
- data/rails/activerecord/test/cases/connection_adapters/schema_cache_test.rb +56 -0
- data/rails/activerecord/test/cases/connection_adapters/type_lookup_test.rb +106 -0
- data/rails/activerecord/test/cases/connection_management_test.rb +122 -0
- data/rails/activerecord/test/cases/connection_pool_test.rb +346 -0
- data/rails/activerecord/test/cases/connection_specification/resolver_test.rb +116 -0
- data/rails/activerecord/test/cases/core_test.rb +112 -0
- data/rails/activerecord/test/cases/counter_cache_test.rb +201 -0
- data/rails/activerecord/test/cases/custom_locking_test.rb +17 -0
- data/rails/activerecord/test/cases/database_statements_test.rb +19 -0
- data/rails/activerecord/test/cases/date_time_test.rb +61 -0
- data/rails/activerecord/test/cases/defaults_test.rb +223 -0
- data/rails/activerecord/test/cases/dirty_test.rb +759 -0
- data/rails/activerecord/test/cases/disconnected_test.rb +28 -0
- data/rails/activerecord/test/cases/dup_test.rb +157 -0
- data/rails/activerecord/test/cases/enum_test.rb +290 -0
- data/rails/activerecord/test/cases/explain_subscriber_test.rb +59 -0
- data/rails/activerecord/test/cases/explain_test.rb +76 -0
- data/rails/activerecord/test/cases/finder_respond_to_test.rb +60 -0
- data/rails/activerecord/test/cases/finder_test.rb +1163 -0
- data/rails/activerecord/test/cases/fixture_set/file_test.rb +138 -0
- data/rails/activerecord/test/cases/fixtures_test.rb +869 -0
- data/rails/activerecord/test/cases/forbidden_attributes_protection_test.rb +99 -0
- data/rails/activerecord/test/cases/habtm_destroy_order_test.rb +61 -0
- data/rails/activerecord/test/cases/helper.rb +210 -0
- data/rails/activerecord/test/cases/hot_compatibility_test.rb +54 -0
- data/rails/activerecord/test/cases/i18n_test.rb +45 -0
- data/rails/activerecord/test/cases/inheritance_test.rb +369 -0
- data/rails/activerecord/test/cases/integration_test.rb +139 -0
- data/rails/activerecord/test/cases/invalid_connection_test.rb +22 -0
- data/rails/activerecord/test/cases/invalid_date_test.rb +32 -0
- data/rails/activerecord/test/cases/invertible_migration_test.rb +295 -0
- data/rails/activerecord/test/cases/json_serialization_test.rb +300 -0
- data/rails/activerecord/test/cases/locking_test.rb +477 -0
- data/rails/activerecord/test/cases/log_subscriber_test.rb +136 -0
- data/rails/activerecord/test/cases/migration/change_schema_test.rb +450 -0
- data/rails/activerecord/test/cases/migration/change_table_test.rb +224 -0
- data/rails/activerecord/test/cases/migration/column_attributes_test.rb +185 -0
- data/rails/activerecord/test/cases/migration/column_positioning_test.rb +56 -0
- data/rails/activerecord/test/cases/migration/columns_test.rb +299 -0
- data/rails/activerecord/test/cases/migration/command_recorder_test.rb +305 -0
- data/rails/activerecord/test/cases/migration/create_join_table_test.rb +148 -0
- data/rails/activerecord/test/cases/migration/foreign_key_test.rb +250 -0
- data/rails/activerecord/test/cases/migration/helper.rb +39 -0
- data/rails/activerecord/test/cases/migration/index_test.rb +208 -0
- data/rails/activerecord/test/cases/migration/logger_test.rb +36 -0
- data/rails/activerecord/test/cases/migration/pending_migrations_test.rb +53 -0
- data/rails/activerecord/test/cases/migration/references_foreign_key_test.rb +111 -0
- data/rails/activerecord/test/cases/migration/references_index_test.rb +101 -0
- data/rails/activerecord/test/cases/migration/references_statements_test.rb +116 -0
- data/rails/activerecord/test/cases/migration/rename_table_test.rb +93 -0
- data/rails/activerecord/test/cases/migration/table_and_index_test.rb +24 -0
- data/rails/activerecord/test/cases/migration_test.rb +939 -0
- data/rails/activerecord/test/cases/migrator_test.rb +388 -0
- data/rails/activerecord/test/cases/mixin_test.rb +70 -0
- data/rails/activerecord/test/cases/modules_test.rb +173 -0
- data/rails/activerecord/test/cases/multiparameter_attributes_test.rb +350 -0
- data/rails/activerecord/test/cases/multiple_db_test.rb +115 -0
- data/rails/activerecord/test/cases/nested_attributes_test.rb +1057 -0
- data/rails/activerecord/test/cases/nested_attributes_with_callbacks_test.rb +144 -0
- data/rails/activerecord/test/cases/persistence_test.rb +881 -0
- data/rails/activerecord/test/cases/pooled_connections_test.rb +81 -0
- data/rails/activerecord/test/cases/primary_keys_test.rb +236 -0
- data/rails/activerecord/test/cases/query_cache_test.rb +322 -0
- data/rails/activerecord/test/cases/quoting_test.rb +156 -0
- data/rails/activerecord/test/cases/readonly_test.rb +118 -0
- data/rails/activerecord/test/cases/reaper_test.rb +85 -0
- data/rails/activerecord/test/cases/reflection_test.rb +454 -0
- data/rails/activerecord/test/cases/relation/delegation_test.rb +68 -0
- data/rails/activerecord/test/cases/relation/merging_test.rb +161 -0
- data/rails/activerecord/test/cases/relation/mutation_test.rb +165 -0
- data/rails/activerecord/test/cases/relation/predicate_builder_test.rb +14 -0
- data/rails/activerecord/test/cases/relation/where_chain_test.rb +181 -0
- data/rails/activerecord/test/cases/relation/where_test.rb +278 -0
- data/rails/activerecord/test/cases/relation_test.rb +267 -0
- data/rails/activerecord/test/cases/relations_test.rb +1756 -0
- data/rails/activerecord/test/cases/reload_models_test.rb +22 -0
- data/rails/activerecord/test/cases/result_test.rb +80 -0
- data/rails/activerecord/test/cases/sanitize_test.rb +83 -0
- data/rails/activerecord/test/cases/schema_dumper_test.rb +445 -0
- data/rails/activerecord/test/cases/scoping/default_scoping_test.rb +436 -0
- data/rails/activerecord/test/cases/scoping/named_scoping_test.rb +524 -0
- data/rails/activerecord/test/cases/scoping/relation_scoping_test.rb +357 -0
- data/rails/activerecord/test/cases/serialization_test.rb +104 -0
- data/rails/activerecord/test/cases/serialized_attribute_test.rb +267 -0
- data/rails/activerecord/test/cases/statement_cache_test.rb +98 -0
- data/rails/activerecord/test/cases/store_test.rb +194 -0
- data/rails/activerecord/test/cases/tasks/database_tasks_test.rb +380 -0
- data/rails/activerecord/test/cases/tasks/mysql_rake_test.rb +311 -0
- data/rails/activerecord/test/cases/tasks/postgresql_rake_test.rb +245 -0
- data/rails/activerecord/test/cases/tasks/sqlite_rake_test.rb +193 -0
- data/rails/activerecord/test/cases/test_case.rb +123 -0
- data/rails/activerecord/test/cases/timestamp_test.rb +446 -0
- data/rails/activerecord/test/cases/transaction_callbacks_test.rb +444 -0
- data/rails/activerecord/test/cases/transaction_isolation_test.rb +106 -0
- data/rails/activerecord/test/cases/transactions_test.rb +792 -0
- data/rails/activerecord/test/cases/type/decimal_test.rb +51 -0
- data/rails/activerecord/test/cases/type/integer_test.rb +121 -0
- data/rails/activerecord/test/cases/type/string_test.rb +36 -0
- data/rails/activerecord/test/cases/type/type_map_test.rb +177 -0
- data/rails/activerecord/test/cases/type/unsigned_integer_test.rb +18 -0
- data/rails/activerecord/test/cases/types_test.rb +141 -0
- data/rails/activerecord/test/cases/unconnected_test.rb +33 -0
- data/rails/activerecord/test/cases/validations/association_validation_test.rb +86 -0
- data/rails/activerecord/test/cases/validations/i18n_generate_message_validation_test.rb +84 -0
- data/rails/activerecord/test/cases/validations/i18n_validation_test.rb +90 -0
- data/rails/activerecord/test/cases/validations/length_validation_test.rb +47 -0
- data/rails/activerecord/test/cases/validations/presence_validation_test.rb +68 -0
- data/rails/activerecord/test/cases/validations/uniqueness_validation_test.rb +406 -0
- data/rails/activerecord/test/cases/validations_repair_helper.rb +23 -0
- data/rails/activerecord/test/cases/validations_test.rb +165 -0
- data/rails/activerecord/test/cases/view_test.rb +113 -0
- data/rails/activerecord/test/cases/xml_serialization_test.rb +447 -0
- data/rails/activerecord/test/cases/yaml_serialization_test.rb +86 -0
- data/rails/activerecord/test/config.example.yml +106 -0
- data/rails/activerecord/test/config.rb +5 -0
- data/rails/activerecord/test/fixtures/.gitignore +1 -0
- data/rails/activerecord/test/fixtures/accounts.yml +29 -0
- data/rails/activerecord/test/fixtures/admin/accounts.yml +2 -0
- data/rails/activerecord/test/fixtures/admin/randomly_named_a9.yml +7 -0
- data/rails/activerecord/test/fixtures/admin/randomly_named_b0.yml +7 -0
- data/rails/activerecord/test/fixtures/admin/users.yml +10 -0
- data/rails/activerecord/test/fixtures/all/developers.yml +0 -0
- data/rails/activerecord/test/fixtures/all/people.yml +0 -0
- data/rails/activerecord/test/fixtures/all/tasks.yml +0 -0
- data/rails/activerecord/test/fixtures/author_addresses.yml +5 -0
- data/rails/activerecord/test/fixtures/author_favorites.yml +4 -0
- data/rails/activerecord/test/fixtures/authors.yml +15 -0
- data/rails/activerecord/test/fixtures/binaries.yml +133 -0
- data/rails/activerecord/test/fixtures/books.yml +11 -0
- data/rails/activerecord/test/fixtures/bulbs.yml +5 -0
- data/rails/activerecord/test/fixtures/cars.yml +9 -0
- data/rails/activerecord/test/fixtures/categories/special_categories.yml +9 -0
- data/rails/activerecord/test/fixtures/categories/subsubdir/arbitrary_filename.yml +4 -0
- data/rails/activerecord/test/fixtures/categories.yml +19 -0
- data/rails/activerecord/test/fixtures/categories_ordered.yml +7 -0
- data/rails/activerecord/test/fixtures/categories_posts.yml +31 -0
- data/rails/activerecord/test/fixtures/categorizations.yml +23 -0
- data/rails/activerecord/test/fixtures/clubs.yml +8 -0
- data/rails/activerecord/test/fixtures/collections.yml +3 -0
- data/rails/activerecord/test/fixtures/colleges.yml +3 -0
- data/rails/activerecord/test/fixtures/comments.yml +65 -0
- data/rails/activerecord/test/fixtures/companies.yml +67 -0
- data/rails/activerecord/test/fixtures/computers.yml +10 -0
- data/rails/activerecord/test/fixtures/courses.yml +8 -0
- data/rails/activerecord/test/fixtures/customers.yml +26 -0
- data/rails/activerecord/test/fixtures/dashboards.yml +6 -0
- data/rails/activerecord/test/fixtures/developers.yml +22 -0
- data/rails/activerecord/test/fixtures/developers_projects.yml +17 -0
- data/rails/activerecord/test/fixtures/dog_lovers.yml +7 -0
- data/rails/activerecord/test/fixtures/dogs.yml +4 -0
- data/rails/activerecord/test/fixtures/edges.yml +5 -0
- data/rails/activerecord/test/fixtures/entrants.yml +14 -0
- data/rails/activerecord/test/fixtures/essays.yml +6 -0
- data/rails/activerecord/test/fixtures/faces.yml +11 -0
- data/rails/activerecord/test/fixtures/fk_test_has_fk.yml +3 -0
- data/rails/activerecord/test/fixtures/fk_test_has_pk.yml +2 -0
- data/rails/activerecord/test/fixtures/friendships.yml +4 -0
- data/rails/activerecord/test/fixtures/funny_jokes.yml +10 -0
- data/rails/activerecord/test/fixtures/interests.yml +33 -0
- data/rails/activerecord/test/fixtures/items.yml +3 -0
- data/rails/activerecord/test/fixtures/jobs.yml +7 -0
- data/rails/activerecord/test/fixtures/legacy_things.yml +3 -0
- data/rails/activerecord/test/fixtures/mateys.yml +4 -0
- data/rails/activerecord/test/fixtures/member_details.yml +8 -0
- data/rails/activerecord/test/fixtures/member_types.yml +6 -0
- data/rails/activerecord/test/fixtures/members.yml +11 -0
- data/rails/activerecord/test/fixtures/memberships.yml +34 -0
- data/rails/activerecord/test/fixtures/men.yml +5 -0
- data/rails/activerecord/test/fixtures/minimalistics.yml +2 -0
- data/rails/activerecord/test/fixtures/minivans.yml +5 -0
- data/rails/activerecord/test/fixtures/mixed_case_monkeys.yml +6 -0
- data/rails/activerecord/test/fixtures/mixins.yml +29 -0
- data/rails/activerecord/test/fixtures/movies.yml +7 -0
- data/rails/activerecord/test/fixtures/naked/csv/accounts.csv +1 -0
- data/rails/activerecord/test/fixtures/naked/yml/accounts.yml +1 -0
- data/rails/activerecord/test/fixtures/naked/yml/companies.yml +1 -0
- data/rails/activerecord/test/fixtures/naked/yml/courses.yml +1 -0
- data/rails/activerecord/test/fixtures/organizations.yml +5 -0
- data/rails/activerecord/test/fixtures/other_topics.yml +42 -0
- data/rails/activerecord/test/fixtures/owners.yml +9 -0
- data/rails/activerecord/test/fixtures/parrots.yml +27 -0
- data/rails/activerecord/test/fixtures/parrots_pirates.yml +7 -0
- data/rails/activerecord/test/fixtures/people.yml +24 -0
- data/rails/activerecord/test/fixtures/peoples_treasures.yml +3 -0
- data/rails/activerecord/test/fixtures/pets.yml +19 -0
- data/rails/activerecord/test/fixtures/pirates.yml +12 -0
- data/rails/activerecord/test/fixtures/posts.yml +80 -0
- data/rails/activerecord/test/fixtures/price_estimates.yml +7 -0
- data/rails/activerecord/test/fixtures/products.yml +4 -0
- data/rails/activerecord/test/fixtures/projects.yml +7 -0
- data/rails/activerecord/test/fixtures/randomly_named_a9.yml +7 -0
- data/rails/activerecord/test/fixtures/ratings.yml +14 -0
- data/rails/activerecord/test/fixtures/readers.yml +11 -0
- data/rails/activerecord/test/fixtures/references.yml +17 -0
- data/rails/activerecord/test/fixtures/reserved_words/distinct.yml +5 -0
- data/rails/activerecord/test/fixtures/reserved_words/distinct_select.yml +11 -0
- data/rails/activerecord/test/fixtures/reserved_words/group.yml +14 -0
- data/rails/activerecord/test/fixtures/reserved_words/select.yml +8 -0
- data/rails/activerecord/test/fixtures/reserved_words/values.yml +7 -0
- data/rails/activerecord/test/fixtures/ships.yml +6 -0
- data/rails/activerecord/test/fixtures/speedometers.yml +8 -0
- data/rails/activerecord/test/fixtures/sponsors.yml +12 -0
- data/rails/activerecord/test/fixtures/string_key_objects.yml +7 -0
- data/rails/activerecord/test/fixtures/subscribers.yml +11 -0
- data/rails/activerecord/test/fixtures/subscriptions.yml +12 -0
- data/rails/activerecord/test/fixtures/taggings.yml +78 -0
- data/rails/activerecord/test/fixtures/tags.yml +11 -0
- data/rails/activerecord/test/fixtures/tasks.yml +7 -0
- data/rails/activerecord/test/fixtures/teapots.yml +3 -0
- data/rails/activerecord/test/fixtures/to_be_linked/accounts.yml +2 -0
- data/rails/activerecord/test/fixtures/to_be_linked/users.yml +10 -0
- data/rails/activerecord/test/fixtures/topics.yml +49 -0
- data/rails/activerecord/test/fixtures/toys.yml +14 -0
- data/rails/activerecord/test/fixtures/traffic_lights.yml +10 -0
- data/rails/activerecord/test/fixtures/treasures.yml +10 -0
- data/rails/activerecord/test/fixtures/uuid_children.yml +3 -0
- data/rails/activerecord/test/fixtures/uuid_parents.yml +2 -0
- data/rails/activerecord/test/fixtures/variants.yml +4 -0
- data/rails/activerecord/test/fixtures/vegetables.yml +20 -0
- data/rails/activerecord/test/fixtures/vertices.yml +4 -0
- data/rails/activerecord/test/fixtures/warehouse-things.yml +3 -0
- data/rails/activerecord/test/fixtures/zines.yml +5 -0
- data/rails/activerecord/test/migrations/10_urban/9_add_expressions.rb +11 -0
- data/rails/activerecord/test/migrations/decimal/1_give_me_big_numbers.rb +15 -0
- data/rails/activerecord/test/migrations/empty/.gitkeep +0 -0
- data/rails/activerecord/test/migrations/magic/1_currencies_have_symbols.rb +12 -0
- data/rails/activerecord/test/migrations/missing/1000_people_have_middle_names.rb +9 -0
- data/rails/activerecord/test/migrations/missing/1_people_have_last_names.rb +9 -0
- data/rails/activerecord/test/migrations/missing/3_we_need_reminders.rb +12 -0
- data/rails/activerecord/test/migrations/missing/4_innocent_jointable.rb +12 -0
- data/rails/activerecord/test/migrations/rename/1_we_need_things.rb +11 -0
- data/rails/activerecord/test/migrations/rename/2_rename_things.rb +9 -0
- data/rails/activerecord/test/migrations/to_copy/1_people_have_hobbies.rb +9 -0
- data/rails/activerecord/test/migrations/to_copy/2_people_have_descriptions.rb +9 -0
- data/rails/activerecord/test/migrations/to_copy2/1_create_articles.rb +7 -0
- data/rails/activerecord/test/migrations/to_copy2/2_create_comments.rb +7 -0
- data/rails/activerecord/test/migrations/to_copy_with_name_collision/1_people_have_hobbies.rb +9 -0
- data/rails/activerecord/test/migrations/to_copy_with_timestamps/20090101010101_people_have_hobbies.rb +9 -0
- data/rails/activerecord/test/migrations/to_copy_with_timestamps/20090101010202_people_have_descriptions.rb +9 -0
- data/rails/activerecord/test/migrations/to_copy_with_timestamps2/20090101010101_create_articles.rb +7 -0
- data/rails/activerecord/test/migrations/to_copy_with_timestamps2/20090101010202_create_comments.rb +7 -0
- data/rails/activerecord/test/migrations/valid/1_valid_people_have_last_names.rb +9 -0
- data/rails/activerecord/test/migrations/valid/2_we_need_reminders.rb +12 -0
- data/rails/activerecord/test/migrations/valid/3_innocent_jointable.rb +12 -0
- data/rails/activerecord/test/migrations/valid_with_subdirectories/1_valid_people_have_last_names.rb +9 -0
- data/rails/activerecord/test/migrations/valid_with_subdirectories/sub/2_we_need_reminders.rb +12 -0
- data/rails/activerecord/test/migrations/valid_with_subdirectories/sub1/3_innocent_jointable.rb +12 -0
- data/rails/activerecord/test/migrations/valid_with_timestamps/20100101010101_valid_with_timestamps_people_have_last_names.rb +9 -0
- data/rails/activerecord/test/migrations/valid_with_timestamps/20100201010101_valid_with_timestamps_we_need_reminders.rb +12 -0
- data/rails/activerecord/test/migrations/valid_with_timestamps/20100301010101_valid_with_timestamps_innocent_jointable.rb +12 -0
- data/rails/activerecord/test/migrations/version_check/20131219224947_migration_version_check.rb +8 -0
- data/rails/activerecord/test/models/admin/account.rb +3 -0
- data/rails/activerecord/test/models/admin/randomly_named_c1.rb +3 -0
- data/rails/activerecord/test/models/admin/user.rb +40 -0
- data/rails/activerecord/test/models/admin.rb +5 -0
- data/rails/activerecord/test/models/aircraft.rb +4 -0
- data/rails/activerecord/test/models/arunit2_model.rb +3 -0
- data/rails/activerecord/test/models/author.rb +212 -0
- data/rails/activerecord/test/models/auto_id.rb +4 -0
- data/rails/activerecord/test/models/autoloadable/extra_firm.rb +2 -0
- data/rails/activerecord/test/models/binary.rb +2 -0
- data/rails/activerecord/test/models/bird.rb +12 -0
- data/rails/activerecord/test/models/book.rb +18 -0
- data/rails/activerecord/test/models/boolean.rb +2 -0
- data/rails/activerecord/test/models/bulb.rb +51 -0
- data/rails/activerecord/test/models/cake_designer.rb +3 -0
- data/rails/activerecord/test/models/car.rb +26 -0
- data/rails/activerecord/test/models/categorization.rb +19 -0
- data/rails/activerecord/test/models/category.rb +35 -0
- data/rails/activerecord/test/models/chef.rb +3 -0
- data/rails/activerecord/test/models/citation.rb +3 -0
- data/rails/activerecord/test/models/club.rb +23 -0
- data/rails/activerecord/test/models/college.rb +10 -0
- data/rails/activerecord/test/models/column.rb +3 -0
- data/rails/activerecord/test/models/column_name.rb +3 -0
- data/rails/activerecord/test/models/comment.rb +59 -0
- data/rails/activerecord/test/models/company.rb +225 -0
- data/rails/activerecord/test/models/company_in_module.rb +98 -0
- data/rails/activerecord/test/models/computer.rb +3 -0
- data/rails/activerecord/test/models/contact.rb +41 -0
- data/rails/activerecord/test/models/contract.rb +20 -0
- data/rails/activerecord/test/models/country.rb +7 -0
- data/rails/activerecord/test/models/course.rb +6 -0
- data/rails/activerecord/test/models/customer.rb +77 -0
- data/rails/activerecord/test/models/dashboard.rb +3 -0
- data/rails/activerecord/test/models/default.rb +2 -0
- data/rails/activerecord/test/models/department.rb +4 -0
- data/rails/activerecord/test/models/developer.rb +252 -0
- data/rails/activerecord/test/models/dog.rb +5 -0
- data/rails/activerecord/test/models/dog_lover.rb +5 -0
- data/rails/activerecord/test/models/drink_designer.rb +3 -0
- data/rails/activerecord/test/models/edge.rb +5 -0
- data/rails/activerecord/test/models/electron.rb +5 -0
- data/rails/activerecord/test/models/engine.rb +4 -0
- data/rails/activerecord/test/models/entrant.rb +3 -0
- data/rails/activerecord/test/models/essay.rb +5 -0
- data/rails/activerecord/test/models/event.rb +3 -0
- data/rails/activerecord/test/models/eye.rb +37 -0
- data/rails/activerecord/test/models/face.rb +9 -0
- data/rails/activerecord/test/models/friendship.rb +6 -0
- data/rails/activerecord/test/models/guid.rb +2 -0
- data/rails/activerecord/test/models/hotel.rb +6 -0
- data/rails/activerecord/test/models/image.rb +3 -0
- data/rails/activerecord/test/models/interest.rb +5 -0
- data/rails/activerecord/test/models/invoice.rb +4 -0
- data/rails/activerecord/test/models/item.rb +7 -0
- data/rails/activerecord/test/models/job.rb +7 -0
- data/rails/activerecord/test/models/joke.rb +7 -0
- data/rails/activerecord/test/models/keyboard.rb +3 -0
- data/rails/activerecord/test/models/legacy_thing.rb +3 -0
- data/rails/activerecord/test/models/lesson.rb +11 -0
- data/rails/activerecord/test/models/line_item.rb +3 -0
- data/rails/activerecord/test/models/liquid.rb +4 -0
- data/rails/activerecord/test/models/man.rb +11 -0
- data/rails/activerecord/test/models/matey.rb +4 -0
- data/rails/activerecord/test/models/member.rb +38 -0
- data/rails/activerecord/test/models/member_detail.rb +7 -0
- data/rails/activerecord/test/models/member_type.rb +3 -0
- data/rails/activerecord/test/models/membership.rb +20 -0
- data/rails/activerecord/test/models/minimalistic.rb +2 -0
- data/rails/activerecord/test/models/minivan.rb +9 -0
- data/rails/activerecord/test/models/mixed_case_monkey.rb +3 -0
- data/rails/activerecord/test/models/molecule.rb +6 -0
- data/rails/activerecord/test/models/movie.rb +5 -0
- data/rails/activerecord/test/models/order.rb +4 -0
- data/rails/activerecord/test/models/organization.rb +14 -0
- data/rails/activerecord/test/models/owner.rb +34 -0
- data/rails/activerecord/test/models/parrot.rb +29 -0
- data/rails/activerecord/test/models/person.rb +143 -0
- data/rails/activerecord/test/models/personal_legacy_thing.rb +4 -0
- data/rails/activerecord/test/models/pet.rb +15 -0
- data/rails/activerecord/test/models/pirate.rb +92 -0
- data/rails/activerecord/test/models/possession.rb +3 -0
- data/rails/activerecord/test/models/post.rb +243 -0
- data/rails/activerecord/test/models/price_estimate.rb +4 -0
- data/rails/activerecord/test/models/project.rb +29 -0
- data/rails/activerecord/test/models/publisher/article.rb +4 -0
- data/rails/activerecord/test/models/publisher/magazine.rb +3 -0
- data/rails/activerecord/test/models/publisher.rb +2 -0
- data/rails/activerecord/test/models/randomly_named_c1.rb +3 -0
- data/rails/activerecord/test/models/rating.rb +4 -0
- data/rails/activerecord/test/models/reader.rb +23 -0
- data/rails/activerecord/test/models/record.rb +2 -0
- data/rails/activerecord/test/models/reference.rb +22 -0
- data/rails/activerecord/test/models/reply.rb +61 -0
- data/rails/activerecord/test/models/ship.rb +26 -0
- data/rails/activerecord/test/models/ship_part.rb +8 -0
- data/rails/activerecord/test/models/shop.rb +17 -0
- data/rails/activerecord/test/models/speedometer.rb +6 -0
- data/rails/activerecord/test/models/sponsor.rb +7 -0
- data/rails/activerecord/test/models/string_key_object.rb +3 -0
- data/rails/activerecord/test/models/student.rb +4 -0
- data/rails/activerecord/test/models/subject.rb +16 -0
- data/rails/activerecord/test/models/subscriber.rb +8 -0
- data/rails/activerecord/test/models/subscription.rb +4 -0
- data/rails/activerecord/test/models/tag.rb +7 -0
- data/rails/activerecord/test/models/tagging.rb +13 -0
- data/rails/activerecord/test/models/task.rb +5 -0
- data/rails/activerecord/test/models/topic.rb +124 -0
- data/rails/activerecord/test/models/toy.rb +6 -0
- data/rails/activerecord/test/models/traffic_light.rb +4 -0
- data/rails/activerecord/test/models/treasure.rb +13 -0
- data/rails/activerecord/test/models/treaty.rb +7 -0
- data/rails/activerecord/test/models/tyre.rb +11 -0
- data/rails/activerecord/test/models/uuid_child.rb +3 -0
- data/rails/activerecord/test/models/uuid_parent.rb +3 -0
- data/rails/activerecord/test/models/vegetables.rb +24 -0
- data/rails/activerecord/test/models/vertex.rb +9 -0
- data/rails/activerecord/test/models/warehouse_thing.rb +5 -0
- data/rails/activerecord/test/models/wheel.rb +3 -0
- data/rails/activerecord/test/models/without_table.rb +3 -0
- data/rails/activerecord/test/models/zine.rb +3 -0
- data/rails/activerecord/test/schema/mysql2_specific_schema.rb +58 -0
- data/rails/activerecord/test/schema/mysql_specific_schema.rb +70 -0
- data/rails/activerecord/test/schema/oracle_specific_schema.rb +43 -0
- data/rails/activerecord/test/schema/postgresql_specific_schema.rb +198 -0
- data/rails/activerecord/test/schema/schema.rb +905 -0
- data/rails/activerecord/test/schema/sqlite_specific_schema.rb +22 -0
- data/rails/activerecord/test/support/config.rb +43 -0
- data/rails/activerecord/test/support/connection.rb +21 -0
- data/rails/activerecord/test/support/connection_helper.rb +14 -0
- data/rails/activerecord/test/support/ddl_helper.rb +8 -0
- data/rails/activerecord/test/support/schema_dumping_helper.rb +20 -0
- data/rails/activesupport/CHANGELOG.md +418 -0
- data/rails/activesupport/MIT-LICENSE +20 -0
- data/rails/activesupport/README.rdoc +40 -0
- data/rails/activesupport/Rakefile +32 -0
- data/rails/activesupport/activesupport.gemspec +28 -0
- data/rails/activesupport/bin/generate_tables +144 -0
- data/rails/activesupport/lib/active_support/all.rb +3 -0
- data/rails/activesupport/lib/active_support/backtrace_cleaner.rb +103 -0
- data/rails/activesupport/lib/active_support/benchmarkable.rb +49 -0
- data/rails/activesupport/lib/active_support/builder.rb +6 -0
- data/rails/activesupport/lib/active_support/cache/file_store.rb +190 -0
- data/rails/activesupport/lib/active_support/cache/mem_cache_store.rb +198 -0
- data/rails/activesupport/lib/active_support/cache/memory_store.rb +172 -0
- data/rails/activesupport/lib/active_support/cache/null_store.rb +44 -0
- data/rails/activesupport/lib/active_support/cache/strategy/local_cache.rb +161 -0
- data/rails/activesupport/lib/active_support/cache/strategy/local_cache_middleware.rb +44 -0
- data/rails/activesupport/lib/active_support/cache.rb +717 -0
- data/rails/activesupport/lib/active_support/callbacks.rb +793 -0
- data/rails/activesupport/lib/active_support/concern.rb +142 -0
- data/rails/activesupport/lib/active_support/concurrency/latch.rb +27 -0
- data/rails/activesupport/lib/active_support/configurable.rb +147 -0
- data/rails/activesupport/lib/active_support/core_ext/array/access.rb +64 -0
- data/rails/activesupport/lib/active_support/core_ext/array/conversions.rb +209 -0
- data/rails/activesupport/lib/active_support/core_ext/array/extract_options.rb +29 -0
- data/rails/activesupport/lib/active_support/core_ext/array/grouping.rb +116 -0
- data/rails/activesupport/lib/active_support/core_ext/array/prepend_and_append.rb +7 -0
- data/rails/activesupport/lib/active_support/core_ext/array/wrap.rb +45 -0
- data/rails/activesupport/lib/active_support/core_ext/array.rb +6 -0
- data/rails/activesupport/lib/active_support/core_ext/benchmark.rb +14 -0
- data/rails/activesupport/lib/active_support/core_ext/big_decimal/conversions.rb +16 -0
- data/rails/activesupport/lib/active_support/core_ext/big_decimal/yaml_conversions.rb +14 -0
- data/rails/activesupport/lib/active_support/core_ext/big_decimal.rb +1 -0
- data/rails/activesupport/lib/active_support/core_ext/class/attribute.rb +127 -0
- data/rails/activesupport/lib/active_support/core_ext/class/attribute_accessors.rb +4 -0
- data/rails/activesupport/lib/active_support/core_ext/class/delegating_attributes.rb +45 -0
- data/rails/activesupport/lib/active_support/core_ext/class/subclasses.rb +42 -0
- data/rails/activesupport/lib/active_support/core_ext/class.rb +3 -0
- data/rails/activesupport/lib/active_support/core_ext/date/acts_like.rb +8 -0
- data/rails/activesupport/lib/active_support/core_ext/date/calculations.rb +143 -0
- data/rails/activesupport/lib/active_support/core_ext/date/conversions.rb +88 -0
- data/rails/activesupport/lib/active_support/core_ext/date/zones.rb +6 -0
- data/rails/activesupport/lib/active_support/core_ext/date.rb +5 -0
- data/rails/activesupport/lib/active_support/core_ext/date_and_time/calculations.rb +251 -0
- data/rails/activesupport/lib/active_support/core_ext/date_and_time/zones.rb +41 -0
- data/rails/activesupport/lib/active_support/core_ext/date_time/acts_like.rb +14 -0
- data/rails/activesupport/lib/active_support/core_ext/date_time/calculations.rb +173 -0
- data/rails/activesupport/lib/active_support/core_ext/date_time/conversions.rb +103 -0
- data/rails/activesupport/lib/active_support/core_ext/date_time/zones.rb +6 -0
- data/rails/activesupport/lib/active_support/core_ext/date_time.rb +4 -0
- data/rails/activesupport/lib/active_support/core_ext/digest/uuid.rb +51 -0
- data/rails/activesupport/lib/active_support/core_ext/enumerable.rb +80 -0
- data/rails/activesupport/lib/active_support/core_ext/file/atomic.rb +63 -0
- data/rails/activesupport/lib/active_support/core_ext/file.rb +1 -0
- data/rails/activesupport/lib/active_support/core_ext/hash/compact.rb +20 -0
- data/rails/activesupport/lib/active_support/core_ext/hash/conversions.rb +243 -0
- data/rails/activesupport/lib/active_support/core_ext/hash/deep_merge.rb +38 -0
- data/rails/activesupport/lib/active_support/core_ext/hash/except.rb +21 -0
- data/rails/activesupport/lib/active_support/core_ext/hash/indifferent_access.rb +23 -0
- data/rails/activesupport/lib/active_support/core_ext/hash/keys.rb +166 -0
- data/rails/activesupport/lib/active_support/core_ext/hash/reverse_merge.rb +22 -0
- data/rails/activesupport/lib/active_support/core_ext/hash/slice.rb +48 -0
- data/rails/activesupport/lib/active_support/core_ext/hash/transform_values.rb +23 -0
- data/rails/activesupport/lib/active_support/core_ext/hash.rb +9 -0
- data/rails/activesupport/lib/active_support/core_ext/integer/inflections.rb +29 -0
- data/rails/activesupport/lib/active_support/core_ext/integer/multiple.rb +10 -0
- data/rails/activesupport/lib/active_support/core_ext/integer/time.rb +44 -0
- data/rails/activesupport/lib/active_support/core_ext/integer.rb +3 -0
- data/rails/activesupport/lib/active_support/core_ext/kernel/agnostics.rb +11 -0
- data/rails/activesupport/lib/active_support/core_ext/kernel/concern.rb +10 -0
- data/rails/activesupport/lib/active_support/core_ext/kernel/debugger.rb +10 -0
- data/rails/activesupport/lib/active_support/core_ext/kernel/reporting.rb +124 -0
- data/rails/activesupport/lib/active_support/core_ext/kernel/singleton_class.rb +6 -0
- data/rails/activesupport/lib/active_support/core_ext/kernel.rb +5 -0
- data/rails/activesupport/lib/active_support/core_ext/load_error.rb +28 -0
- data/rails/activesupport/lib/active_support/core_ext/marshal.rb +21 -0
- data/rails/activesupport/lib/active_support/core_ext/module/aliasing.rb +69 -0
- data/rails/activesupport/lib/active_support/core_ext/module/anonymous.rb +19 -0
- data/rails/activesupport/lib/active_support/core_ext/module/attr_internal.rb +39 -0
- data/rails/activesupport/lib/active_support/core_ext/module/attribute_accessors.rb +212 -0
- data/rails/activesupport/lib/active_support/core_ext/module/concerning.rb +135 -0
- data/rails/activesupport/lib/active_support/core_ext/module/delegation.rb +217 -0
- data/rails/activesupport/lib/active_support/core_ext/module/deprecation.rb +23 -0
- data/rails/activesupport/lib/active_support/core_ext/module/introspection.rb +62 -0
- data/rails/activesupport/lib/active_support/core_ext/module/method_transplanting.rb +11 -0
- data/rails/activesupport/lib/active_support/core_ext/module/qualified_const.rb +52 -0
- data/rails/activesupport/lib/active_support/core_ext/module/reachable.rb +8 -0
- data/rails/activesupport/lib/active_support/core_ext/module/remove_method.rb +12 -0
- data/rails/activesupport/lib/active_support/core_ext/module.rb +11 -0
- data/rails/activesupport/lib/active_support/core_ext/name_error.rb +18 -0
- data/rails/activesupport/lib/active_support/core_ext/numeric/bytes.rb +44 -0
- data/rails/activesupport/lib/active_support/core_ext/numeric/conversions.rb +135 -0
- data/rails/activesupport/lib/active_support/core_ext/numeric/time.rb +69 -0
- data/rails/activesupport/lib/active_support/core_ext/numeric.rb +3 -0
- data/rails/activesupport/lib/active_support/core_ext/object/acts_like.rb +10 -0
- data/rails/activesupport/lib/active_support/core_ext/object/blank.rb +131 -0
- data/rails/activesupport/lib/active_support/core_ext/object/conversions.rb +4 -0
- data/rails/activesupport/lib/active_support/core_ext/object/deep_dup.rb +46 -0
- data/rails/activesupport/lib/active_support/core_ext/object/duplicable.rb +103 -0
- data/rails/activesupport/lib/active_support/core_ext/object/inclusion.rb +27 -0
- data/rails/activesupport/lib/active_support/core_ext/object/instance_variables.rb +28 -0
- data/rails/activesupport/lib/active_support/core_ext/object/itself.rb +15 -0
- data/rails/activesupport/lib/active_support/core_ext/object/json.rb +197 -0
- data/rails/activesupport/lib/active_support/core_ext/object/to_param.rb +1 -0
- data/rails/activesupport/lib/active_support/core_ext/object/to_query.rb +84 -0
- data/rails/activesupport/lib/active_support/core_ext/object/try.rb +100 -0
- data/rails/activesupport/lib/active_support/core_ext/object/with_options.rb +69 -0
- data/rails/activesupport/lib/active_support/core_ext/object.rb +15 -0
- data/rails/activesupport/lib/active_support/core_ext/range/conversions.rb +19 -0
- data/rails/activesupport/lib/active_support/core_ext/range/each.rb +23 -0
- data/rails/activesupport/lib/active_support/core_ext/range/include_range.rb +23 -0
- data/rails/activesupport/lib/active_support/core_ext/range/overlaps.rb +8 -0
- data/rails/activesupport/lib/active_support/core_ext/range.rb +4 -0
- data/rails/activesupport/lib/active_support/core_ext/regexp.rb +5 -0
- data/rails/activesupport/lib/active_support/core_ext/string/access.rb +104 -0
- data/rails/activesupport/lib/active_support/core_ext/string/behavior.rb +6 -0
- data/rails/activesupport/lib/active_support/core_ext/string/conversions.rb +56 -0
- data/rails/activesupport/lib/active_support/core_ext/string/exclude.rb +11 -0
- data/rails/activesupport/lib/active_support/core_ext/string/filters.rb +102 -0
- data/rails/activesupport/lib/active_support/core_ext/string/indent.rb +43 -0
- data/rails/activesupport/lib/active_support/core_ext/string/inflections.rb +217 -0
- data/rails/activesupport/lib/active_support/core_ext/string/inquiry.rb +13 -0
- data/rails/activesupport/lib/active_support/core_ext/string/multibyte.rb +49 -0
- data/rails/activesupport/lib/active_support/core_ext/string/output_safety.rb +262 -0
- data/rails/activesupport/lib/active_support/core_ext/string/starts_ends_with.rb +4 -0
- data/rails/activesupport/lib/active_support/core_ext/string/strip.rb +26 -0
- data/rails/activesupport/lib/active_support/core_ext/string/zones.rb +14 -0
- data/rails/activesupport/lib/active_support/core_ext/string.rb +13 -0
- data/rails/activesupport/lib/active_support/core_ext/struct.rb +6 -0
- data/rails/activesupport/lib/active_support/core_ext/thread.rb +86 -0
- data/rails/activesupport/lib/active_support/core_ext/time/acts_like.rb +8 -0
- data/rails/activesupport/lib/active_support/core_ext/time/calculations.rb +265 -0
- data/rails/activesupport/lib/active_support/core_ext/time/conversions.rb +65 -0
- data/rails/activesupport/lib/active_support/core_ext/time/marshal.rb +30 -0
- data/rails/activesupport/lib/active_support/core_ext/time/zones.rb +79 -0
- data/rails/activesupport/lib/active_support/core_ext/time.rb +5 -0
- data/rails/activesupport/lib/active_support/core_ext/uri.rb +26 -0
- data/rails/activesupport/lib/active_support/core_ext.rb +3 -0
- data/rails/activesupport/lib/active_support/dependencies/autoload.rb +77 -0
- data/rails/activesupport/lib/active_support/dependencies.rb +762 -0
- data/rails/activesupport/lib/active_support/deprecation/behaviors.rb +76 -0
- data/rails/activesupport/lib/active_support/deprecation/instance_delegator.rb +24 -0
- data/rails/activesupport/lib/active_support/deprecation/method_wrappers.rb +44 -0
- data/rails/activesupport/lib/active_support/deprecation/proxy_wrappers.rb +126 -0
- data/rails/activesupport/lib/active_support/deprecation/reporting.rb +94 -0
- data/rails/activesupport/lib/active_support/deprecation.rb +43 -0
- data/rails/activesupport/lib/active_support/descendants_tracker.rb +60 -0
- data/rails/activesupport/lib/active_support/duration.rb +136 -0
- data/rails/activesupport/lib/active_support/file_update_checker.rb +137 -0
- data/rails/activesupport/lib/active_support/gem_version.rb +15 -0
- data/rails/activesupport/lib/active_support/gzip.rb +36 -0
- data/rails/activesupport/lib/active_support/hash_with_indifferent_access.rb +281 -0
- data/rails/activesupport/lib/active_support/i18n.rb +13 -0
- data/rails/activesupport/lib/active_support/i18n_railtie.rb +94 -0
- data/rails/activesupport/lib/active_support/inflections.rb +70 -0
- data/rails/activesupport/lib/active_support/inflector/inflections.rb +211 -0
- data/rails/activesupport/lib/active_support/inflector/methods.rb +383 -0
- data/rails/activesupport/lib/active_support/inflector/transliterate.rb +97 -0
- data/rails/activesupport/lib/active_support/inflector.rb +7 -0
- data/rails/activesupport/lib/active_support/json/decoding.rb +73 -0
- data/rails/activesupport/lib/active_support/json/encoding.rb +172 -0
- data/rails/activesupport/lib/active_support/json.rb +2 -0
- data/rails/activesupport/lib/active_support/key_generator.rb +73 -0
- data/rails/activesupport/lib/active_support/lazy_load_hooks.rb +48 -0
- data/rails/activesupport/lib/active_support/locale/en.yml +133 -0
- data/rails/activesupport/lib/active_support/log_subscriber/test_helper.rb +104 -0
- data/rails/activesupport/lib/active_support/log_subscriber.rb +109 -0
- data/rails/activesupport/lib/active_support/logger.rb +57 -0
- data/rails/activesupport/lib/active_support/logger_silence.rb +24 -0
- data/rails/activesupport/lib/active_support/message_encryptor.rb +107 -0
- data/rails/activesupport/lib/active_support/message_verifier.rb +72 -0
- data/rails/activesupport/lib/active_support/multibyte/chars.rb +222 -0
- data/rails/activesupport/lib/active_support/multibyte/unicode.rb +390 -0
- data/rails/activesupport/lib/active_support/multibyte.rb +21 -0
- data/rails/activesupport/lib/active_support/notifications/fanout.rb +157 -0
- data/rails/activesupport/lib/active_support/notifications/instrumenter.rb +73 -0
- data/rails/activesupport/lib/active_support/notifications.rb +212 -0
- data/rails/activesupport/lib/active_support/number_helper/number_converter.rb +182 -0
- data/rails/activesupport/lib/active_support/number_helper/number_to_currency_converter.rb +46 -0
- data/rails/activesupport/lib/active_support/number_helper/number_to_delimited_converter.rb +23 -0
- data/rails/activesupport/lib/active_support/number_helper/number_to_human_converter.rb +66 -0
- data/rails/activesupport/lib/active_support/number_helper/number_to_human_size_converter.rb +58 -0
- data/rails/activesupport/lib/active_support/number_helper/number_to_percentage_converter.rb +12 -0
- data/rails/activesupport/lib/active_support/number_helper/number_to_phone_converter.rb +49 -0
- data/rails/activesupport/lib/active_support/number_helper/number_to_rounded_converter.rb +87 -0
- data/rails/activesupport/lib/active_support/number_helper.rb +345 -0
- data/rails/activesupport/lib/active_support/option_merger.rb +25 -0
- data/rails/activesupport/lib/active_support/ordered_hash.rb +48 -0
- data/rails/activesupport/lib/active_support/ordered_options.rb +67 -0
- data/rails/activesupport/lib/active_support/per_thread_registry.rb +53 -0
- data/rails/activesupport/lib/active_support/proxy_object.rb +13 -0
- data/rails/activesupport/lib/active_support/rails.rb +27 -0
- data/rails/activesupport/lib/active_support/railtie.rb +46 -0
- data/rails/activesupport/lib/active_support/rescuable.rb +119 -0
- data/rails/activesupport/lib/active_support/security_utils.rb +20 -0
- data/rails/activesupport/lib/active_support/string_inquirer.rb +26 -0
- data/rails/activesupport/lib/active_support/subscriber.rb +125 -0
- data/rails/activesupport/lib/active_support/tagged_logging.rb +76 -0
- data/rails/activesupport/lib/active_support/test_case.rb +100 -0
- data/rails/activesupport/lib/active_support/testing/assertions.rb +97 -0
- data/rails/activesupport/lib/active_support/testing/autorun.rb +5 -0
- data/rails/activesupport/lib/active_support/testing/constant_lookup.rb +50 -0
- data/rails/activesupport/lib/active_support/testing/declarative.rb +26 -0
- data/rails/activesupport/lib/active_support/testing/deprecation.rb +35 -0
- data/rails/activesupport/lib/active_support/testing/isolation.rb +101 -0
- data/rails/activesupport/lib/active_support/testing/setup_and_teardown.rb +50 -0
- data/rails/activesupport/lib/active_support/testing/tagged_logging.rb +25 -0
- data/rails/activesupport/lib/active_support/testing/time_helpers.rb +131 -0
- data/rails/activesupport/lib/active_support/time.rb +18 -0
- data/rails/activesupport/lib/active_support/time_with_zone.rb +409 -0
- data/rails/activesupport/lib/active_support/values/time_zone.rb +428 -0
- data/rails/activesupport/lib/active_support/values/unicode_tables.dat +0 -0
- data/rails/activesupport/lib/active_support/version.rb +8 -0
- data/rails/activesupport/lib/active_support/xml_mini/jdom.rb +180 -0
- data/rails/activesupport/lib/active_support/xml_mini/libxml.rb +79 -0
- data/rails/activesupport/lib/active_support/xml_mini/libxmlsax.rb +85 -0
- data/rails/activesupport/lib/active_support/xml_mini/nokogiri.rb +83 -0
- data/rails/activesupport/lib/active_support/xml_mini/nokogirisax.rb +87 -0
- data/rails/activesupport/lib/active_support/xml_mini/rexml.rb +129 -0
- data/rails/activesupport/lib/active_support/xml_mini.rb +191 -0
- data/rails/activesupport/lib/active_support.rb +85 -0
- data/rails/activesupport/test/abstract_unit.rb +45 -0
- data/rails/activesupport/test/autoload_test.rb +81 -0
- data/rails/activesupport/test/autoloading_fixtures/a/b.rb +2 -0
- data/rails/activesupport/test/autoloading_fixtures/a/c/d.rb +2 -0
- data/rails/activesupport/test/autoloading_fixtures/a/c/e/f.rb +2 -0
- data/rails/activesupport/test/autoloading_fixtures/application.rb +1 -0
- data/rails/activesupport/test/autoloading_fixtures/circular1.rb +6 -0
- data/rails/activesupport/test/autoloading_fixtures/circular2.rb +4 -0
- data/rails/activesupport/test/autoloading_fixtures/class_folder/class_folder_subclass.rb +3 -0
- data/rails/activesupport/test/autoloading_fixtures/class_folder/inline_class.rb +2 -0
- data/rails/activesupport/test/autoloading_fixtures/class_folder/nested_class.rb +7 -0
- data/rails/activesupport/test/autoloading_fixtures/class_folder.rb +3 -0
- data/rails/activesupport/test/autoloading_fixtures/conflict.rb +1 -0
- data/rails/activesupport/test/autoloading_fixtures/counting_loader.rb +5 -0
- data/rails/activesupport/test/autoloading_fixtures/cross_site_dependency.rb +2 -0
- data/rails/activesupport/test/autoloading_fixtures/e.rb +2 -0
- data/rails/activesupport/test/autoloading_fixtures/html/some_class.rb +4 -0
- data/rails/activesupport/test/autoloading_fixtures/load_path/loaded_constant.rb +3 -0
- data/rails/activesupport/test/autoloading_fixtures/loads_constant.rb +5 -0
- data/rails/activesupport/test/autoloading_fixtures/module_folder/inline_class.rb +2 -0
- data/rails/activesupport/test/autoloading_fixtures/module_folder/nested_class.rb +4 -0
- data/rails/activesupport/test/autoloading_fixtures/module_folder/nested_sibling.rb +2 -0
- data/rails/activesupport/test/autoloading_fixtures/module_with_custom_const_missing/a/b.rb +1 -0
- data/rails/activesupport/test/autoloading_fixtures/multiple_constant_file.rb +2 -0
- data/rails/activesupport/test/autoloading_fixtures/raises_name_error.rb +3 -0
- data/rails/activesupport/test/autoloading_fixtures/raises_no_method_error.rb +3 -0
- data/rails/activesupport/test/autoloading_fixtures/requires_constant.rb +5 -0
- data/rails/activesupport/test/autoloading_fixtures/should_not_be_required.rb +1 -0
- data/rails/activesupport/test/autoloading_fixtures/typo.rb +2 -0
- data/rails/activesupport/test/benchmarkable_test.rb +62 -0
- data/rails/activesupport/test/broadcast_logger_test.rb +82 -0
- data/rails/activesupport/test/caching_test.rb +1076 -0
- data/rails/activesupport/test/callback_inheritance_test.rb +176 -0
- data/rails/activesupport/test/callbacks_test.rb +1003 -0
- data/rails/activesupport/test/class_cache_test.rb +78 -0
- data/rails/activesupport/test/clean_backtrace_test.rb +75 -0
- data/rails/activesupport/test/clean_logger_test.rb +29 -0
- data/rails/activesupport/test/concern_test.rb +104 -0
- data/rails/activesupport/test/configurable_test.rb +123 -0
- data/rails/activesupport/test/constantize_test_cases.rb +116 -0
- data/rails/activesupport/test/core_ext/array/access_test.rb +30 -0
- data/rails/activesupport/test/core_ext/array/conversions_test.rb +197 -0
- data/rails/activesupport/test/core_ext/array/extract_options_test.rb +45 -0
- data/rails/activesupport/test/core_ext/array/grouping_test.rb +126 -0
- data/rails/activesupport/test/core_ext/array/prepend_append_test.rb +12 -0
- data/rails/activesupport/test/core_ext/array/wrap_test.rb +77 -0
- data/rails/activesupport/test/core_ext/big_decimal/yaml_conversions_test.rb +11 -0
- data/rails/activesupport/test/core_ext/bigdecimal_test.rb +9 -0
- data/rails/activesupport/test/core_ext/class/attribute_test.rb +91 -0
- data/rails/activesupport/test/core_ext/class/delegating_attributes_test.rb +122 -0
- data/rails/activesupport/test/core_ext/class_test.rb +28 -0
- data/rails/activesupport/test/core_ext/date_and_time_behavior.rb +241 -0
- data/rails/activesupport/test/core_ext/date_ext_test.rb +373 -0
- data/rails/activesupport/test/core_ext/date_time_ext_test.rb +358 -0
- data/rails/activesupport/test/core_ext/digest/uuid_test.rb +24 -0
- data/rails/activesupport/test/core_ext/duration_test.rb +223 -0
- data/rails/activesupport/test/core_ext/enumerable_test.rb +106 -0
- data/rails/activesupport/test/core_ext/file_test.rb +68 -0
- data/rails/activesupport/test/core_ext/hash/transform_keys_test.rb +32 -0
- data/rails/activesupport/test/core_ext/hash/transform_values_test.rb +61 -0
- data/rails/activesupport/test/core_ext/hash_ext_test.rb +1688 -0
- data/rails/activesupport/test/core_ext/integer_ext_test.rb +30 -0
- data/rails/activesupport/test/core_ext/kernel/concern_test.rb +13 -0
- data/rails/activesupport/test/core_ext/kernel_test.rb +138 -0
- data/rails/activesupport/test/core_ext/load_error_test.rb +41 -0
- data/rails/activesupport/test/core_ext/marshal_test.rb +124 -0
- data/rails/activesupport/test/core_ext/module/anonymous_test.rb +14 -0
- data/rails/activesupport/test/core_ext/module/attr_internal_test.rb +53 -0
- data/rails/activesupport/test/core_ext/module/attribute_accessor_test.rb +79 -0
- data/rails/activesupport/test/core_ext/module/attribute_aliasing_test.rb +59 -0
- data/rails/activesupport/test/core_ext/module/concerning_test.rb +65 -0
- data/rails/activesupport/test/core_ext/module/qualified_const_test.rb +108 -0
- data/rails/activesupport/test/core_ext/module/reachable_test.rb +41 -0
- data/rails/activesupport/test/core_ext/module/remove_method_test.rb +29 -0
- data/rails/activesupport/test/core_ext/module_test.rb +509 -0
- data/rails/activesupport/test/core_ext/name_error_test.rb +21 -0
- data/rails/activesupport/test/core_ext/numeric_ext_test.rb +392 -0
- data/rails/activesupport/test/core_ext/object/acts_like_test.rb +33 -0
- data/rails/activesupport/test/core_ext/object/blank_test.rb +36 -0
- data/rails/activesupport/test/core_ext/object/deep_dup_test.rb +53 -0
- data/rails/activesupport/test/core_ext/object/duplicable_test.rb +31 -0
- data/rails/activesupport/test/core_ext/object/inclusion_test.rb +59 -0
- data/rails/activesupport/test/core_ext/object/instance_variables_test.rb +31 -0
- data/rails/activesupport/test/core_ext/object/itself_test.rb +9 -0
- data/rails/activesupport/test/core_ext/object/json_cherry_pick_test.rb +42 -0
- data/rails/activesupport/test/core_ext/object/to_param_test.rb +37 -0
- data/rails/activesupport/test/core_ext/object/to_query_test.rb +82 -0
- data/rails/activesupport/test/core_ext/object/try_test.rb +99 -0
- data/rails/activesupport/test/core_ext/range_ext_test.rb +125 -0
- data/rails/activesupport/test/core_ext/regexp_ext_test.rb +10 -0
- data/rails/activesupport/test/core_ext/string_ext_test.rb +864 -0
- data/rails/activesupport/test/core_ext/struct_test.rb +10 -0
- data/rails/activesupport/test/core_ext/thread_test.rb +75 -0
- data/rails/activesupport/test/core_ext/time_ext_test.rb +901 -0
- data/rails/activesupport/test/core_ext/time_with_zone_test.rb +1121 -0
- data/rails/activesupport/test/core_ext/uri_ext_test.rb +13 -0
- data/rails/activesupport/test/dependencies/check_warnings.rb +2 -0
- data/rails/activesupport/test/dependencies/conflict.rb +1 -0
- data/rails/activesupport/test/dependencies/cross_site_depender.rb +3 -0
- data/rails/activesupport/test/dependencies/mutual_one.rb +4 -0
- data/rails/activesupport/test/dependencies/mutual_two.rb +4 -0
- data/rails/activesupport/test/dependencies/raises_exception.rb +3 -0
- data/rails/activesupport/test/dependencies/raises_exception_without_blame_file.rb +5 -0
- data/rails/activesupport/test/dependencies/requires_nonexistent0.rb +1 -0
- data/rails/activesupport/test/dependencies/requires_nonexistent1.rb +1 -0
- data/rails/activesupport/test/dependencies/service_one.rb +5 -0
- data/rails/activesupport/test/dependencies/service_two.rb +2 -0
- data/rails/activesupport/test/dependencies_test.rb +1059 -0
- data/rails/activesupport/test/dependencies_test_helpers.rb +28 -0
- data/rails/activesupport/test/deprecation/proxy_wrappers_test.rb +22 -0
- data/rails/activesupport/test/deprecation_test.rb +375 -0
- data/rails/activesupport/test/descendants_tracker_test_cases.rb +65 -0
- data/rails/activesupport/test/descendants_tracker_with_autoloading_test.rb +34 -0
- data/rails/activesupport/test/descendants_tracker_without_autoloading_test.rb +17 -0
- data/rails/activesupport/test/file_update_checker_test.rb +112 -0
- data/rails/activesupport/test/fixtures/autoload/another_class.rb +2 -0
- data/rails/activesupport/test/fixtures/autoload/some_class.rb +2 -0
- data/rails/activesupport/test/fixtures/xml/jdom_doctype.dtd +1 -0
- data/rails/activesupport/test/fixtures/xml/jdom_entities.txt +1 -0
- data/rails/activesupport/test/fixtures/xml/jdom_include.txt +1 -0
- data/rails/activesupport/test/gzip_test.rb +33 -0
- data/rails/activesupport/test/hash_with_indifferent_access_test.rb +10 -0
- data/rails/activesupport/test/i18n_test.rb +104 -0
- data/rails/activesupport/test/inflector_test.rb +537 -0
- data/rails/activesupport/test/inflector_test_cases.rb +324 -0
- data/rails/activesupport/test/json/decoding_test.rb +113 -0
- data/rails/activesupport/test/json/encoding_test.rb +547 -0
- data/rails/activesupport/test/key_generator_test.rb +62 -0
- data/rails/activesupport/test/lazy_load_hooks_test.rb +96 -0
- data/rails/activesupport/test/load_paths_test.rb +16 -0
- data/rails/activesupport/test/log_subscriber_test.rb +123 -0
- data/rails/activesupport/test/logger_test.rb +133 -0
- data/rails/activesupport/test/message_encryptor_test.rb +101 -0
- data/rails/activesupport/test/message_verifier_test.rb +86 -0
- data/rails/activesupport/test/multibyte_chars_test.rb +714 -0
- data/rails/activesupport/test/multibyte_conformance_test.rb +133 -0
- data/rails/activesupport/test/multibyte_proxy_test.rb +34 -0
- data/rails/activesupport/test/multibyte_test_helpers.rb +19 -0
- data/rails/activesupport/test/multibyte_unicode_database_test.rb +26 -0
- data/rails/activesupport/test/notifications/evented_notification_test.rb +87 -0
- data/rails/activesupport/test/notifications/instrumenter_test.rb +58 -0
- data/rails/activesupport/test/notifications_test.rb +266 -0
- data/rails/activesupport/test/number_helper_i18n_test.rb +148 -0
- data/rails/activesupport/test/number_helper_test.rb +396 -0
- data/rails/activesupport/test/option_merger_test.rb +95 -0
- data/rails/activesupport/test/ordered_hash_test.rb +322 -0
- data/rails/activesupport/test/ordered_options_test.rb +88 -0
- data/rails/activesupport/test/rescuable_test.rb +105 -0
- data/rails/activesupport/test/safe_buffer_test.rb +180 -0
- data/rails/activesupport/test/security_utils_test.rb +9 -0
- data/rails/activesupport/test/string_inquirer_test.rb +23 -0
- data/rails/activesupport/test/subscriber_test.rb +54 -0
- data/rails/activesupport/test/tagged_logging_test.rb +102 -0
- data/rails/activesupport/test/test_case_test.rb +221 -0
- data/rails/activesupport/test/testing/constant_lookup_test.rb +76 -0
- data/rails/activesupport/test/time_travel_test.rb +72 -0
- data/rails/activesupport/test/time_zone_test.rb +422 -0
- data/rails/activesupport/test/time_zone_test_helpers.rb +16 -0
- data/rails/activesupport/test/transliterate_test.rb +35 -0
- data/rails/activesupport/test/xml_mini/jdom_engine_test.rb +188 -0
- data/rails/activesupport/test/xml_mini/libxml_engine_test.rb +204 -0
- data/rails/activesupport/test/xml_mini/libxmlsax_engine_test.rb +195 -0
- data/rails/activesupport/test/xml_mini/nokogiri_engine_test.rb +217 -0
- data/rails/activesupport/test/xml_mini/nokogirisax_engine_test.rb +218 -0
- data/rails/activesupport/test/xml_mini/rexml_engine_test.rb +37 -0
- data/rails/activesupport/test/xml_mini_test.rb +353 -0
- data/rails/ci/travis.rb +145 -0
- data/rails/guides/.document +0 -0
- data/rails/guides/CHANGELOG.md +31 -0
- data/rails/guides/Rakefile +79 -0
- data/rails/guides/assets/images/akshaysurve.jpg +0 -0
- data/rails/guides/assets/images/belongs_to.png +0 -0
- data/rails/guides/assets/images/book_icon.gif +0 -0
- data/rails/guides/assets/images/bullet.gif +0 -0
- data/rails/guides/assets/images/chapters_icon.gif +0 -0
- data/rails/guides/assets/images/check_bullet.gif +0 -0
- data/rails/guides/assets/images/credits_pic_blank.gif +0 -0
- data/rails/guides/assets/images/csrf.png +0 -0
- data/rails/guides/assets/images/edge_badge.png +0 -0
- data/rails/guides/assets/images/favicon.ico +0 -0
- data/rails/guides/assets/images/feature_tile.gif +0 -0
- data/rails/guides/assets/images/footer_tile.gif +0 -0
- data/rails/guides/assets/images/fxn.png +0 -0
- data/rails/guides/assets/images/getting_started/article_with_comments.png +0 -0
- data/rails/guides/assets/images/getting_started/challenge.png +0 -0
- data/rails/guides/assets/images/getting_started/confirm_dialog.png +0 -0
- data/rails/guides/assets/images/getting_started/forbidden_attributes_for_new_article.png +0 -0
- data/rails/guides/assets/images/getting_started/form_with_errors.png +0 -0
- data/rails/guides/assets/images/getting_started/index_action_with_edit_link.png +0 -0
- data/rails/guides/assets/images/getting_started/new_article.png +0 -0
- data/rails/guides/assets/images/getting_started/rails_welcome.png +0 -0
- data/rails/guides/assets/images/getting_started/routing_error_no_controller.png +0 -0
- data/rails/guides/assets/images/getting_started/routing_error_no_route_matches.png +0 -0
- data/rails/guides/assets/images/getting_started/show_action_for_articles.png +0 -0
- data/rails/guides/assets/images/getting_started/template_is_missing_articles_new.png +0 -0
- data/rails/guides/assets/images/getting_started/unknown_action_create_for_articles.png +0 -0
- data/rails/guides/assets/images/getting_started/unknown_action_new_for_articles.png +0 -0
- data/rails/guides/assets/images/grey_bullet.gif +0 -0
- data/rails/guides/assets/images/habtm.png +0 -0
- data/rails/guides/assets/images/has_many.png +0 -0
- data/rails/guides/assets/images/has_many_through.png +0 -0
- data/rails/guides/assets/images/has_one.png +0 -0
- data/rails/guides/assets/images/has_one_through.png +0 -0
- data/rails/guides/assets/images/header_backdrop.png +0 -0
- data/rails/guides/assets/images/header_tile.gif +0 -0
- data/rails/guides/assets/images/i18n/demo_html_safe.png +0 -0
- data/rails/guides/assets/images/i18n/demo_localized_pirate.png +0 -0
- data/rails/guides/assets/images/i18n/demo_translated_en.png +0 -0
- data/rails/guides/assets/images/i18n/demo_translated_pirate.png +0 -0
- data/rails/guides/assets/images/i18n/demo_translation_missing.png +0 -0
- data/rails/guides/assets/images/i18n/demo_untranslated.png +0 -0
- data/rails/guides/assets/images/icons/README +5 -0
- data/rails/guides/assets/images/icons/callouts/1.png +0 -0
- data/rails/guides/assets/images/icons/callouts/10.png +0 -0
- data/rails/guides/assets/images/icons/callouts/11.png +0 -0
- data/rails/guides/assets/images/icons/callouts/12.png +0 -0
- data/rails/guides/assets/images/icons/callouts/13.png +0 -0
- data/rails/guides/assets/images/icons/callouts/14.png +0 -0
- data/rails/guides/assets/images/icons/callouts/15.png +0 -0
- data/rails/guides/assets/images/icons/callouts/2.png +0 -0
- data/rails/guides/assets/images/icons/callouts/3.png +0 -0
- data/rails/guides/assets/images/icons/callouts/4.png +0 -0
- data/rails/guides/assets/images/icons/callouts/5.png +0 -0
- data/rails/guides/assets/images/icons/callouts/6.png +0 -0
- data/rails/guides/assets/images/icons/callouts/7.png +0 -0
- data/rails/guides/assets/images/icons/callouts/8.png +0 -0
- data/rails/guides/assets/images/icons/callouts/9.png +0 -0
- data/rails/guides/assets/images/icons/caution.png +0 -0
- data/rails/guides/assets/images/icons/example.png +0 -0
- data/rails/guides/assets/images/icons/home.png +0 -0
- data/rails/guides/assets/images/icons/important.png +0 -0
- data/rails/guides/assets/images/icons/next.png +0 -0
- data/rails/guides/assets/images/icons/note.png +0 -0
- data/rails/guides/assets/images/icons/prev.png +0 -0
- data/rails/guides/assets/images/icons/tip.png +0 -0
- data/rails/guides/assets/images/icons/up.png +0 -0
- data/rails/guides/assets/images/icons/warning.png +0 -0
- data/rails/guides/assets/images/nav_arrow.gif +0 -0
- data/rails/guides/assets/images/oscardelben.jpg +0 -0
- data/rails/guides/assets/images/polymorphic.png +0 -0
- data/rails/guides/assets/images/radar.png +0 -0
- data/rails/guides/assets/images/rails4_features.png +0 -0
- data/rails/guides/assets/images/rails_guides_kindle_cover.jpg +0 -0
- data/rails/guides/assets/images/rails_guides_logo.gif +0 -0
- data/rails/guides/assets/images/rails_logo_remix.gif +0 -0
- data/rails/guides/assets/images/session_fixation.png +0 -0
- data/rails/guides/assets/images/tab_grey.gif +0 -0
- data/rails/guides/assets/images/tab_info.gif +0 -0
- data/rails/guides/assets/images/tab_note.gif +0 -0
- data/rails/guides/assets/images/tab_red.gif +0 -0
- data/rails/guides/assets/images/tab_yellow.gif +0 -0
- data/rails/guides/assets/images/tab_yellow.png +0 -0
- data/rails/guides/assets/images/vijaydev.jpg +0 -0
- data/rails/guides/assets/javascripts/guides.js +59 -0
- data/rails/guides/assets/javascripts/jquery.min.js +4 -0
- data/rails/guides/assets/javascripts/responsive-tables.js +43 -0
- data/rails/guides/assets/javascripts/syntaxhighlighter/shBrushAS3.js +59 -0
- data/rails/guides/assets/javascripts/syntaxhighlighter/shBrushAppleScript.js +75 -0
- data/rails/guides/assets/javascripts/syntaxhighlighter/shBrushBash.js +59 -0
- data/rails/guides/assets/javascripts/syntaxhighlighter/shBrushCSharp.js +65 -0
- data/rails/guides/assets/javascripts/syntaxhighlighter/shBrushColdFusion.js +100 -0
- data/rails/guides/assets/javascripts/syntaxhighlighter/shBrushCpp.js +97 -0
- data/rails/guides/assets/javascripts/syntaxhighlighter/shBrushCss.js +91 -0
- data/rails/guides/assets/javascripts/syntaxhighlighter/shBrushDelphi.js +55 -0
- data/rails/guides/assets/javascripts/syntaxhighlighter/shBrushDiff.js +41 -0
- data/rails/guides/assets/javascripts/syntaxhighlighter/shBrushErlang.js +52 -0
- data/rails/guides/assets/javascripts/syntaxhighlighter/shBrushGroovy.js +67 -0
- data/rails/guides/assets/javascripts/syntaxhighlighter/shBrushJScript.js +52 -0
- data/rails/guides/assets/javascripts/syntaxhighlighter/shBrushJava.js +57 -0
- data/rails/guides/assets/javascripts/syntaxhighlighter/shBrushJavaFX.js +58 -0
- data/rails/guides/assets/javascripts/syntaxhighlighter/shBrushPerl.js +72 -0
- data/rails/guides/assets/javascripts/syntaxhighlighter/shBrushPhp.js +88 -0
- data/rails/guides/assets/javascripts/syntaxhighlighter/shBrushPlain.js +33 -0
- data/rails/guides/assets/javascripts/syntaxhighlighter/shBrushPowerShell.js +74 -0
- data/rails/guides/assets/javascripts/syntaxhighlighter/shBrushPython.js +64 -0
- data/rails/guides/assets/javascripts/syntaxhighlighter/shBrushRuby.js +55 -0
- data/rails/guides/assets/javascripts/syntaxhighlighter/shBrushSass.js +94 -0
- data/rails/guides/assets/javascripts/syntaxhighlighter/shBrushScala.js +51 -0
- data/rails/guides/assets/javascripts/syntaxhighlighter/shBrushSql.js +66 -0
- data/rails/guides/assets/javascripts/syntaxhighlighter/shBrushVb.js +56 -0
- data/rails/guides/assets/javascripts/syntaxhighlighter/shBrushXml.js +69 -0
- data/rails/guides/assets/javascripts/syntaxhighlighter/shCore.js +17 -0
- data/rails/guides/assets/stylesheets/fixes.css +16 -0
- data/rails/guides/assets/stylesheets/kindle.css +11 -0
- data/rails/guides/assets/stylesheets/main.css +713 -0
- data/rails/guides/assets/stylesheets/print.css +52 -0
- data/rails/guides/assets/stylesheets/reset.css +43 -0
- data/rails/guides/assets/stylesheets/responsive-tables.css +50 -0
- data/rails/guides/assets/stylesheets/style.css +13 -0
- data/rails/guides/assets/stylesheets/syntaxhighlighter/shCore.css +226 -0
- data/rails/guides/assets/stylesheets/syntaxhighlighter/shCoreDefault.css +328 -0
- data/rails/guides/assets/stylesheets/syntaxhighlighter/shCoreDjango.css +331 -0
- data/rails/guides/assets/stylesheets/syntaxhighlighter/shCoreEclipse.css +339 -0
- data/rails/guides/assets/stylesheets/syntaxhighlighter/shCoreEmacs.css +324 -0
- data/rails/guides/assets/stylesheets/syntaxhighlighter/shCoreFadeToGrey.css +328 -0
- data/rails/guides/assets/stylesheets/syntaxhighlighter/shCoreMDUltra.css +324 -0
- data/rails/guides/assets/stylesheets/syntaxhighlighter/shCoreMidnight.css +324 -0
- data/rails/guides/assets/stylesheets/syntaxhighlighter/shCoreRDark.css +324 -0
- data/rails/guides/assets/stylesheets/syntaxhighlighter/shThemeDefault.css +117 -0
- data/rails/guides/assets/stylesheets/syntaxhighlighter/shThemeDjango.css +120 -0
- data/rails/guides/assets/stylesheets/syntaxhighlighter/shThemeEclipse.css +128 -0
- data/rails/guides/assets/stylesheets/syntaxhighlighter/shThemeEmacs.css +113 -0
- data/rails/guides/assets/stylesheets/syntaxhighlighter/shThemeFadeToGrey.css +117 -0
- data/rails/guides/assets/stylesheets/syntaxhighlighter/shThemeMDUltra.css +113 -0
- data/rails/guides/assets/stylesheets/syntaxhighlighter/shThemeMidnight.css +113 -0
- data/rails/guides/assets/stylesheets/syntaxhighlighter/shThemeRDark.css +113 -0
- data/rails/guides/assets/stylesheets/syntaxhighlighter/shThemeRailsGuides.css +116 -0
- data/rails/guides/bug_report_templates/action_controller_gem.rb +47 -0
- data/rails/guides/bug_report_templates/action_controller_master.rb +54 -0
- data/rails/guides/bug_report_templates/active_record_gem.rb +40 -0
- data/rails/guides/bug_report_templates/active_record_master.rb +49 -0
- data/rails/guides/rails_guides/generator.rb +248 -0
- data/rails/guides/rails_guides/helpers.rb +53 -0
- data/rails/guides/rails_guides/indexer.rb +68 -0
- data/rails/guides/rails_guides/kindle.rb +119 -0
- data/rails/guides/rails_guides/levenshtein.rb +39 -0
- data/rails/guides/rails_guides/markdown/renderer.rb +82 -0
- data/rails/guides/rails_guides/markdown.rb +167 -0
- data/rails/guides/rails_guides.rb +63 -0
- data/rails/guides/source/2_2_release_notes.md +435 -0
- data/rails/guides/source/2_3_release_notes.md +621 -0
- data/rails/guides/source/3_0_release_notes.md +611 -0
- data/rails/guides/source/3_1_release_notes.md +559 -0
- data/rails/guides/source/3_2_release_notes.md +568 -0
- data/rails/guides/source/4_0_release_notes.md +279 -0
- data/rails/guides/source/4_1_release_notes.md +730 -0
- data/rails/guides/source/4_2_release_notes.md +853 -0
- data/rails/guides/source/_license.html.erb +2 -0
- data/rails/guides/source/_welcome.html.erb +19 -0
- data/rails/guides/source/action_controller_overview.md +1192 -0
- data/rails/guides/source/action_mailer_basics.md +754 -0
- data/rails/guides/source/action_view_overview.md +1620 -0
- data/rails/guides/source/active_job_basics.md +318 -0
- data/rails/guides/source/active_model_basics.md +554 -0
- data/rails/guides/source/active_record_basics.md +374 -0
- data/rails/guides/source/active_record_callbacks.md +413 -0
- data/rails/guides/source/active_record_migrations.md +1018 -0
- data/rails/guides/source/active_record_postgresql.md +433 -0
- data/rails/guides/source/active_record_querying.md +1783 -0
- data/rails/guides/source/active_record_validations.md +1178 -0
- data/rails/guides/source/active_support_core_extensions.md +3904 -0
- data/rails/guides/source/active_support_instrumentation.md +499 -0
- data/rails/guides/source/api_documentation_guidelines.md +361 -0
- data/rails/guides/source/asset_pipeline.md +1360 -0
- data/rails/guides/source/association_basics.md +2235 -0
- data/rails/guides/source/autoloading_and_reloading_constants.md +1310 -0
- data/rails/guides/source/caching_with_rails.md +379 -0
- data/rails/guides/source/command_line.md +625 -0
- data/rails/guides/source/configuring.md +1045 -0
- data/rails/guides/source/contributing_to_ruby_on_rails.md +628 -0
- data/rails/guides/source/credits.html.erb +80 -0
- data/rails/guides/source/debugging_rails_applications.md +861 -0
- data/rails/guides/source/development_dependencies_install.md +289 -0
- data/rails/guides/source/documents.yaml +205 -0
- data/rails/guides/source/engines.md +1412 -0
- data/rails/guides/source/form_helpers.md +1024 -0
- data/rails/guides/source/generators.md +676 -0
- data/rails/guides/source/getting_started.md +2091 -0
- data/rails/guides/source/i18n.md +1087 -0
- data/rails/guides/source/index.html.erb +28 -0
- data/rails/guides/source/initialization.md +704 -0
- data/rails/guides/source/kindle/copyright.html.erb +1 -0
- data/rails/guides/source/kindle/layout.html.erb +27 -0
- data/rails/guides/source/kindle/rails_guides.opf.erb +52 -0
- data/rails/guides/source/kindle/toc.html.erb +24 -0
- data/rails/guides/source/kindle/toc.ncx.erb +64 -0
- data/rails/guides/source/kindle/welcome.html.erb +5 -0
- data/rails/guides/source/layout.html.erb +143 -0
- data/rails/guides/source/layouts_and_rendering.md +1227 -0
- data/rails/guides/source/maintenance_policy.md +78 -0
- data/rails/guides/source/nested_model_forms.md +228 -0
- data/rails/guides/source/plugins.md +444 -0
- data/rails/guides/source/rails_application_templates.md +266 -0
- data/rails/guides/source/rails_on_rack.md +336 -0
- data/rails/guides/source/routing.md +1141 -0
- data/rails/guides/source/ruby_on_rails_guides_guidelines.md +127 -0
- data/rails/guides/source/security.md +1024 -0
- data/rails/guides/source/testing.md +1132 -0
- data/rails/guides/source/upgrading_ruby_on_rails.md +1170 -0
- data/rails/guides/source/working_with_javascript_in_rails.md +407 -0
- data/rails/guides/w3c_validator.rb +97 -0
- data/rails/install.rb +16 -0
- data/rails/load_paths.rb +3 -0
- data/rails/rails.gemspec +32 -0
- data/rails/railties/.gitignore +1 -0
- data/rails/railties/CHANGELOG.md +233 -0
- data/rails/railties/MIT-LICENSE +20 -0
- data/rails/railties/RDOC_MAIN.rdoc +73 -0
- data/rails/railties/README.rdoc +41 -0
- data/rails/railties/Rakefile +50 -0
- data/rails/railties/bin/rails +9 -0
- data/rails/railties/lib/rails/all.rb +16 -0
- data/rails/railties/lib/rails/api/task.rb +170 -0
- data/rails/railties/lib/rails/app_rails_loader.rb +63 -0
- data/rails/railties/lib/rails/application/bootstrap.rb +94 -0
- data/rails/railties/lib/rails/application/configuration.rb +208 -0
- data/rails/railties/lib/rails/application/default_middleware_stack.rb +103 -0
- data/rails/railties/lib/rails/application/finisher.rb +113 -0
- data/rails/railties/lib/rails/application/routes_reloader.rb +56 -0
- data/rails/railties/lib/rails/application.rb +539 -0
- data/rails/railties/lib/rails/application_controller.rb +16 -0
- data/rails/railties/lib/rails/backtrace_cleaner.rb +32 -0
- data/rails/railties/lib/rails/cli.rb +15 -0
- data/rails/railties/lib/rails/code_statistics.rb +104 -0
- data/rails/railties/lib/rails/code_statistics_calculator.rb +79 -0
- data/rails/railties/lib/rails/commands/application.rb +17 -0
- data/rails/railties/lib/rails/commands/commands_tasks.rb +169 -0
- data/rails/railties/lib/rails/commands/console.rb +113 -0
- data/rails/railties/lib/rails/commands/dbconsole.rb +192 -0
- data/rails/railties/lib/rails/commands/destroy.rb +11 -0
- data/rails/railties/lib/rails/commands/generate.rb +13 -0
- data/rails/railties/lib/rails/commands/plugin.rb +23 -0
- data/rails/railties/lib/rails/commands/runner.rb +63 -0
- data/rails/railties/lib/rails/commands/server.rb +148 -0
- data/rails/railties/lib/rails/commands.rb +17 -0
- data/rails/railties/lib/rails/configuration.rb +119 -0
- data/rails/railties/lib/rails/console/app.rb +32 -0
- data/rails/railties/lib/rails/console/helpers.rb +17 -0
- data/rails/railties/lib/rails/deprecation.rb +19 -0
- data/rails/railties/lib/rails/engine/commands.rb +41 -0
- data/rails/railties/lib/rails/engine/configuration.rb +91 -0
- data/rails/railties/lib/rails/engine/railties.rb +21 -0
- data/rails/railties/lib/rails/engine.rb +694 -0
- data/rails/railties/lib/rails/gem_version.rb +15 -0
- data/rails/railties/lib/rails/generators/actions/create_migration.rb +69 -0
- data/rails/railties/lib/rails/generators/actions.rb +282 -0
- data/rails/railties/lib/rails/generators/active_model.rb +78 -0
- data/rails/railties/lib/rails/generators/app_base.rb +354 -0
- data/rails/railties/lib/rails/generators/base.rb +379 -0
- data/rails/railties/lib/rails/generators/css/assets/assets_generator.rb +13 -0
- data/rails/railties/lib/rails/generators/css/assets/templates/stylesheet.css +4 -0
- data/rails/railties/lib/rails/generators/css/scaffold/scaffold_generator.rb +16 -0
- data/rails/railties/lib/rails/generators/erb/controller/controller_generator.rb +22 -0
- data/rails/railties/lib/rails/generators/erb/controller/templates/view.html.erb +2 -0
- data/rails/railties/lib/rails/generators/erb/mailer/mailer_generator.rb +36 -0
- data/rails/railties/lib/rails/generators/erb/mailer/templates/layout.html.erb +5 -0
- data/rails/railties/lib/rails/generators/erb/mailer/templates/layout.text.erb +1 -0
- data/rails/railties/lib/rails/generators/erb/mailer/templates/view.html.erb +5 -0
- data/rails/railties/lib/rails/generators/erb/mailer/templates/view.text.erb +3 -0
- data/rails/railties/lib/rails/generators/erb/scaffold/scaffold_generator.rb +31 -0
- data/rails/railties/lib/rails/generators/erb/scaffold/templates/_form.html.erb +32 -0
- data/rails/railties/lib/rails/generators/erb/scaffold/templates/edit.html.erb +6 -0
- data/rails/railties/lib/rails/generators/erb/scaffold/templates/index.html.erb +31 -0
- data/rails/railties/lib/rails/generators/erb/scaffold/templates/new.html.erb +5 -0
- data/rails/railties/lib/rails/generators/erb/scaffold/templates/show.html.erb +11 -0
- data/rails/railties/lib/rails/generators/erb.rb +25 -0
- data/rails/railties/lib/rails/generators/generated_attribute.rb +170 -0
- data/rails/railties/lib/rails/generators/js/assets/assets_generator.rb +13 -0
- data/rails/railties/lib/rails/generators/js/assets/templates/javascript.js +2 -0
- data/rails/railties/lib/rails/generators/migration.rb +69 -0
- data/rails/railties/lib/rails/generators/model_helpers.rb +28 -0
- data/rails/railties/lib/rails/generators/named_base.rb +205 -0
- data/rails/railties/lib/rails/generators/rails/app/USAGE +15 -0
- data/rails/railties/lib/rails/generators/rails/app/app_generator.rb +407 -0
- data/rails/railties/lib/rails/generators/rails/app/templates/Gemfile +46 -0
- data/rails/railties/lib/rails/generators/rails/app/templates/README.rdoc +28 -0
- data/rails/railties/lib/rails/generators/rails/app/templates/Rakefile +6 -0
- data/rails/railties/lib/rails/generators/rails/app/templates/app/assets/javascripts/application.js.tt +20 -0
- data/rails/railties/lib/rails/generators/rails/app/templates/app/assets/stylesheets/application.css +15 -0
- data/rails/railties/lib/rails/generators/rails/app/templates/app/controllers/application_controller.rb.tt +5 -0
- data/rails/railties/lib/rails/generators/rails/app/templates/app/helpers/application_helper.rb +2 -0
- data/rails/railties/lib/rails/generators/rails/app/templates/app/views/layouts/application.html.erb.tt +23 -0
- data/rails/railties/lib/rails/generators/rails/app/templates/bin/bundle +2 -0
- data/rails/railties/lib/rails/generators/rails/app/templates/bin/rails +3 -0
- data/rails/railties/lib/rails/generators/rails/app/templates/bin/rake +3 -0
- data/rails/railties/lib/rails/generators/rails/app/templates/bin/setup +28 -0
- data/rails/railties/lib/rails/generators/rails/app/templates/config/application.rb +41 -0
- data/rails/railties/lib/rails/generators/rails/app/templates/config/boot.rb +3 -0
- data/rails/railties/lib/rails/generators/rails/app/templates/config/databases/frontbase.yml +49 -0
- data/rails/railties/lib/rails/generators/rails/app/templates/config/databases/ibm_db.yml +85 -0
- data/rails/railties/lib/rails/generators/rails/app/templates/config/databases/jdbc.yml +68 -0
- data/rails/railties/lib/rails/generators/rails/app/templates/config/databases/jdbcmysql.yml +52 -0
- data/rails/railties/lib/rails/generators/rails/app/templates/config/databases/jdbcpostgresql.yml +68 -0
- data/rails/railties/lib/rails/generators/rails/app/templates/config/databases/jdbcsqlite3.yml +23 -0
- data/rails/railties/lib/rails/generators/rails/app/templates/config/databases/mysql.yml +58 -0
- data/rails/railties/lib/rails/generators/rails/app/templates/config/databases/oracle.yml +58 -0
- data/rails/railties/lib/rails/generators/rails/app/templates/config/databases/postgresql.yml +85 -0
- data/rails/railties/lib/rails/generators/rails/app/templates/config/databases/sqlite3.yml +25 -0
- data/rails/railties/lib/rails/generators/rails/app/templates/config/databases/sqlserver.yml +68 -0
- data/rails/railties/lib/rails/generators/rails/app/templates/config/environment.rb +5 -0
- data/rails/railties/lib/rails/generators/rails/app/templates/config/environments/development.rb.tt +45 -0
- data/rails/railties/lib/rails/generators/rails/app/templates/config/environments/production.rb.tt +83 -0
- data/rails/railties/lib/rails/generators/rails/app/templates/config/environments/test.rb.tt +42 -0
- data/rails/railties/lib/rails/generators/rails/app/templates/config/initializers/assets.rb.tt +11 -0
- data/rails/railties/lib/rails/generators/rails/app/templates/config/initializers/backtrace_silencers.rb +7 -0
- data/rails/railties/lib/rails/generators/rails/app/templates/config/initializers/cookies_serializer.rb +3 -0
- data/rails/railties/lib/rails/generators/rails/app/templates/config/initializers/filter_parameter_logging.rb +4 -0
- data/rails/railties/lib/rails/generators/rails/app/templates/config/initializers/inflections.rb +16 -0
- data/rails/railties/lib/rails/generators/rails/app/templates/config/initializers/mime_types.rb +4 -0
- data/rails/railties/lib/rails/generators/rails/app/templates/config/initializers/session_store.rb.tt +3 -0
- data/rails/railties/lib/rails/generators/rails/app/templates/config/initializers/wrap_parameters.rb.tt +16 -0
- data/rails/railties/lib/rails/generators/rails/app/templates/config/locales/en.yml +23 -0
- data/rails/railties/lib/rails/generators/rails/app/templates/config/routes.rb +56 -0
- data/rails/railties/lib/rails/generators/rails/app/templates/config/secrets.yml +22 -0
- data/rails/railties/lib/rails/generators/rails/app/templates/config.ru +4 -0
- data/rails/railties/lib/rails/generators/rails/app/templates/db/seeds.rb.tt +7 -0
- data/rails/railties/lib/rails/generators/rails/app/templates/gitignore +19 -0
- data/rails/railties/lib/rails/generators/rails/app/templates/public/404.html +67 -0
- data/rails/railties/lib/rails/generators/rails/app/templates/public/422.html +67 -0
- data/rails/railties/lib/rails/generators/rails/app/templates/public/500.html +66 -0
- data/rails/railties/lib/rails/generators/rails/app/templates/public/favicon.ico +0 -0
- data/rails/railties/lib/rails/generators/rails/app/templates/public/robots.txt +5 -0
- data/rails/railties/lib/rails/generators/rails/app/templates/test/test_helper.rb +12 -0
- data/rails/railties/lib/rails/generators/rails/assets/USAGE +20 -0
- data/rails/railties/lib/rails/generators/rails/assets/assets_generator.rb +25 -0
- data/rails/railties/lib/rails/generators/rails/assets/templates/javascript.js +2 -0
- data/rails/railties/lib/rails/generators/rails/assets/templates/stylesheet.css +4 -0
- data/rails/railties/lib/rails/generators/rails/controller/USAGE +18 -0
- data/rails/railties/lib/rails/generators/rails/controller/controller_generator.rb +58 -0
- data/rails/railties/lib/rails/generators/rails/controller/templates/controller.rb +13 -0
- data/rails/railties/lib/rails/generators/rails/generator/USAGE +13 -0
- data/rails/railties/lib/rails/generators/rails/generator/generator_generator.rb +27 -0
- data/rails/railties/lib/rails/generators/rails/generator/templates/%file_name%_generator.rb.tt +3 -0
- data/rails/railties/lib/rails/generators/rails/generator/templates/USAGE.tt +8 -0
- data/rails/railties/lib/rails/generators/rails/generator/templates/templates/.empty_directory +0 -0
- data/rails/railties/lib/rails/generators/rails/helper/USAGE +13 -0
- data/rails/railties/lib/rails/generators/rails/helper/helper_generator.rb +13 -0
- data/rails/railties/lib/rails/generators/rails/helper/templates/helper.rb +4 -0
- data/rails/railties/lib/rails/generators/rails/integration_test/USAGE +10 -0
- data/rails/railties/lib/rails/generators/rails/integration_test/integration_test_generator.rb +7 -0
- data/rails/railties/lib/rails/generators/rails/migration/USAGE +35 -0
- data/rails/railties/lib/rails/generators/rails/migration/migration_generator.rb +8 -0
- data/rails/railties/lib/rails/generators/rails/model/USAGE +109 -0
- data/rails/railties/lib/rails/generators/rails/model/model_generator.rb +12 -0
- data/rails/railties/lib/rails/generators/rails/plugin/USAGE +10 -0
- data/rails/railties/lib/rails/generators/rails/plugin/plugin_generator.rb +393 -0
- data/rails/railties/lib/rails/generators/rails/plugin/templates/%name%.gemspec +27 -0
- data/rails/railties/lib/rails/generators/rails/plugin/templates/Gemfile +51 -0
- data/rails/railties/lib/rails/generators/rails/plugin/templates/MIT-LICENSE +20 -0
- data/rails/railties/lib/rails/generators/rails/plugin/templates/README.rdoc +3 -0
- data/rails/railties/lib/rails/generators/rails/plugin/templates/Rakefile +29 -0
- data/rails/railties/lib/rails/generators/rails/plugin/templates/app/controllers/%name%/application_controller.rb.tt +4 -0
- data/rails/railties/lib/rails/generators/rails/plugin/templates/app/helpers/%name%/application_helper.rb.tt +4 -0
- data/rails/railties/lib/rails/generators/rails/plugin/templates/app/mailers/.empty_directory +0 -0
- data/rails/railties/lib/rails/generators/rails/plugin/templates/app/models/.empty_directory +0 -0
- data/rails/railties/lib/rails/generators/rails/plugin/templates/app/views/layouts/%name%/application.html.erb.tt +14 -0
- data/rails/railties/lib/rails/generators/rails/plugin/templates/bin/rails.tt +11 -0
- data/rails/railties/lib/rails/generators/rails/plugin/templates/config/routes.rb +6 -0
- data/rails/railties/lib/rails/generators/rails/plugin/templates/gitignore +10 -0
- data/rails/railties/lib/rails/generators/rails/plugin/templates/lib/%name%/engine.rb +7 -0
- data/rails/railties/lib/rails/generators/rails/plugin/templates/lib/%name%/version.rb +3 -0
- data/rails/railties/lib/rails/generators/rails/plugin/templates/lib/%name%.rb +6 -0
- data/rails/railties/lib/rails/generators/rails/plugin/templates/lib/tasks/%name%_tasks.rake +4 -0
- data/rails/railties/lib/rails/generators/rails/plugin/templates/rails/application.rb +18 -0
- data/rails/railties/lib/rails/generators/rails/plugin/templates/rails/boot.rb +5 -0
- data/rails/railties/lib/rails/generators/rails/plugin/templates/rails/javascripts.js +13 -0
- data/rails/railties/lib/rails/generators/rails/plugin/templates/rails/routes.rb +4 -0
- data/rails/railties/lib/rails/generators/rails/plugin/templates/rails/stylesheets.css +15 -0
- data/rails/railties/lib/rails/generators/rails/plugin/templates/test/%name%_test.rb +7 -0
- data/rails/railties/lib/rails/generators/rails/plugin/templates/test/integration/navigation_test.rb +12 -0
- data/rails/railties/lib/rails/generators/rails/plugin/templates/test/test_helper.rb +24 -0
- data/rails/railties/lib/rails/generators/rails/resource/USAGE +23 -0
- data/rails/railties/lib/rails/generators/rails/resource/resource_generator.rb +20 -0
- data/rails/railties/lib/rails/generators/rails/resource_route/resource_route_generator.rb +50 -0
- data/rails/railties/lib/rails/generators/rails/scaffold/USAGE +41 -0
- data/rails/railties/lib/rails/generators/rails/scaffold/scaffold_generator.rb +32 -0
- data/rails/railties/lib/rails/generators/rails/scaffold/templates/scaffold.css +56 -0
- data/rails/railties/lib/rails/generators/rails/scaffold_controller/USAGE +19 -0
- data/rails/railties/lib/rails/generators/rails/scaffold_controller/scaffold_controller_generator.rb +28 -0
- data/rails/railties/lib/rails/generators/rails/scaffold_controller/templates/controller.rb +68 -0
- data/rails/railties/lib/rails/generators/rails/task/USAGE +9 -0
- data/rails/railties/lib/rails/generators/rails/task/task_generator.rb +12 -0
- data/rails/railties/lib/rails/generators/rails/task/templates/task.rb +8 -0
- data/rails/railties/lib/rails/generators/resource_helpers.rb +82 -0
- data/rails/railties/lib/rails/generators/test_case.rb +36 -0
- data/rails/railties/lib/rails/generators/test_unit/controller/controller_generator.rb +15 -0
- data/rails/railties/lib/rails/generators/test_unit/controller/templates/functional_test.rb +19 -0
- data/rails/railties/lib/rails/generators/test_unit/generator/generator_generator.rb +26 -0
- data/rails/railties/lib/rails/generators/test_unit/generator/templates/generator_test.rb +16 -0
- data/rails/railties/lib/rails/generators/test_unit/helper/helper_generator.rb +9 -0
- data/rails/railties/lib/rails/generators/test_unit/integration/integration_generator.rb +13 -0
- data/rails/railties/lib/rails/generators/test_unit/integration/templates/integration_test.rb +7 -0
- data/rails/railties/lib/rails/generators/test_unit/job/job_generator.rb +13 -0
- data/rails/railties/lib/rails/generators/test_unit/job/templates/unit_test.rb.erb +9 -0
- data/rails/railties/lib/rails/generators/test_unit/mailer/mailer_generator.rb +21 -0
- data/rails/railties/lib/rails/generators/test_unit/mailer/templates/functional_test.rb +21 -0
- data/rails/railties/lib/rails/generators/test_unit/mailer/templates/preview.rb +13 -0
- data/rails/railties/lib/rails/generators/test_unit/model/model_generator.rb +36 -0
- data/rails/railties/lib/rails/generators/test_unit/model/templates/fixtures.yml +27 -0
- data/rails/railties/lib/rails/generators/test_unit/model/templates/unit_test.rb +9 -0
- data/rails/railties/lib/rails/generators/test_unit/plugin/plugin_generator.rb +13 -0
- data/rails/railties/lib/rails/generators/test_unit/plugin/templates/%file_name%_test.rb.tt +7 -0
- data/rails/railties/lib/rails/generators/test_unit/plugin/templates/test_helper.rb +2 -0
- data/rails/railties/lib/rails/generators/test_unit/scaffold/scaffold_generator.rb +33 -0
- data/rails/railties/lib/rails/generators/test_unit/scaffold/templates/functional_test.rb +51 -0
- data/rails/railties/lib/rails/generators/test_unit.rb +8 -0
- data/rails/railties/lib/rails/generators/testing/assertions.rb +123 -0
- data/rails/railties/lib/rails/generators/testing/behaviour.rb +123 -0
- data/rails/railties/lib/rails/generators/testing/setup_and_teardown.rb +18 -0
- data/rails/railties/lib/rails/generators.rb +373 -0
- data/rails/railties/lib/rails/info.rb +102 -0
- data/rails/railties/lib/rails/info_controller.rb +23 -0
- data/rails/railties/lib/rails/initializable.rb +89 -0
- data/rails/railties/lib/rails/mailers_controller.rb +73 -0
- data/rails/railties/lib/rails/paths.rb +211 -0
- data/rails/railties/lib/rails/rack/debugger.rb +24 -0
- data/rails/railties/lib/rails/rack/log_tailer.rb +38 -0
- data/rails/railties/lib/rails/rack/logger.rb +86 -0
- data/rails/railties/lib/rails/rack.rb +7 -0
- data/rails/railties/lib/rails/railtie/configurable.rb +35 -0
- data/rails/railties/lib/rails/railtie/configuration.rb +100 -0
- data/rails/railties/lib/rails/railtie.rb +250 -0
- data/rails/railties/lib/rails/ruby_version_check.rb +13 -0
- data/rails/railties/lib/rails/source_annotation_extractor.rb +133 -0
- data/rails/railties/lib/rails/tasks/annotations.rake +20 -0
- data/rails/railties/lib/rails/tasks/documentation.rake +70 -0
- data/rails/railties/lib/rails/tasks/engine.rake +72 -0
- data/rails/railties/lib/rails/tasks/framework.rake +66 -0
- data/rails/railties/lib/rails/tasks/log.rake +23 -0
- data/rails/railties/lib/rails/tasks/middleware.rake +7 -0
- data/rails/railties/lib/rails/tasks/misc.rake +60 -0
- data/rails/railties/lib/rails/tasks/routes.rake +7 -0
- data/rails/railties/lib/rails/tasks/statistics.rake +29 -0
- data/rails/railties/lib/rails/tasks/tmp.rake +45 -0
- data/rails/railties/lib/rails/tasks.rb +14 -0
- data/rails/railties/lib/rails/templates/layouts/application.html.erb +36 -0
- data/rails/railties/lib/rails/templates/rails/info/properties.html.erb +1 -0
- data/rails/railties/lib/rails/templates/rails/info/routes.html.erb +9 -0
- data/rails/railties/lib/rails/templates/rails/mailers/email.html.erb +105 -0
- data/rails/railties/lib/rails/templates/rails/mailers/index.html.erb +8 -0
- data/rails/railties/lib/rails/templates/rails/mailers/mailer.html.erb +6 -0
- data/rails/railties/lib/rails/templates/rails/welcome/index.html.erb +261 -0
- data/rails/railties/lib/rails/test_help.rb +43 -0
- data/rails/railties/lib/rails/test_unit/railtie.rb +18 -0
- data/rails/railties/lib/rails/test_unit/sub_test_task.rb +126 -0
- data/rails/railties/lib/rails/test_unit/testing.rake +66 -0
- data/rails/railties/lib/rails/version.rb +8 -0
- data/rails/railties/lib/rails/welcome_controller.rb +8 -0
- data/rails/railties/lib/rails.rb +93 -0
- data/rails/railties/railties.gemspec +33 -0
- data/rails/railties/test/abstract_unit.rb +53 -0
- data/rails/railties/test/app_rails_loader_test.rb +89 -0
- data/rails/railties/test/application/asset_debugging_test.rb +64 -0
- data/rails/railties/test/application/assets_test.rb +493 -0
- data/rails/railties/test/application/build_original_fullpath_test.rb +27 -0
- data/rails/railties/test/application/configuration/base_test.rb +37 -0
- data/rails/railties/test/application/configuration/custom_test.rb +22 -0
- data/rails/railties/test/application/configuration_test.rb +1344 -0
- data/rails/railties/test/application/console_test.rb +153 -0
- data/rails/railties/test/application/generators_test.rb +129 -0
- data/rails/railties/test/application/initializers/frameworks_test.rb +231 -0
- data/rails/railties/test/application/initializers/hooks_test.rb +90 -0
- data/rails/railties/test/application/initializers/i18n_test.rb +216 -0
- data/rails/railties/test/application/initializers/load_path_test.rb +110 -0
- data/rails/railties/test/application/initializers/notifications_test.rb +56 -0
- data/rails/railties/test/application/loading_test.rb +341 -0
- data/rails/railties/test/application/mailer_previews_test.rb +494 -0
- data/rails/railties/test/application/middleware/cache_test.rb +180 -0
- data/rails/railties/test/application/middleware/cookies_test.rb +47 -0
- data/rails/railties/test/application/middleware/exceptions_test.rb +126 -0
- data/rails/railties/test/application/middleware/remote_ip_test.rb +78 -0
- data/rails/railties/test/application/middleware/sendfile_test.rb +74 -0
- data/rails/railties/test/application/middleware/session_test.rb +343 -0
- data/rails/railties/test/application/middleware/static_test.rb +31 -0
- data/rails/railties/test/application/middleware_test.rb +240 -0
- data/rails/railties/test/application/multiple_applications_test.rb +176 -0
- data/rails/railties/test/application/paths_test.rb +83 -0
- data/rails/railties/test/application/rack/logger_test.rb +56 -0
- data/rails/railties/test/application/rackup_test.rb +43 -0
- data/rails/railties/test/application/rake/dbs_test.rb +233 -0
- data/rails/railties/test/application/rake/migrations_test.rb +204 -0
- data/rails/railties/test/application/rake/notes_test.rb +156 -0
- data/rails/railties/test/application/rake_test.rb +286 -0
- data/rails/railties/test/application/rendering_test.rb +45 -0
- data/rails/railties/test/application/routing_test.rb +468 -0
- data/rails/railties/test/application/runner_test.rb +89 -0
- data/rails/railties/test/application/test_runner_test.rb +331 -0
- data/rails/railties/test/application/test_test.rb +322 -0
- data/rails/railties/test/application/url_generation_test.rb +46 -0
- data/rails/railties/test/backtrace_cleaner_test.rb +24 -0
- data/rails/railties/test/code_statistics_calculator_test.rb +288 -0
- data/rails/railties/test/commands/console_test.rb +176 -0
- data/rails/railties/test/commands/dbconsole_test.rb +274 -0
- data/rails/railties/test/commands/server_test.rb +88 -0
- data/rails/railties/test/configuration/middleware_stack_proxy_test.rb +61 -0
- data/rails/railties/test/engine_test.rb +25 -0
- data/rails/railties/test/env_helpers.rb +30 -0
- data/rails/railties/test/fixtures/about_yml_plugins/bad_about_yml/about.yml +1 -0
- data/rails/railties/test/fixtures/about_yml_plugins/bad_about_yml/init.rb +1 -0
- data/rails/railties/test/fixtures/about_yml_plugins/plugin_without_about_yml/init.rb +1 -0
- data/rails/railties/test/fixtures/lib/create_test_dummy_template.rb +1 -0
- data/rails/railties/test/fixtures/lib/generators/active_record/fixjour_generator.rb +8 -0
- data/rails/railties/test/fixtures/lib/generators/fixjour_generator.rb +2 -0
- data/rails/railties/test/fixtures/lib/generators/model_generator.rb +1 -0
- data/rails/railties/test/fixtures/lib/generators/usage_template/USAGE +1 -0
- data/rails/railties/test/fixtures/lib/generators/usage_template/usage_template_generator.rb +5 -0
- data/rails/railties/test/fixtures/lib/rails/generators/foobar/foobar_generator.rb +4 -0
- data/rails/railties/test/fixtures/lib/template.rb +1 -0
- data/rails/railties/test/generators/actions_test.rb +259 -0
- data/rails/railties/test/generators/app_generator_test.rb +528 -0
- data/rails/railties/test/generators/argv_scrubber_test.rb +136 -0
- data/rails/railties/test/generators/assets_generator_test.rb +19 -0
- data/rails/railties/test/generators/controller_generator_test.rb +101 -0
- data/rails/railties/test/generators/create_migration_test.rb +134 -0
- data/rails/railties/test/generators/generated_attribute_test.rb +152 -0
- data/rails/railties/test/generators/generator_generator_test.rb +71 -0
- data/rails/railties/test/generators/generator_test.rb +85 -0
- data/rails/railties/test/generators/generators_test_helper.rb +52 -0
- data/rails/railties/test/generators/helper_generator_test.rb +39 -0
- data/rails/railties/test/generators/integration_test_generator_test.rb +12 -0
- data/rails/railties/test/generators/mailer_generator_test.rb +170 -0
- data/rails/railties/test/generators/migration_generator_test.rb +288 -0
- data/rails/railties/test/generators/model_generator_test.rb +446 -0
- data/rails/railties/test/generators/named_base_test.rb +145 -0
- data/rails/railties/test/generators/namespaced_generators_test.rb +398 -0
- data/rails/railties/test/generators/orm_test.rb +38 -0
- data/rails/railties/test/generators/plugin_generator_test.rb +442 -0
- data/rails/railties/test/generators/resource_generator_test.rb +88 -0
- data/rails/railties/test/generators/scaffold_controller_generator_test.rb +177 -0
- data/rails/railties/test/generators/scaffold_generator_test.rb +386 -0
- data/rails/railties/test/generators/shared_generator_tests.rb +144 -0
- data/rails/railties/test/generators/task_generator_test.rb +24 -0
- data/rails/railties/test/generators_test.rb +234 -0
- data/rails/railties/test/initializable_test.rb +230 -0
- data/rails/railties/test/isolation/abstract_unit.rb +359 -0
- data/rails/railties/test/path_generation_test.rb +88 -0
- data/rails/railties/test/paths_test.rb +234 -0
- data/rails/railties/test/rack_logger_test.rb +75 -0
- data/rails/railties/test/rails_info_controller_test.rb +57 -0
- data/rails/railties/test/rails_info_test.rb +71 -0
- data/rails/railties/test/railties/engine_test.rb +1317 -0
- data/rails/railties/test/railties/generators_test.rb +126 -0
- data/rails/railties/test/railties/mounted_engine_test.rb +274 -0
- data/rails/railties/test/railties/railtie_test.rb +208 -0
- data/rails/railties/test/test_info_test.rb +60 -0
- data/rails/railties/test/version_test.rb +12 -0
- data/rails/tasks/release.rb +128 -0
- data/rails/tools/README.md +7 -0
- data/rails/tools/console +7 -0
- data/rails/tools/line_statistics +42 -0
- data/rails/tools/profile +136 -0
- data/rails/version.rb +15 -0
- data/test/cases/lock_test.rb +29 -0
- data/test/helper.rb +30 -0
- data/test/integration/lock_queuing_test.rb +43 -0
- metadata +3007 -0
@@ -0,0 +1,3461 @@
|
|
1
|
+
require 'abstract_unit'
|
2
|
+
require 'controller/fake_models'
|
3
|
+
|
4
|
+
class FormHelperTest < ActionView::TestCase
|
5
|
+
include RenderERBUtils
|
6
|
+
|
7
|
+
tests ActionView::Helpers::FormHelper
|
8
|
+
|
9
|
+
def form_for(*)
|
10
|
+
@output_buffer = super
|
11
|
+
end
|
12
|
+
|
13
|
+
teardown do
|
14
|
+
I18n.backend.reload!
|
15
|
+
end
|
16
|
+
|
17
|
+
setup do
|
18
|
+
# Create "label" locale for testing I18n label helpers
|
19
|
+
I18n.backend.store_translations 'label', {
|
20
|
+
activemodel: {
|
21
|
+
attributes: {
|
22
|
+
post: {
|
23
|
+
cost: "Total cost"
|
24
|
+
},
|
25
|
+
:"post/language" => {
|
26
|
+
spanish: "Espanol"
|
27
|
+
}
|
28
|
+
}
|
29
|
+
},
|
30
|
+
helpers: {
|
31
|
+
label: {
|
32
|
+
post: {
|
33
|
+
body: "Write entire text here",
|
34
|
+
color: {
|
35
|
+
red: "Rojo"
|
36
|
+
},
|
37
|
+
comments: {
|
38
|
+
body: "Write body here"
|
39
|
+
}
|
40
|
+
},
|
41
|
+
tag: {
|
42
|
+
value: "Tag"
|
43
|
+
},
|
44
|
+
post_delegate: {
|
45
|
+
title: 'Delegate model_name title'
|
46
|
+
}
|
47
|
+
}
|
48
|
+
}
|
49
|
+
}
|
50
|
+
|
51
|
+
# Create "submit" locale for testing I18n submit helpers
|
52
|
+
I18n.backend.store_translations 'submit', {
|
53
|
+
helpers: {
|
54
|
+
submit: {
|
55
|
+
create: 'Create %{model}',
|
56
|
+
update: 'Confirm %{model} changes',
|
57
|
+
submit: 'Save changes',
|
58
|
+
another_post: {
|
59
|
+
update: 'Update your %{model}'
|
60
|
+
}
|
61
|
+
}
|
62
|
+
}
|
63
|
+
}
|
64
|
+
|
65
|
+
I18n.backend.store_translations 'placeholder', {
|
66
|
+
activemodel: {
|
67
|
+
attributes: {
|
68
|
+
post: {
|
69
|
+
cost: "Total cost"
|
70
|
+
},
|
71
|
+
:"post/cost" => {
|
72
|
+
uk: "Pounds"
|
73
|
+
}
|
74
|
+
}
|
75
|
+
},
|
76
|
+
helpers: {
|
77
|
+
placeholder: {
|
78
|
+
post: {
|
79
|
+
title: "What is this about?",
|
80
|
+
written_on: {
|
81
|
+
spanish: "Escrito en"
|
82
|
+
},
|
83
|
+
comments: {
|
84
|
+
body: "Write body here"
|
85
|
+
}
|
86
|
+
},
|
87
|
+
post_delegate: {
|
88
|
+
title: 'Delegate model_name title'
|
89
|
+
},
|
90
|
+
tag: {
|
91
|
+
value: "Tag"
|
92
|
+
}
|
93
|
+
}
|
94
|
+
}
|
95
|
+
}
|
96
|
+
|
97
|
+
@post = Post.new
|
98
|
+
@comment = Comment.new
|
99
|
+
def @post.errors()
|
100
|
+
Class.new {
|
101
|
+
def [](field); field == "author_name" ? ["can't be empty"] : [] end
|
102
|
+
def empty?() false end
|
103
|
+
def count() 1 end
|
104
|
+
def full_messages() ["Author name can't be empty"] end
|
105
|
+
}.new
|
106
|
+
end
|
107
|
+
def @post.to_key; [123]; end
|
108
|
+
def @post.id; 0; end
|
109
|
+
def @post.id_before_type_cast; "omg"; end
|
110
|
+
def @post.id_came_from_user?; true; end
|
111
|
+
def @post.to_param; '123'; end
|
112
|
+
|
113
|
+
@post.persisted = true
|
114
|
+
@post.title = "Hello World"
|
115
|
+
@post.author_name = ""
|
116
|
+
@post.body = "Back to the hill and over it again!"
|
117
|
+
@post.secret = 1
|
118
|
+
@post.written_on = Date.new(2004, 6, 15)
|
119
|
+
|
120
|
+
@post.comments = []
|
121
|
+
@post.comments << @comment
|
122
|
+
|
123
|
+
@post.tags = []
|
124
|
+
@post.tags << Tag.new
|
125
|
+
|
126
|
+
@post_delegator = PostDelegator.new
|
127
|
+
|
128
|
+
@post_delegator.title = 'Hello World'
|
129
|
+
|
130
|
+
@car = Car.new("#000FFF")
|
131
|
+
end
|
132
|
+
|
133
|
+
Routes = ActionDispatch::Routing::RouteSet.new
|
134
|
+
Routes.draw do
|
135
|
+
resources :posts do
|
136
|
+
resources :comments
|
137
|
+
end
|
138
|
+
|
139
|
+
namespace :admin do
|
140
|
+
resources :posts do
|
141
|
+
resources :comments
|
142
|
+
end
|
143
|
+
end
|
144
|
+
|
145
|
+
get "/foo", to: "controller#action"
|
146
|
+
root to: "main#index"
|
147
|
+
end
|
148
|
+
|
149
|
+
def _routes
|
150
|
+
Routes
|
151
|
+
end
|
152
|
+
|
153
|
+
include Routes.url_helpers
|
154
|
+
|
155
|
+
def url_for(object)
|
156
|
+
@url_for_options = object
|
157
|
+
|
158
|
+
if object.is_a?(Hash) && object[:use_route].blank? && object[:controller].blank?
|
159
|
+
object.merge!(controller: "main", action: "index")
|
160
|
+
end
|
161
|
+
|
162
|
+
super
|
163
|
+
end
|
164
|
+
|
165
|
+
class FooTag < ActionView::Helpers::Tags::Base
|
166
|
+
def initialize; end
|
167
|
+
end
|
168
|
+
|
169
|
+
def test_tags_base_child_without_render_method
|
170
|
+
assert_raise(NotImplementedError) { FooTag.new.render }
|
171
|
+
end
|
172
|
+
|
173
|
+
def test_label
|
174
|
+
assert_dom_equal('<label for="post_title">Title</label>', label("post", "title"))
|
175
|
+
assert_dom_equal(
|
176
|
+
'<label for="post_title">The title goes here</label>',
|
177
|
+
label("post", "title", "The title goes here")
|
178
|
+
)
|
179
|
+
assert_dom_equal(
|
180
|
+
'<label class="title_label" for="post_title">Title</label>',
|
181
|
+
label("post", "title", nil, class: 'title_label')
|
182
|
+
)
|
183
|
+
assert_dom_equal('<label for="post_secret">Secret?</label>', label("post", "secret?"))
|
184
|
+
end
|
185
|
+
|
186
|
+
def test_label_with_symbols
|
187
|
+
assert_dom_equal('<label for="post_title">Title</label>', label(:post, :title))
|
188
|
+
assert_dom_equal('<label for="post_secret">Secret?</label>', label(:post, :secret?))
|
189
|
+
end
|
190
|
+
|
191
|
+
def test_label_with_locales_strings
|
192
|
+
with_locale :label do
|
193
|
+
assert_dom_equal('<label for="post_body">Write entire text here</label>', label("post", "body"))
|
194
|
+
end
|
195
|
+
end
|
196
|
+
|
197
|
+
def test_label_with_human_attribute_name
|
198
|
+
with_locale :label do
|
199
|
+
assert_dom_equal('<label for="post_cost">Total cost</label>', label(:post, :cost))
|
200
|
+
end
|
201
|
+
end
|
202
|
+
|
203
|
+
def test_label_with_human_attribute_name_and_options
|
204
|
+
with_locale :label do
|
205
|
+
assert_dom_equal('<label for="post_language_spanish">Espanol</label>', label(:post, :language, value: "spanish"))
|
206
|
+
end
|
207
|
+
end
|
208
|
+
|
209
|
+
def test_label_with_locales_symbols
|
210
|
+
with_locale :label do
|
211
|
+
assert_dom_equal('<label for="post_body">Write entire text here</label>', label(:post, :body))
|
212
|
+
end
|
213
|
+
end
|
214
|
+
|
215
|
+
def test_label_with_locales_and_options
|
216
|
+
with_locale :label do
|
217
|
+
assert_dom_equal(
|
218
|
+
'<label for="post_body" class="post_body">Write entire text here</label>',
|
219
|
+
label(:post, :body, class: "post_body")
|
220
|
+
)
|
221
|
+
end
|
222
|
+
end
|
223
|
+
|
224
|
+
def test_label_with_locales_and_value
|
225
|
+
with_locale :label do
|
226
|
+
assert_dom_equal('<label for="post_color_red">Rojo</label>', label(:post, :color, value: "red"))
|
227
|
+
end
|
228
|
+
end
|
229
|
+
|
230
|
+
def test_label_with_locales_and_nested_attributes
|
231
|
+
with_locale :label do
|
232
|
+
form_for(@post, html: { id: 'create-post' }) do |f|
|
233
|
+
f.fields_for(:comments) do |cf|
|
234
|
+
concat cf.label(:body)
|
235
|
+
end
|
236
|
+
end
|
237
|
+
|
238
|
+
expected = whole_form("/posts/123", "create-post", "edit_post", method: "patch") do
|
239
|
+
'<label for="post_comments_attributes_0_body">Write body here</label>'
|
240
|
+
end
|
241
|
+
|
242
|
+
assert_dom_equal expected, output_buffer
|
243
|
+
end
|
244
|
+
end
|
245
|
+
|
246
|
+
def test_label_with_locales_fallback_and_nested_attributes
|
247
|
+
with_locale :label do
|
248
|
+
form_for(@post, html: { id: 'create-post' }) do |f|
|
249
|
+
f.fields_for(:tags) do |cf|
|
250
|
+
concat cf.label(:value)
|
251
|
+
end
|
252
|
+
end
|
253
|
+
|
254
|
+
expected = whole_form("/posts/123", "create-post", "edit_post", method: "patch") do
|
255
|
+
'<label for="post_tags_attributes_0_value">Tag</label>'
|
256
|
+
end
|
257
|
+
|
258
|
+
assert_dom_equal expected, output_buffer
|
259
|
+
end
|
260
|
+
end
|
261
|
+
|
262
|
+
def test_label_with_non_active_record_object
|
263
|
+
form_for(OpenStruct.new(name:'ok'), as: 'person', url: 'an_url', html: { id: 'create-person' }) do |f|
|
264
|
+
f.label(:name)
|
265
|
+
end
|
266
|
+
|
267
|
+
expected = whole_form("an_url", "create-person", "new_person", method: "post") do
|
268
|
+
'<label for="person_name">Name</label>'
|
269
|
+
end
|
270
|
+
|
271
|
+
assert_dom_equal expected, output_buffer
|
272
|
+
end
|
273
|
+
|
274
|
+
def test_label_with_for_attribute_as_symbol
|
275
|
+
assert_dom_equal('<label for="my_for">Title</label>', label(:post, :title, nil, for: "my_for"))
|
276
|
+
end
|
277
|
+
|
278
|
+
def test_label_with_for_attribute_as_string
|
279
|
+
assert_dom_equal('<label for="my_for">Title</label>', label(:post, :title, nil, "for" => "my_for"))
|
280
|
+
end
|
281
|
+
|
282
|
+
def test_label_does_not_generate_for_attribute_when_given_nil
|
283
|
+
assert_dom_equal('<label>Title</label>', label(:post, :title, for: nil))
|
284
|
+
end
|
285
|
+
|
286
|
+
def test_label_with_id_attribute_as_symbol
|
287
|
+
assert_dom_equal(
|
288
|
+
'<label for="post_title" id="my_id">Title</label>',
|
289
|
+
label(:post, :title, nil, id: "my_id")
|
290
|
+
)
|
291
|
+
end
|
292
|
+
|
293
|
+
def test_label_with_id_attribute_as_string
|
294
|
+
assert_dom_equal(
|
295
|
+
'<label for="post_title" id="my_id">Title</label>',
|
296
|
+
label(:post, :title, nil, "id" => "my_id")
|
297
|
+
)
|
298
|
+
end
|
299
|
+
|
300
|
+
def test_label_with_for_and_id_attributes_as_symbol
|
301
|
+
assert_dom_equal(
|
302
|
+
'<label for="my_for" id="my_id">Title</label>',
|
303
|
+
label(:post, :title, nil, for: "my_for", id: "my_id")
|
304
|
+
)
|
305
|
+
end
|
306
|
+
|
307
|
+
def test_label_with_for_and_id_attributes_as_string
|
308
|
+
assert_dom_equal(
|
309
|
+
'<label for="my_for" id="my_id">Title</label>',
|
310
|
+
label(:post, :title, nil, "for" => "my_for", "id" => "my_id")
|
311
|
+
)
|
312
|
+
end
|
313
|
+
|
314
|
+
def test_label_for_radio_buttons_with_value
|
315
|
+
assert_dom_equal(
|
316
|
+
'<label for="post_title_great_title">The title goes here</label>',
|
317
|
+
label("post", "title", "The title goes here", value: "great_title")
|
318
|
+
)
|
319
|
+
assert_dom_equal(
|
320
|
+
'<label for="post_title_great_title">The title goes here</label>',
|
321
|
+
label("post", "title", "The title goes here", value: "great title")
|
322
|
+
)
|
323
|
+
end
|
324
|
+
|
325
|
+
def test_label_with_block
|
326
|
+
assert_dom_equal(
|
327
|
+
'<label for="post_title">The title, please:</label>',
|
328
|
+
label(:post, :title) { "The title, please:" }
|
329
|
+
)
|
330
|
+
end
|
331
|
+
|
332
|
+
def test_label_with_block_and_html
|
333
|
+
assert_dom_equal(
|
334
|
+
'<label for="post_terms">Accept <a href="/terms">Terms</a>.</label>',
|
335
|
+
label(:post, :terms) { 'Accept <a href="/terms">Terms</a>.'.html_safe }
|
336
|
+
)
|
337
|
+
end
|
338
|
+
|
339
|
+
def test_label_with_block_and_options
|
340
|
+
assert_dom_equal(
|
341
|
+
'<label for="my_for">The title, please:</label>',
|
342
|
+
label(:post, :title, "for" => "my_for") { "The title, please:" }
|
343
|
+
)
|
344
|
+
end
|
345
|
+
|
346
|
+
def test_label_with_block_and_builder
|
347
|
+
with_locale :label do
|
348
|
+
assert_dom_equal(
|
349
|
+
'<label for="post_body"><b>Write entire text here</b></label>',
|
350
|
+
label(:post, :body) { |b| "<b>#{b.translation}</b>".html_safe }
|
351
|
+
)
|
352
|
+
end
|
353
|
+
end
|
354
|
+
|
355
|
+
def test_label_with_block_in_erb
|
356
|
+
assert_dom_equal(
|
357
|
+
%{<label for="post_message">\n Message\n <input id="post_message" name="post[message]" type="text" />\n</label>},
|
358
|
+
view.render("test/label_with_block")
|
359
|
+
)
|
360
|
+
end
|
361
|
+
|
362
|
+
def test_label_with_to_model
|
363
|
+
assert_dom_equal(
|
364
|
+
%{<label for="post_delegator_title">Delegate Title</label>},
|
365
|
+
label(:post_delegator, :title)
|
366
|
+
)
|
367
|
+
end
|
368
|
+
|
369
|
+
def test_label_with_to_model_and_overriden_model_name
|
370
|
+
with_locale :label do
|
371
|
+
assert_dom_equal(
|
372
|
+
%{<label for="post_delegator_title">Delegate model_name title</label>},
|
373
|
+
label(:post_delegator, :title)
|
374
|
+
)
|
375
|
+
end
|
376
|
+
end
|
377
|
+
|
378
|
+
def test_text_field_placeholder_without_locales
|
379
|
+
with_locale :placeholder do
|
380
|
+
assert_dom_equal('<input id="post_body" name="post[body]" placeholder="Body" type="text" value="Back to the hill and over it again!" />', text_field(:post, :body, placeholder: true))
|
381
|
+
end
|
382
|
+
end
|
383
|
+
|
384
|
+
def test_text_field_placeholder_with_locales
|
385
|
+
with_locale :placeholder do
|
386
|
+
assert_dom_equal('<input id="post_title" name="post[title]" placeholder="What is this about?" type="text" value="Hello World" />', text_field(:post, :title, placeholder: true))
|
387
|
+
end
|
388
|
+
end
|
389
|
+
|
390
|
+
def test_text_field_placeholder_with_locales_and_to_model
|
391
|
+
with_locale :placeholder do
|
392
|
+
assert_dom_equal(
|
393
|
+
'<input id="post_delegator_title" name="post_delegator[title]" placeholder="Delegate model_name title" type="text" value="Hello World" />',
|
394
|
+
text_field(:post_delegator, :title, placeholder: true)
|
395
|
+
)
|
396
|
+
end
|
397
|
+
end
|
398
|
+
|
399
|
+
def test_text_field_placeholder_with_human_attribute_name
|
400
|
+
with_locale :placeholder do
|
401
|
+
assert_dom_equal('<input id="post_cost" name="post[cost]" placeholder="Total cost" type="text" />', text_field(:post, :cost, placeholder: true))
|
402
|
+
end
|
403
|
+
end
|
404
|
+
|
405
|
+
def test_text_field_placeholder_with_human_attribute_name_and_to_model
|
406
|
+
assert_dom_equal(
|
407
|
+
'<input id="post_delegator_title" name="post_delegator[title]" placeholder="Delegate Title" type="text" value="Hello World" />',
|
408
|
+
text_field(:post_delegator, :title, placeholder: true)
|
409
|
+
)
|
410
|
+
end
|
411
|
+
|
412
|
+
def test_text_field_placeholder_with_string_value
|
413
|
+
with_locale :placeholder do
|
414
|
+
assert_dom_equal('<input id="post_cost" name="post[cost]" placeholder="HOW MUCH?" type="text" />', text_field(:post, :cost, placeholder: "HOW MUCH?"))
|
415
|
+
end
|
416
|
+
end
|
417
|
+
|
418
|
+
def test_text_field_placeholder_with_human_attribute_name_and_value
|
419
|
+
with_locale :placeholder do
|
420
|
+
assert_dom_equal('<input id="post_cost" name="post[cost]" placeholder="Pounds" type="text" />', text_field(:post, :cost, placeholder: :uk))
|
421
|
+
end
|
422
|
+
end
|
423
|
+
|
424
|
+
def test_text_field_placeholder_with_locales_and_value
|
425
|
+
with_locale :placeholder do
|
426
|
+
assert_dom_equal('<input id="post_written_on" name="post[written_on]" placeholder="Escrito en" type="text" value="2004-06-15" />', text_field(:post, :written_on, placeholder: :spanish))
|
427
|
+
end
|
428
|
+
end
|
429
|
+
|
430
|
+
def test_text_field_placeholder_with_locales_and_nested_attributes
|
431
|
+
with_locale :placeholder do
|
432
|
+
form_for(@post, html: { id: 'create-post' }) do |f|
|
433
|
+
f.fields_for(:comments) do |cf|
|
434
|
+
concat cf.text_field(:body, placeholder: true)
|
435
|
+
end
|
436
|
+
end
|
437
|
+
|
438
|
+
expected = whole_form("/posts/123", "create-post", "edit_post", method: "patch") do
|
439
|
+
'<input id="post_comments_attributes_0_body" name="post[comments_attributes][0][body]" placeholder="Write body here" type="text" />'
|
440
|
+
end
|
441
|
+
|
442
|
+
assert_dom_equal expected, output_buffer
|
443
|
+
end
|
444
|
+
end
|
445
|
+
|
446
|
+
def test_text_field_placeholder_with_locales_fallback_and_nested_attributes
|
447
|
+
with_locale :placeholder do
|
448
|
+
form_for(@post, html: { id: 'create-post' }) do |f|
|
449
|
+
f.fields_for(:tags) do |cf|
|
450
|
+
concat cf.text_field(:value, placeholder: true)
|
451
|
+
end
|
452
|
+
end
|
453
|
+
|
454
|
+
expected = whole_form("/posts/123", "create-post", "edit_post", method: "patch") do
|
455
|
+
'<input id="post_tags_attributes_0_value" name="post[tags_attributes][0][value]" placeholder="Tag" type="text" value="new tag" />'
|
456
|
+
end
|
457
|
+
|
458
|
+
assert_dom_equal expected, output_buffer
|
459
|
+
end
|
460
|
+
end
|
461
|
+
|
462
|
+
def test_text_field
|
463
|
+
assert_dom_equal(
|
464
|
+
'<input id="post_title" name="post[title]" type="text" value="Hello World" />',
|
465
|
+
text_field("post", "title")
|
466
|
+
)
|
467
|
+
assert_dom_equal(
|
468
|
+
'<input id="post_title" name="post[title]" type="password" />',
|
469
|
+
password_field("post", "title")
|
470
|
+
)
|
471
|
+
assert_dom_equal(
|
472
|
+
'<input id="post_title" name="post[title]" type="password" value="Hello World" />',
|
473
|
+
password_field("post", "title", value: @post.title)
|
474
|
+
)
|
475
|
+
assert_dom_equal(
|
476
|
+
'<input id="person_name" name="person[name]" type="password" />',
|
477
|
+
password_field("person", "name")
|
478
|
+
)
|
479
|
+
end
|
480
|
+
|
481
|
+
def test_text_field_with_escapes
|
482
|
+
@post.title = "<b>Hello World</b>"
|
483
|
+
assert_dom_equal(
|
484
|
+
'<input id="post_title" name="post[title]" type="text" value="<b>Hello World</b>" />',
|
485
|
+
text_field("post", "title")
|
486
|
+
)
|
487
|
+
end
|
488
|
+
|
489
|
+
def test_text_field_with_html_entities
|
490
|
+
@post.title = "The HTML Entity for & is &"
|
491
|
+
assert_dom_equal(
|
492
|
+
'<input id="post_title" name="post[title]" type="text" value="The HTML Entity for & is &amp;" />',
|
493
|
+
text_field("post", "title")
|
494
|
+
)
|
495
|
+
end
|
496
|
+
|
497
|
+
def test_text_field_with_options
|
498
|
+
expected = '<input id="post_title" name="post[title]" size="35" type="text" value="Hello World" />'
|
499
|
+
assert_dom_equal expected, text_field("post", "title", "size" => 35)
|
500
|
+
assert_dom_equal expected, text_field("post", "title", size: 35)
|
501
|
+
end
|
502
|
+
|
503
|
+
def test_text_field_assuming_size
|
504
|
+
expected = '<input id="post_title" maxlength="35" name="post[title]" size="35" type="text" value="Hello World" />'
|
505
|
+
assert_dom_equal expected, text_field("post", "title", "maxlength" => 35)
|
506
|
+
assert_dom_equal expected, text_field("post", "title", maxlength: 35)
|
507
|
+
end
|
508
|
+
|
509
|
+
def test_text_field_removing_size
|
510
|
+
expected = '<input id="post_title" maxlength="35" name="post[title]" type="text" value="Hello World" />'
|
511
|
+
assert_dom_equal expected, text_field("post", "title", "maxlength" => 35, "size" => nil)
|
512
|
+
assert_dom_equal expected, text_field("post", "title", maxlength: 35, size: nil)
|
513
|
+
end
|
514
|
+
|
515
|
+
def test_text_field_with_nil_value
|
516
|
+
expected = '<input id="post_title" name="post[title]" type="text" />'
|
517
|
+
assert_dom_equal expected, text_field("post", "title", value: nil)
|
518
|
+
end
|
519
|
+
|
520
|
+
def test_text_field_with_nil_name
|
521
|
+
expected = '<input id="post_title" type="text" value="Hello World" />'
|
522
|
+
assert_dom_equal expected, text_field("post", "title", name: nil)
|
523
|
+
end
|
524
|
+
|
525
|
+
def test_text_field_doesnt_change_param_values
|
526
|
+
object_name = 'post[]'
|
527
|
+
expected = '<input id="post_123_title" name="post[123][title]" type="text" value="Hello World" />'
|
528
|
+
assert_dom_equal expected, text_field(object_name, "title")
|
529
|
+
end
|
530
|
+
|
531
|
+
def test_file_field_has_no_size
|
532
|
+
expected = '<input id="user_avatar" name="user[avatar]" type="file" />'
|
533
|
+
assert_dom_equal expected, file_field("user", "avatar")
|
534
|
+
end
|
535
|
+
|
536
|
+
def test_file_field_with_multiple_behavior
|
537
|
+
expected = '<input id="import_file" multiple="multiple" name="import[file][]" type="file" />'
|
538
|
+
assert_dom_equal expected, file_field("import", "file", :multiple => true)
|
539
|
+
end
|
540
|
+
|
541
|
+
def test_file_field_with_multiple_behavior_and_explicit_name
|
542
|
+
expected = '<input id="import_file" multiple="multiple" name="custom" type="file" />'
|
543
|
+
assert_dom_equal expected, file_field("import", "file", :multiple => true, :name => "custom")
|
544
|
+
end
|
545
|
+
|
546
|
+
def test_hidden_field
|
547
|
+
assert_dom_equal(
|
548
|
+
'<input id="post_title" name="post[title]" type="hidden" value="Hello World" />',
|
549
|
+
hidden_field("post", "title")
|
550
|
+
)
|
551
|
+
assert_dom_equal(
|
552
|
+
'<input id="post_secret" name="post[secret]" type="hidden" value="1" />',
|
553
|
+
hidden_field("post", "secret?")
|
554
|
+
)
|
555
|
+
end
|
556
|
+
|
557
|
+
def test_hidden_field_with_escapes
|
558
|
+
@post.title = "<b>Hello World</b>"
|
559
|
+
assert_dom_equal(
|
560
|
+
'<input id="post_title" name="post[title]" type="hidden" value="<b>Hello World</b>" />',
|
561
|
+
hidden_field("post", "title")
|
562
|
+
)
|
563
|
+
end
|
564
|
+
|
565
|
+
def test_hidden_field_with_nil_value
|
566
|
+
expected = '<input id="post_title" name="post[title]" type="hidden" />'
|
567
|
+
assert_dom_equal expected, hidden_field("post", "title", value: nil)
|
568
|
+
end
|
569
|
+
|
570
|
+
def test_hidden_field_with_options
|
571
|
+
assert_dom_equal(
|
572
|
+
'<input id="post_title" name="post[title]" type="hidden" value="Something Else" />',
|
573
|
+
hidden_field("post", "title", value: "Something Else")
|
574
|
+
)
|
575
|
+
end
|
576
|
+
|
577
|
+
def test_text_field_with_custom_type
|
578
|
+
assert_dom_equal(
|
579
|
+
'<input id="user_email" name="user[email]" type="email" />',
|
580
|
+
text_field("user", "email", type: "email")
|
581
|
+
)
|
582
|
+
end
|
583
|
+
|
584
|
+
def test_check_box_is_html_safe
|
585
|
+
assert check_box("post", "secret").html_safe?
|
586
|
+
end
|
587
|
+
|
588
|
+
def test_check_box_checked_if_object_value_is_same_that_check_value
|
589
|
+
assert_dom_equal(
|
590
|
+
'<input name="post[secret]" type="hidden" value="0" /><input checked="checked" id="post_secret" name="post[secret]" type="checkbox" value="1" />',
|
591
|
+
check_box("post", "secret")
|
592
|
+
)
|
593
|
+
end
|
594
|
+
|
595
|
+
def test_check_box_not_checked_if_object_value_is_same_that_unchecked_value
|
596
|
+
@post.secret = 0
|
597
|
+
assert_dom_equal(
|
598
|
+
'<input name="post[secret]" type="hidden" value="0" /><input id="post_secret" name="post[secret]" type="checkbox" value="1" />',
|
599
|
+
check_box("post", "secret")
|
600
|
+
)
|
601
|
+
end
|
602
|
+
|
603
|
+
def test_check_box_checked_if_option_checked_is_present
|
604
|
+
assert_dom_equal(
|
605
|
+
'<input name="post[secret]" type="hidden" value="0" /><input checked="checked" id="post_secret" name="post[secret]" type="checkbox" value="1" />',
|
606
|
+
check_box("post", "secret", "checked"=>"checked")
|
607
|
+
)
|
608
|
+
end
|
609
|
+
|
610
|
+
def test_check_box_checked_if_object_value_is_true
|
611
|
+
@post.secret = true
|
612
|
+
assert_dom_equal(
|
613
|
+
'<input name="post[secret]" type="hidden" value="0" /><input checked="checked" id="post_secret" name="post[secret]" type="checkbox" value="1" />',
|
614
|
+
check_box("post", "secret")
|
615
|
+
)
|
616
|
+
|
617
|
+
assert_dom_equal(
|
618
|
+
'<input name="post[secret]" type="hidden" value="0" /><input checked="checked" id="post_secret" name="post[secret]" type="checkbox" value="1" />',
|
619
|
+
check_box("post", "secret?")
|
620
|
+
)
|
621
|
+
end
|
622
|
+
|
623
|
+
def test_check_box_checked_if_object_value_includes_checked_value
|
624
|
+
@post.secret = ['0']
|
625
|
+
assert_dom_equal(
|
626
|
+
'<input name="post[secret]" type="hidden" value="0" /><input id="post_secret" name="post[secret]" type="checkbox" value="1" />',
|
627
|
+
check_box("post", "secret")
|
628
|
+
)
|
629
|
+
|
630
|
+
@post.secret = ['1']
|
631
|
+
assert_dom_equal(
|
632
|
+
'<input name="post[secret]" type="hidden" value="0" /><input checked="checked" id="post_secret" name="post[secret]" type="checkbox" value="1" />',
|
633
|
+
check_box("post", "secret")
|
634
|
+
)
|
635
|
+
|
636
|
+
@post.secret = Set.new(['1'])
|
637
|
+
assert_dom_equal(
|
638
|
+
'<input name="post[secret]" type="hidden" value="0" /><input checked="checked" id="post_secret" name="post[secret]" type="checkbox" value="1" />',
|
639
|
+
check_box("post", "secret")
|
640
|
+
)
|
641
|
+
end
|
642
|
+
|
643
|
+
def test_check_box_with_include_hidden_false
|
644
|
+
@post.secret = false
|
645
|
+
assert_dom_equal(
|
646
|
+
'<input id="post_secret" name="post[secret]" type="checkbox" value="1" />',
|
647
|
+
check_box("post", "secret", include_hidden: false)
|
648
|
+
)
|
649
|
+
end
|
650
|
+
|
651
|
+
def test_check_box_with_explicit_checked_and_unchecked_values_when_object_value_is_string
|
652
|
+
@post.secret = "on"
|
653
|
+
assert_dom_equal(
|
654
|
+
'<input name="post[secret]" type="hidden" value="off" /><input checked="checked" id="post_secret" name="post[secret]" type="checkbox" value="on" />',
|
655
|
+
check_box("post", "secret", {}, "on", "off")
|
656
|
+
)
|
657
|
+
|
658
|
+
@post.secret = "off"
|
659
|
+
assert_dom_equal(
|
660
|
+
'<input name="post[secret]" type="hidden" value="off" /><input id="post_secret" name="post[secret]" type="checkbox" value="on" />',
|
661
|
+
check_box("post", "secret", {}, "on", "off")
|
662
|
+
)
|
663
|
+
end
|
664
|
+
|
665
|
+
def test_check_box_with_explicit_checked_and_unchecked_values_when_object_value_is_boolean
|
666
|
+
@post.secret = false
|
667
|
+
assert_dom_equal(
|
668
|
+
'<input name="post[secret]" type="hidden" value="true" /><input checked="checked" id="post_secret" name="post[secret]" type="checkbox" value="false" />',
|
669
|
+
check_box("post", "secret", {}, false, true)
|
670
|
+
)
|
671
|
+
|
672
|
+
@post.secret = true
|
673
|
+
assert_dom_equal(
|
674
|
+
'<input name="post[secret]" type="hidden" value="true" /><input id="post_secret" name="post[secret]" type="checkbox" value="false" />',
|
675
|
+
check_box("post", "secret", {}, false, true)
|
676
|
+
)
|
677
|
+
end
|
678
|
+
|
679
|
+
def test_check_box_with_explicit_checked_and_unchecked_values_when_object_value_is_integer
|
680
|
+
@post.secret = 0
|
681
|
+
assert_dom_equal(
|
682
|
+
'<input name="post[secret]" type="hidden" value="1" /><input checked="checked" id="post_secret" name="post[secret]" type="checkbox" value="0" />',
|
683
|
+
check_box("post", "secret", {}, 0, 1)
|
684
|
+
)
|
685
|
+
|
686
|
+
@post.secret = 1
|
687
|
+
assert_dom_equal(
|
688
|
+
'<input name="post[secret]" type="hidden" value="1" /><input id="post_secret" name="post[secret]" type="checkbox" value="0" />',
|
689
|
+
check_box("post", "secret", {}, 0, 1)
|
690
|
+
)
|
691
|
+
|
692
|
+
@post.secret = 2
|
693
|
+
assert_dom_equal(
|
694
|
+
'<input name="post[secret]" type="hidden" value="1" /><input id="post_secret" name="post[secret]" type="checkbox" value="0" />',
|
695
|
+
check_box("post", "secret", {}, 0, 1)
|
696
|
+
)
|
697
|
+
end
|
698
|
+
|
699
|
+
def test_check_box_with_explicit_checked_and_unchecked_values_when_object_value_is_float
|
700
|
+
@post.secret = 0.0
|
701
|
+
assert_dom_equal(
|
702
|
+
'<input name="post[secret]" type="hidden" value="1" /><input checked="checked" id="post_secret" name="post[secret]" type="checkbox" value="0" />',
|
703
|
+
check_box("post", "secret", {}, 0, 1)
|
704
|
+
)
|
705
|
+
|
706
|
+
@post.secret = 1.1
|
707
|
+
assert_dom_equal(
|
708
|
+
'<input name="post[secret]" type="hidden" value="1" /><input id="post_secret" name="post[secret]" type="checkbox" value="0" />',
|
709
|
+
check_box("post", "secret", {}, 0, 1)
|
710
|
+
)
|
711
|
+
|
712
|
+
@post.secret = 2.2
|
713
|
+
assert_dom_equal(
|
714
|
+
'<input name="post[secret]" type="hidden" value="1" /><input id="post_secret" name="post[secret]" type="checkbox" value="0" />',
|
715
|
+
check_box("post", "secret", {}, 0, 1)
|
716
|
+
)
|
717
|
+
end
|
718
|
+
|
719
|
+
def test_check_box_with_explicit_checked_and_unchecked_values_when_object_value_is_big_decimal
|
720
|
+
@post.secret = BigDecimal.new(0)
|
721
|
+
assert_dom_equal(
|
722
|
+
'<input name="post[secret]" type="hidden" value="1" /><input checked="checked" id="post_secret" name="post[secret]" type="checkbox" value="0" />',
|
723
|
+
check_box("post", "secret", {}, 0, 1)
|
724
|
+
)
|
725
|
+
|
726
|
+
@post.secret = BigDecimal.new(1)
|
727
|
+
assert_dom_equal(
|
728
|
+
'<input name="post[secret]" type="hidden" value="1" /><input id="post_secret" name="post[secret]" type="checkbox" value="0" />',
|
729
|
+
check_box("post", "secret", {}, 0, 1)
|
730
|
+
)
|
731
|
+
|
732
|
+
@post.secret = BigDecimal.new(2.2, 1)
|
733
|
+
assert_dom_equal(
|
734
|
+
'<input name="post[secret]" type="hidden" value="1" /><input id="post_secret" name="post[secret]" type="checkbox" value="0" />',
|
735
|
+
check_box("post", "secret", {}, 0, 1)
|
736
|
+
)
|
737
|
+
end
|
738
|
+
|
739
|
+
def test_check_box_with_nil_unchecked_value
|
740
|
+
@post.secret = "on"
|
741
|
+
assert_dom_equal(
|
742
|
+
'<input checked="checked" id="post_secret" name="post[secret]" type="checkbox" value="on" />',
|
743
|
+
check_box("post", "secret", {}, "on", nil)
|
744
|
+
)
|
745
|
+
end
|
746
|
+
|
747
|
+
def test_check_box_with_nil_unchecked_value_is_html_safe
|
748
|
+
assert check_box("post", "secret", {}, "on", nil).html_safe?
|
749
|
+
end
|
750
|
+
|
751
|
+
def test_check_box_with_multiple_behavior
|
752
|
+
@post.comment_ids = [2,3]
|
753
|
+
assert_dom_equal(
|
754
|
+
'<input name="post[comment_ids][]" type="hidden" value="0" /><input id="post_comment_ids_1" name="post[comment_ids][]" type="checkbox" value="1" />',
|
755
|
+
check_box("post", "comment_ids", { multiple: true }, 1)
|
756
|
+
)
|
757
|
+
assert_dom_equal(
|
758
|
+
'<input name="post[comment_ids][]" type="hidden" value="0" /><input checked="checked" id="post_comment_ids_3" name="post[comment_ids][]" type="checkbox" value="3" />',
|
759
|
+
check_box("post", "comment_ids", { multiple: true }, 3)
|
760
|
+
)
|
761
|
+
end
|
762
|
+
|
763
|
+
def test_check_box_with_multiple_behavior_and_index
|
764
|
+
@post.comment_ids = [2,3]
|
765
|
+
assert_dom_equal(
|
766
|
+
'<input name="post[foo][comment_ids][]" type="hidden" value="0" /><input id="post_foo_comment_ids_1" name="post[foo][comment_ids][]" type="checkbox" value="1" />',
|
767
|
+
check_box("post", "comment_ids", { multiple: true, index: "foo" }, 1)
|
768
|
+
)
|
769
|
+
assert_dom_equal(
|
770
|
+
'<input name="post[bar][comment_ids][]" type="hidden" value="0" /><input checked="checked" id="post_bar_comment_ids_3" name="post[bar][comment_ids][]" type="checkbox" value="3" />',
|
771
|
+
check_box("post", "comment_ids", { multiple: true, index: "bar" }, 3)
|
772
|
+
)
|
773
|
+
|
774
|
+
end
|
775
|
+
|
776
|
+
def test_checkbox_disabled_disables_hidden_field
|
777
|
+
assert_dom_equal(
|
778
|
+
'<input name="post[secret]" type="hidden" value="0" disabled="disabled"/><input checked="checked" disabled="disabled" id="post_secret" name="post[secret]" type="checkbox" value="1" />',
|
779
|
+
check_box("post", "secret", { disabled: true })
|
780
|
+
)
|
781
|
+
end
|
782
|
+
|
783
|
+
def test_checkbox_form_html5_attribute
|
784
|
+
assert_dom_equal(
|
785
|
+
'<input form="new_form" name="post[secret]" type="hidden" value="0" /><input checked="checked" form="new_form" id="post_secret" name="post[secret]" type="checkbox" value="1" />',
|
786
|
+
check_box("post", "secret", form: "new_form")
|
787
|
+
)
|
788
|
+
end
|
789
|
+
|
790
|
+
def test_radio_button
|
791
|
+
assert_dom_equal('<input checked="checked" id="post_title_hello_world" name="post[title]" type="radio" value="Hello World" />',
|
792
|
+
radio_button("post", "title", "Hello World")
|
793
|
+
)
|
794
|
+
assert_dom_equal('<input id="post_title_goodbye_world" name="post[title]" type="radio" value="Goodbye World" />',
|
795
|
+
radio_button("post", "title", "Goodbye World")
|
796
|
+
)
|
797
|
+
assert_dom_equal('<input id="item_subobject_title_inside_world" name="item[subobject][title]" type="radio" value="inside world"/>',
|
798
|
+
radio_button("item[subobject]", "title", "inside world")
|
799
|
+
)
|
800
|
+
end
|
801
|
+
|
802
|
+
def test_radio_button_is_checked_with_integers
|
803
|
+
assert_dom_equal('<input checked="checked" id="post_secret_1" name="post[secret]" type="radio" value="1" />',
|
804
|
+
radio_button("post", "secret", "1")
|
805
|
+
)
|
806
|
+
end
|
807
|
+
|
808
|
+
def test_radio_button_with_negative_integer_value
|
809
|
+
assert_dom_equal('<input id="post_secret_-1" name="post[secret]" type="radio" value="-1" />',
|
810
|
+
radio_button("post", "secret", "-1"))
|
811
|
+
end
|
812
|
+
|
813
|
+
def test_radio_button_respects_passed_in_id
|
814
|
+
assert_dom_equal('<input checked="checked" id="foo" name="post[secret]" type="radio" value="1" />',
|
815
|
+
radio_button("post", "secret", "1", id: "foo")
|
816
|
+
)
|
817
|
+
end
|
818
|
+
|
819
|
+
def test_radio_button_with_booleans
|
820
|
+
assert_dom_equal('<input id="post_secret_true" name="post[secret]" type="radio" value="true" />',
|
821
|
+
radio_button("post", "secret", true)
|
822
|
+
)
|
823
|
+
|
824
|
+
assert_dom_equal('<input id="post_secret_false" name="post[secret]" type="radio" value="false" />',
|
825
|
+
radio_button("post", "secret", false)
|
826
|
+
)
|
827
|
+
end
|
828
|
+
|
829
|
+
def test_text_area_placeholder_without_locales
|
830
|
+
with_locale :placeholder do
|
831
|
+
assert_dom_equal(
|
832
|
+
%{<textarea id="post_body" name="post[body]" placeholder="Body">\nBack to the hill and over it again!</textarea>},
|
833
|
+
text_area(:post, :body, placeholder: true)
|
834
|
+
)
|
835
|
+
end
|
836
|
+
end
|
837
|
+
|
838
|
+
def test_text_area_placeholder_with_locales
|
839
|
+
with_locale :placeholder do
|
840
|
+
assert_dom_equal(
|
841
|
+
%{<textarea id="post_title" name="post[title]" placeholder="What is this about?">\nHello World</textarea>},
|
842
|
+
text_area(:post, :title, placeholder: true)
|
843
|
+
)
|
844
|
+
end
|
845
|
+
end
|
846
|
+
|
847
|
+
def test_text_area_placeholder_with_human_attribute_name
|
848
|
+
with_locale :placeholder do
|
849
|
+
assert_dom_equal(
|
850
|
+
%{<textarea id="post_cost" name="post[cost]" placeholder="Total cost">\n</textarea>},
|
851
|
+
text_area(:post, :cost, placeholder: true)
|
852
|
+
)
|
853
|
+
end
|
854
|
+
end
|
855
|
+
|
856
|
+
def test_text_area_placeholder_with_string_value
|
857
|
+
with_locale :placeholder do
|
858
|
+
assert_dom_equal(
|
859
|
+
%{<textarea id="post_cost" name="post[cost]" placeholder="HOW MUCH?">\n</textarea>},
|
860
|
+
text_area(:post, :cost, placeholder: "HOW MUCH?")
|
861
|
+
)
|
862
|
+
end
|
863
|
+
end
|
864
|
+
|
865
|
+
def test_text_area_placeholder_with_human_attribute_name_and_value
|
866
|
+
with_locale :placeholder do
|
867
|
+
assert_dom_equal(
|
868
|
+
%{<textarea id="post_cost" name="post[cost]" placeholder="Pounds">\n</textarea>},
|
869
|
+
text_area(:post, :cost, placeholder: :uk)
|
870
|
+
)
|
871
|
+
end
|
872
|
+
end
|
873
|
+
|
874
|
+
def test_text_area_placeholder_with_locales_and_value
|
875
|
+
with_locale :placeholder do
|
876
|
+
assert_dom_equal(
|
877
|
+
%{<textarea id="post_written_on" name="post[written_on]" placeholder="Escrito en">\n2004-06-15</textarea>},
|
878
|
+
text_area(:post, :written_on, placeholder: :spanish)
|
879
|
+
)
|
880
|
+
end
|
881
|
+
end
|
882
|
+
|
883
|
+
def test_text_area_placeholder_with_locales_and_nested_attributes
|
884
|
+
with_locale :placeholder do
|
885
|
+
form_for(@post, html: { id: 'create-post' }) do |f|
|
886
|
+
f.fields_for(:comments) do |cf|
|
887
|
+
concat cf.text_area(:body, placeholder: true)
|
888
|
+
end
|
889
|
+
end
|
890
|
+
|
891
|
+
expected = whole_form("/posts/123", "create-post", "edit_post", method: "patch") do
|
892
|
+
%{<textarea id="post_comments_attributes_0_body" name="post[comments_attributes][0][body]" placeholder="Write body here">\n</textarea>}
|
893
|
+
end
|
894
|
+
|
895
|
+
assert_dom_equal expected, output_buffer
|
896
|
+
end
|
897
|
+
end
|
898
|
+
|
899
|
+
def test_text_area_placeholder_with_locales_fallback_and_nested_attributes
|
900
|
+
with_locale :placeholder do
|
901
|
+
form_for(@post, html: { id: 'create-post' }) do |f|
|
902
|
+
f.fields_for(:tags) do |cf|
|
903
|
+
concat cf.text_area(:value, placeholder: true)
|
904
|
+
end
|
905
|
+
end
|
906
|
+
|
907
|
+
expected = whole_form("/posts/123", "create-post", "edit_post", method: "patch") do
|
908
|
+
%{<textarea id="post_tags_attributes_0_value" name="post[tags_attributes][0][value]" placeholder="Tag">\nnew tag</textarea>}
|
909
|
+
end
|
910
|
+
|
911
|
+
assert_dom_equal expected, output_buffer
|
912
|
+
end
|
913
|
+
end
|
914
|
+
|
915
|
+
def test_text_area
|
916
|
+
assert_dom_equal(
|
917
|
+
%{<textarea id="post_body" name="post[body]">\nBack to the hill and over it again!</textarea>},
|
918
|
+
text_area("post", "body")
|
919
|
+
)
|
920
|
+
end
|
921
|
+
|
922
|
+
def test_text_area_with_escapes
|
923
|
+
@post.body = "Back to <i>the</i> hill and over it again!"
|
924
|
+
assert_dom_equal(
|
925
|
+
%{<textarea id="post_body" name="post[body]">\nBack to <i>the</i> hill and over it again!</textarea>},
|
926
|
+
text_area("post", "body")
|
927
|
+
)
|
928
|
+
end
|
929
|
+
|
930
|
+
def test_text_area_with_alternate_value
|
931
|
+
assert_dom_equal(
|
932
|
+
%{<textarea id="post_body" name="post[body]">\nTesting alternate values.</textarea>},
|
933
|
+
text_area("post", "body", value: "Testing alternate values.")
|
934
|
+
)
|
935
|
+
end
|
936
|
+
|
937
|
+
def test_text_area_with_nil_alternate_value
|
938
|
+
assert_dom_equal(
|
939
|
+
%{<textarea id="post_body" name="post[body]">\n</textarea>},
|
940
|
+
text_area("post", "body", value: nil)
|
941
|
+
)
|
942
|
+
end
|
943
|
+
|
944
|
+
def test_inputs_use_before_type_cast_to_retain_information_from_validations_like_numericality
|
945
|
+
assert_dom_equal(
|
946
|
+
%{<textarea id="post_id" name="post[id]">\nomg</textarea>},
|
947
|
+
text_area("post", "id")
|
948
|
+
)
|
949
|
+
end
|
950
|
+
|
951
|
+
def test_inputs_dont_use_before_type_cast_when_value_did_not_come_from_user
|
952
|
+
def @post.id_came_from_user?; false; end
|
953
|
+
assert_dom_equal(
|
954
|
+
%{<textarea id="post_id" name="post[id]">\n0</textarea>},
|
955
|
+
text_area("post", "id")
|
956
|
+
)
|
957
|
+
end
|
958
|
+
|
959
|
+
def test_inputs_use_before_typecast_when_object_doesnt_respond_to_came_from_user
|
960
|
+
class << @post; undef id_came_from_user?; end
|
961
|
+
assert_dom_equal(
|
962
|
+
%{<textarea id="post_id" name="post[id]">\nomg</textarea>},
|
963
|
+
text_area("post", "id")
|
964
|
+
)
|
965
|
+
end
|
966
|
+
|
967
|
+
def test_text_area_with_html_entities
|
968
|
+
@post.body = "The HTML Entity for & is &"
|
969
|
+
assert_dom_equal(
|
970
|
+
%{<textarea id="post_body" name="post[body]">\nThe HTML Entity for & is &amp;</textarea>},
|
971
|
+
text_area("post", "body")
|
972
|
+
)
|
973
|
+
end
|
974
|
+
|
975
|
+
def test_text_area_with_size_option
|
976
|
+
assert_dom_equal(
|
977
|
+
%{<textarea cols="183" id="post_body" name="post[body]" rows="820">\nBack to the hill and over it again!</textarea>},
|
978
|
+
text_area("post", "body", size: "183x820")
|
979
|
+
)
|
980
|
+
end
|
981
|
+
|
982
|
+
def test_color_field_with_valid_hex_color_string
|
983
|
+
expected = %{<input id="car_color" name="car[color]" type="color" value="#000fff" />}
|
984
|
+
assert_dom_equal(expected, color_field("car", "color"))
|
985
|
+
end
|
986
|
+
|
987
|
+
def test_color_field_with_invalid_hex_color_string
|
988
|
+
expected = %{<input id="car_color" name="car[color]" type="color" value="#000000" />}
|
989
|
+
@car.color = "#1234TR"
|
990
|
+
assert_dom_equal(expected, color_field("car", "color"))
|
991
|
+
end
|
992
|
+
|
993
|
+
def test_color_field_with_value_attr
|
994
|
+
expected = %{<input id="car_color" name="car[color]" type="color" value="#00FF00" />}
|
995
|
+
assert_dom_equal(expected, color_field("car", "color", value: "#00FF00"))
|
996
|
+
end
|
997
|
+
|
998
|
+
def test_search_field
|
999
|
+
expected = %{<input id="contact_notes_query" name="contact[notes_query]" type="search" />}
|
1000
|
+
assert_dom_equal(expected, search_field("contact", "notes_query"))
|
1001
|
+
end
|
1002
|
+
|
1003
|
+
def test_search_field_with_onsearch_value
|
1004
|
+
expected = %{<input onsearch="true" type="search" name="contact[notes_query]" id="contact_notes_query" incremental="true" />}
|
1005
|
+
assert_dom_equal(expected, search_field("contact", "notes_query", onsearch: true))
|
1006
|
+
end
|
1007
|
+
|
1008
|
+
def test_telephone_field
|
1009
|
+
expected = %{<input id="user_cell" name="user[cell]" type="tel" />}
|
1010
|
+
assert_dom_equal(expected, telephone_field("user", "cell"))
|
1011
|
+
end
|
1012
|
+
|
1013
|
+
def test_date_field
|
1014
|
+
expected = %{<input id="post_written_on" name="post[written_on]" type="date" value="2004-06-15" />}
|
1015
|
+
assert_dom_equal(expected, date_field("post", "written_on"))
|
1016
|
+
end
|
1017
|
+
|
1018
|
+
def test_date_field_with_datetime_value
|
1019
|
+
expected = %{<input id="post_written_on" name="post[written_on]" type="date" value="2004-06-15" />}
|
1020
|
+
@post.written_on = DateTime.new(2004, 6, 15, 1, 2, 3)
|
1021
|
+
assert_dom_equal(expected, date_field("post", "written_on"))
|
1022
|
+
end
|
1023
|
+
|
1024
|
+
def test_date_field_with_extra_attrs
|
1025
|
+
expected = %{<input id="post_written_on" step="2" max="2010-08-15" min="2000-06-15" name="post[written_on]" type="date" value="2004-06-15" />}
|
1026
|
+
@post.written_on = DateTime.new(2004, 6, 15)
|
1027
|
+
min_value = DateTime.new(2000, 6, 15)
|
1028
|
+
max_value = DateTime.new(2010, 8, 15)
|
1029
|
+
step = 2
|
1030
|
+
assert_dom_equal(expected, date_field("post", "written_on", min: min_value, max: max_value, step: step))
|
1031
|
+
end
|
1032
|
+
|
1033
|
+
def test_date_field_with_value_attr
|
1034
|
+
expected = %{<input id="post_written_on" name="post[written_on]" type="date" value="2013-06-29" />}
|
1035
|
+
value = Date.new(2013,6,29)
|
1036
|
+
assert_dom_equal(expected, date_field("post", "written_on", value: value))
|
1037
|
+
end
|
1038
|
+
|
1039
|
+
def test_date_field_with_timewithzone_value
|
1040
|
+
previous_time_zone, Time.zone = Time.zone, 'UTC'
|
1041
|
+
expected = %{<input id="post_written_on" name="post[written_on]" type="date" value="2004-06-15" />}
|
1042
|
+
@post.written_on = Time.zone.parse('2004-06-15 15:30:45')
|
1043
|
+
assert_dom_equal(expected, date_field("post", "written_on"))
|
1044
|
+
ensure
|
1045
|
+
Time.zone = previous_time_zone
|
1046
|
+
end
|
1047
|
+
|
1048
|
+
def test_date_field_with_nil_value
|
1049
|
+
expected = %{<input id="post_written_on" name="post[written_on]" type="date" />}
|
1050
|
+
@post.written_on = nil
|
1051
|
+
assert_dom_equal(expected, date_field("post", "written_on"))
|
1052
|
+
end
|
1053
|
+
|
1054
|
+
def test_date_field_with_string_values_for_min_and_max
|
1055
|
+
expected = %{<input id="post_written_on" max="2010-08-15" min="2000-06-15" name="post[written_on]" type="date" value="2004-06-15" />}
|
1056
|
+
@post.written_on = DateTime.new(2004, 6, 15)
|
1057
|
+
min_value = "2000-06-15"
|
1058
|
+
max_value = "2010-08-15"
|
1059
|
+
assert_dom_equal(expected, date_field("post", "written_on", min: min_value, max: max_value))
|
1060
|
+
end
|
1061
|
+
|
1062
|
+
def test_date_field_with_invalid_string_values_for_min_and_max
|
1063
|
+
expected = %{<input id="post_written_on" name="post[written_on]" type="date" value="2004-06-15" />}
|
1064
|
+
@post.written_on = DateTime.new(2004, 6, 15, 1, 2, 3)
|
1065
|
+
min_value = "foo"
|
1066
|
+
max_value = "bar"
|
1067
|
+
assert_dom_equal(expected, date_field("post", "written_on", min: min_value, max: max_value))
|
1068
|
+
end
|
1069
|
+
|
1070
|
+
def test_time_field
|
1071
|
+
expected = %{<input id="post_written_on" name="post[written_on]" type="time" value="00:00:00.000" />}
|
1072
|
+
assert_dom_equal(expected, time_field("post", "written_on"))
|
1073
|
+
end
|
1074
|
+
|
1075
|
+
def test_time_field_with_datetime_value
|
1076
|
+
expected = %{<input id="post_written_on" name="post[written_on]" type="time" value="01:02:03.000" />}
|
1077
|
+
@post.written_on = DateTime.new(2004, 6, 15, 1, 2, 3)
|
1078
|
+
assert_dom_equal(expected, time_field("post", "written_on"))
|
1079
|
+
end
|
1080
|
+
|
1081
|
+
def test_time_field_with_extra_attrs
|
1082
|
+
expected = %{<input id="post_written_on" step="60" max="10:25:00.000" min="20:45:30.000" name="post[written_on]" type="time" value="01:02:03.000" />}
|
1083
|
+
@post.written_on = DateTime.new(2004, 6, 15, 1, 2, 3)
|
1084
|
+
min_value = DateTime.new(2000, 6, 15, 20, 45, 30)
|
1085
|
+
max_value = DateTime.new(2010, 8, 15, 10, 25, 00)
|
1086
|
+
step = 60
|
1087
|
+
assert_dom_equal(expected, time_field("post", "written_on", min: min_value, max: max_value, step: step))
|
1088
|
+
end
|
1089
|
+
|
1090
|
+
def test_time_field_with_timewithzone_value
|
1091
|
+
previous_time_zone, Time.zone = Time.zone, 'UTC'
|
1092
|
+
expected = %{<input id="post_written_on" name="post[written_on]" type="time" value="01:02:03.000" />}
|
1093
|
+
@post.written_on = Time.zone.parse('2004-06-15 01:02:03')
|
1094
|
+
assert_dom_equal(expected, time_field("post", "written_on"))
|
1095
|
+
ensure
|
1096
|
+
Time.zone = previous_time_zone
|
1097
|
+
end
|
1098
|
+
|
1099
|
+
def test_time_field_with_nil_value
|
1100
|
+
expected = %{<input id="post_written_on" name="post[written_on]" type="time" />}
|
1101
|
+
@post.written_on = nil
|
1102
|
+
assert_dom_equal(expected, time_field("post", "written_on"))
|
1103
|
+
end
|
1104
|
+
|
1105
|
+
def test_time_field_with_string_values_for_min_and_max
|
1106
|
+
expected = %{<input id="post_written_on" max="10:25:00.000" min="20:45:30.000" name="post[written_on]" type="time" value="01:02:03.000" />}
|
1107
|
+
@post.written_on = DateTime.new(2004, 6, 15, 1, 2, 3)
|
1108
|
+
min_value = "20:45:30.000"
|
1109
|
+
max_value = "10:25:00.000"
|
1110
|
+
assert_dom_equal(expected, time_field("post", "written_on", min: min_value, max: max_value))
|
1111
|
+
end
|
1112
|
+
|
1113
|
+
def test_time_field_with_invalid_string_values_for_min_and_max
|
1114
|
+
expected = %{<input id="post_written_on" name="post[written_on]" type="time" value="01:02:03.000" />}
|
1115
|
+
@post.written_on = DateTime.new(2004, 6, 15, 1, 2, 3)
|
1116
|
+
min_value = "foo"
|
1117
|
+
max_value = "bar"
|
1118
|
+
assert_dom_equal(expected, time_field("post", "written_on", min: min_value, max: max_value))
|
1119
|
+
end
|
1120
|
+
|
1121
|
+
def test_datetime_field
|
1122
|
+
expected = %{<input id="post_written_on" name="post[written_on]" type="datetime" value="2004-06-15T00:00:00.000+0000" />}
|
1123
|
+
assert_dom_equal(expected, datetime_field("post", "written_on"))
|
1124
|
+
end
|
1125
|
+
|
1126
|
+
def test_datetime_field_with_datetime_value
|
1127
|
+
expected = %{<input id="post_written_on" name="post[written_on]" type="datetime" value="2004-06-15T01:02:03.000+0000" />}
|
1128
|
+
@post.written_on = DateTime.new(2004, 6, 15, 1, 2, 3)
|
1129
|
+
assert_dom_equal(expected, datetime_field("post", "written_on"))
|
1130
|
+
end
|
1131
|
+
|
1132
|
+
def test_datetime_field_with_extra_attrs
|
1133
|
+
expected = %{<input id="post_written_on" step="60" max="2010-08-15T10:25:00.000+0000" min="2000-06-15T20:45:30.000+0000" name="post[written_on]" type="datetime" value="2004-06-15T01:02:03.000+0000" />}
|
1134
|
+
@post.written_on = DateTime.new(2004, 6, 15, 1, 2, 3)
|
1135
|
+
min_value = DateTime.new(2000, 6, 15, 20, 45, 30)
|
1136
|
+
max_value = DateTime.new(2010, 8, 15, 10, 25, 00)
|
1137
|
+
step = 60
|
1138
|
+
assert_dom_equal(expected, datetime_field("post", "written_on", min: min_value, max: max_value, step: step))
|
1139
|
+
end
|
1140
|
+
|
1141
|
+
def test_datetime_field_with_value_attr
|
1142
|
+
expected = %{<input id="post_written_on" name="post[written_on]" type="datetime" value="2013-06-29T13:37:00+00:00" />}
|
1143
|
+
value = DateTime.new(2013,6,29,13,37)
|
1144
|
+
assert_dom_equal(expected, datetime_field("post", "written_on", value: value))
|
1145
|
+
end
|
1146
|
+
|
1147
|
+
def test_datetime_field_with_timewithzone_value
|
1148
|
+
previous_time_zone, Time.zone = Time.zone, 'UTC'
|
1149
|
+
expected = %{<input id="post_written_on" name="post[written_on]" type="datetime" value="2004-06-15T15:30:45.000+0000" />}
|
1150
|
+
@post.written_on = Time.zone.parse('2004-06-15 15:30:45')
|
1151
|
+
assert_dom_equal(expected, datetime_field("post", "written_on"))
|
1152
|
+
ensure
|
1153
|
+
Time.zone = previous_time_zone
|
1154
|
+
end
|
1155
|
+
|
1156
|
+
def test_datetime_field_with_nil_value
|
1157
|
+
expected = %{<input id="post_written_on" name="post[written_on]" type="datetime" />}
|
1158
|
+
@post.written_on = nil
|
1159
|
+
assert_dom_equal(expected, datetime_field("post", "written_on"))
|
1160
|
+
end
|
1161
|
+
|
1162
|
+
def test_datetime_field_with_string_values_for_min_and_max
|
1163
|
+
expected = %{<input id="post_written_on" max="2010-08-15T10:25:00.000+0000" min="2000-06-15T20:45:30.000+0000" name="post[written_on]" type="datetime" value="2004-06-15T01:02:03.000+0000" />}
|
1164
|
+
@post.written_on = DateTime.new(2004, 6, 15, 1, 2, 3)
|
1165
|
+
min_value = "2000-06-15T20:45:30.000+0000"
|
1166
|
+
max_value = "2010-08-15T10:25:00.000+0000"
|
1167
|
+
assert_dom_equal(expected, datetime_field("post", "written_on", min: min_value, max: max_value))
|
1168
|
+
end
|
1169
|
+
|
1170
|
+
def test_datetime_field_with_invalid_string_values_for_min_and_max
|
1171
|
+
expected = %{<input id="post_written_on" name="post[written_on]" type="datetime" value="2004-06-15T01:02:03.000+0000" />}
|
1172
|
+
@post.written_on = DateTime.new(2004, 6, 15, 1, 2, 3)
|
1173
|
+
min_value = "foo"
|
1174
|
+
max_value = "bar"
|
1175
|
+
assert_dom_equal(expected, datetime_field("post", "written_on", min: min_value, max: max_value))
|
1176
|
+
end
|
1177
|
+
|
1178
|
+
def test_datetime_local_field
|
1179
|
+
expected = %{<input id="post_written_on" name="post[written_on]" type="datetime-local" value="2004-06-15T00:00:00" />}
|
1180
|
+
assert_dom_equal(expected, datetime_local_field("post", "written_on"))
|
1181
|
+
end
|
1182
|
+
|
1183
|
+
def test_datetime_local_field_with_datetime_value
|
1184
|
+
expected = %{<input id="post_written_on" name="post[written_on]" type="datetime-local" value="2004-06-15T01:02:03" />}
|
1185
|
+
@post.written_on = DateTime.new(2004, 6, 15, 1, 2, 3)
|
1186
|
+
assert_dom_equal(expected, datetime_local_field("post", "written_on"))
|
1187
|
+
end
|
1188
|
+
|
1189
|
+
def test_datetime_local_field_with_extra_attrs
|
1190
|
+
expected = %{<input id="post_written_on" step="60" max="2010-08-15T10:25:00" min="2000-06-15T20:45:30" name="post[written_on]" type="datetime-local" value="2004-06-15T01:02:03" />}
|
1191
|
+
@post.written_on = DateTime.new(2004, 6, 15, 1, 2, 3)
|
1192
|
+
min_value = DateTime.new(2000, 6, 15, 20, 45, 30)
|
1193
|
+
max_value = DateTime.new(2010, 8, 15, 10, 25, 00)
|
1194
|
+
step = 60
|
1195
|
+
assert_dom_equal(expected, datetime_local_field("post", "written_on", min: min_value, max: max_value, step: step))
|
1196
|
+
end
|
1197
|
+
|
1198
|
+
def test_datetime_local_field_with_timewithzone_value
|
1199
|
+
previous_time_zone, Time.zone = Time.zone, 'UTC'
|
1200
|
+
expected = %{<input id="post_written_on" name="post[written_on]" type="datetime-local" value="2004-06-15T15:30:45" />}
|
1201
|
+
@post.written_on = Time.zone.parse('2004-06-15 15:30:45')
|
1202
|
+
assert_dom_equal(expected, datetime_local_field("post", "written_on"))
|
1203
|
+
ensure
|
1204
|
+
Time.zone = previous_time_zone
|
1205
|
+
end
|
1206
|
+
|
1207
|
+
def test_datetime_local_field_with_nil_value
|
1208
|
+
expected = %{<input id="post_written_on" name="post[written_on]" type="datetime-local" />}
|
1209
|
+
@post.written_on = nil
|
1210
|
+
assert_dom_equal(expected, datetime_local_field("post", "written_on"))
|
1211
|
+
end
|
1212
|
+
|
1213
|
+
def test_datetime_local_field_with_string_values_for_min_and_max
|
1214
|
+
expected = %{<input id="post_written_on" max="2010-08-15T10:25:00" min="2000-06-15T20:45:30" name="post[written_on]" type="datetime-local" value="2004-06-15T01:02:03" />}
|
1215
|
+
@post.written_on = DateTime.new(2004, 6, 15, 1, 2, 3)
|
1216
|
+
min_value = "2000-06-15T20:45:30"
|
1217
|
+
max_value = "2010-08-15T10:25:00"
|
1218
|
+
assert_dom_equal(expected, datetime_local_field("post", "written_on", min: min_value, max: max_value))
|
1219
|
+
end
|
1220
|
+
|
1221
|
+
def test_datetime_local_field_with_invalid_string_values_for_min_and_max
|
1222
|
+
expected = %{<input id="post_written_on" name="post[written_on]" type="datetime-local" value="2004-06-15T01:02:03" />}
|
1223
|
+
@post.written_on = DateTime.new(2004, 6, 15, 1, 2, 3)
|
1224
|
+
min_value = "foo"
|
1225
|
+
max_value = "bar"
|
1226
|
+
assert_dom_equal(expected, datetime_local_field("post", "written_on", min: min_value, max: max_value))
|
1227
|
+
end
|
1228
|
+
|
1229
|
+
def test_month_field
|
1230
|
+
expected = %{<input id="post_written_on" name="post[written_on]" type="month" value="2004-06" />}
|
1231
|
+
assert_dom_equal(expected, month_field("post", "written_on"))
|
1232
|
+
end
|
1233
|
+
|
1234
|
+
def test_month_field_with_nil_value
|
1235
|
+
expected = %{<input id="post_written_on" name="post[written_on]" type="month" />}
|
1236
|
+
@post.written_on = nil
|
1237
|
+
assert_dom_equal(expected, month_field("post", "written_on"))
|
1238
|
+
end
|
1239
|
+
|
1240
|
+
def test_month_field_with_datetime_value
|
1241
|
+
expected = %{<input id="post_written_on" name="post[written_on]" type="month" value="2004-06" />}
|
1242
|
+
@post.written_on = DateTime.new(2004, 6, 15, 1, 2, 3)
|
1243
|
+
assert_dom_equal(expected, month_field("post", "written_on"))
|
1244
|
+
end
|
1245
|
+
|
1246
|
+
def test_month_field_with_extra_attrs
|
1247
|
+
expected = %{<input id="post_written_on" step="2" max="2010-12" min="2000-02" name="post[written_on]" type="month" value="2004-06" />}
|
1248
|
+
@post.written_on = DateTime.new(2004, 6, 15, 1, 2, 3)
|
1249
|
+
min_value = DateTime.new(2000, 2, 13)
|
1250
|
+
max_value = DateTime.new(2010, 12, 23)
|
1251
|
+
step = 2
|
1252
|
+
assert_dom_equal(expected, month_field("post", "written_on", min: min_value, max: max_value, step: step))
|
1253
|
+
end
|
1254
|
+
|
1255
|
+
def test_month_field_with_timewithzone_value
|
1256
|
+
previous_time_zone, Time.zone = Time.zone, 'UTC'
|
1257
|
+
expected = %{<input id="post_written_on" name="post[written_on]" type="month" value="2004-06" />}
|
1258
|
+
@post.written_on = Time.zone.parse('2004-06-15 15:30:45')
|
1259
|
+
assert_dom_equal(expected, month_field("post", "written_on"))
|
1260
|
+
ensure
|
1261
|
+
Time.zone = previous_time_zone
|
1262
|
+
end
|
1263
|
+
|
1264
|
+
def test_week_field
|
1265
|
+
expected = %{<input id="post_written_on" name="post[written_on]" type="week" value="2004-W24" />}
|
1266
|
+
assert_dom_equal(expected, week_field("post", "written_on"))
|
1267
|
+
end
|
1268
|
+
|
1269
|
+
def test_week_field_with_nil_value
|
1270
|
+
expected = %{<input id="post_written_on" name="post[written_on]" type="week" />}
|
1271
|
+
@post.written_on = nil
|
1272
|
+
assert_dom_equal(expected, week_field("post", "written_on"))
|
1273
|
+
end
|
1274
|
+
|
1275
|
+
def test_week_field_with_datetime_value
|
1276
|
+
expected = %{<input id="post_written_on" name="post[written_on]" type="week" value="2004-W24" />}
|
1277
|
+
@post.written_on = DateTime.new(2004, 6, 15, 1, 2, 3)
|
1278
|
+
assert_dom_equal(expected, week_field("post", "written_on"))
|
1279
|
+
end
|
1280
|
+
|
1281
|
+
def test_week_field_with_extra_attrs
|
1282
|
+
expected = %{<input id="post_written_on" step="2" max="2010-W51" min="2000-W06" name="post[written_on]" type="week" value="2004-W24" />}
|
1283
|
+
@post.written_on = DateTime.new(2004, 6, 15, 1, 2, 3)
|
1284
|
+
min_value = DateTime.new(2000, 2, 13)
|
1285
|
+
max_value = DateTime.new(2010, 12, 23)
|
1286
|
+
step = 2
|
1287
|
+
assert_dom_equal(expected, week_field("post", "written_on", min: min_value, max: max_value, step: step))
|
1288
|
+
end
|
1289
|
+
|
1290
|
+
def test_week_field_with_timewithzone_value
|
1291
|
+
previous_time_zone, Time.zone = Time.zone, 'UTC'
|
1292
|
+
expected = %{<input id="post_written_on" name="post[written_on]" type="week" value="2004-W24" />}
|
1293
|
+
@post.written_on = Time.zone.parse('2004-06-15 15:30:45')
|
1294
|
+
assert_dom_equal(expected, week_field("post", "written_on"))
|
1295
|
+
ensure
|
1296
|
+
Time.zone = previous_time_zone
|
1297
|
+
end
|
1298
|
+
|
1299
|
+
def test_url_field
|
1300
|
+
expected = %{<input id="user_homepage" name="user[homepage]" type="url" />}
|
1301
|
+
assert_dom_equal(expected, url_field("user", "homepage"))
|
1302
|
+
end
|
1303
|
+
|
1304
|
+
def test_email_field
|
1305
|
+
expected = %{<input id="user_address" name="user[address]" type="email" />}
|
1306
|
+
assert_dom_equal(expected, email_field("user", "address"))
|
1307
|
+
end
|
1308
|
+
|
1309
|
+
def test_number_field
|
1310
|
+
expected = %{<input name="order[quantity]" max="9" id="order_quantity" type="number" min="1" />}
|
1311
|
+
assert_dom_equal(expected, number_field("order", "quantity", in: 1...10))
|
1312
|
+
expected = %{<input name="order[quantity]" size="30" max="9" id="order_quantity" type="number" min="1" />}
|
1313
|
+
assert_dom_equal(expected, number_field("order", "quantity", size: 30, in: 1...10))
|
1314
|
+
end
|
1315
|
+
|
1316
|
+
def test_range_input
|
1317
|
+
expected = %{<input name="hifi[volume]" step="0.1" max="11" id="hifi_volume" type="range" min="0" />}
|
1318
|
+
assert_dom_equal(expected, range_field("hifi", "volume", in: 0..11, step: 0.1))
|
1319
|
+
expected = %{<input name="hifi[volume]" step="0.1" size="30" max="11" id="hifi_volume" type="range" min="0" />}
|
1320
|
+
assert_dom_equal(expected, range_field("hifi", "volume", size: 30, in: 0..11, step: 0.1))
|
1321
|
+
end
|
1322
|
+
|
1323
|
+
def test_explicit_name
|
1324
|
+
assert_dom_equal(
|
1325
|
+
'<input id="post_title" name="dont guess" type="text" value="Hello World" />',
|
1326
|
+
text_field("post", "title", "name" => "dont guess")
|
1327
|
+
)
|
1328
|
+
assert_dom_equal(
|
1329
|
+
%{<textarea id="post_body" name="really!">\nBack to the hill and over it again!</textarea>},
|
1330
|
+
text_area("post", "body", "name" => "really!")
|
1331
|
+
)
|
1332
|
+
assert_dom_equal(
|
1333
|
+
'<input name="i mean it" type="hidden" value="0" /><input checked="checked" id="post_secret" name="i mean it" type="checkbox" value="1" />',
|
1334
|
+
check_box("post", "secret", "name" => "i mean it")
|
1335
|
+
)
|
1336
|
+
assert_dom_equal(
|
1337
|
+
text_field("post", "title", "name" => "dont guess"),
|
1338
|
+
text_field("post", "title", name: "dont guess")
|
1339
|
+
)
|
1340
|
+
assert_dom_equal(
|
1341
|
+
text_area("post", "body", "name" => "really!"),
|
1342
|
+
text_area("post", "body", name: "really!")
|
1343
|
+
)
|
1344
|
+
assert_dom_equal(
|
1345
|
+
check_box("post", "secret", "name" => "i mean it"),
|
1346
|
+
check_box("post", "secret", name: "i mean it")
|
1347
|
+
)
|
1348
|
+
end
|
1349
|
+
|
1350
|
+
def test_explicit_id
|
1351
|
+
assert_dom_equal(
|
1352
|
+
'<input id="dont guess" name="post[title]" type="text" value="Hello World" />',
|
1353
|
+
text_field("post", "title", "id" => "dont guess")
|
1354
|
+
)
|
1355
|
+
assert_dom_equal(
|
1356
|
+
%{<textarea id="really!" name="post[body]">\nBack to the hill and over it again!</textarea>},
|
1357
|
+
text_area("post", "body", "id" => "really!")
|
1358
|
+
)
|
1359
|
+
assert_dom_equal(
|
1360
|
+
'<input name="post[secret]" type="hidden" value="0" /><input checked="checked" id="i mean it" name="post[secret]" type="checkbox" value="1" />',
|
1361
|
+
check_box("post", "secret", "id" => "i mean it")
|
1362
|
+
)
|
1363
|
+
assert_dom_equal(
|
1364
|
+
text_field("post", "title", "id" => "dont guess"),
|
1365
|
+
text_field("post", "title", id: "dont guess")
|
1366
|
+
)
|
1367
|
+
assert_dom_equal(
|
1368
|
+
text_area("post", "body", "id" => "really!"),
|
1369
|
+
text_area("post", "body", id: "really!")
|
1370
|
+
)
|
1371
|
+
assert_dom_equal(
|
1372
|
+
check_box("post", "secret", "id" => "i mean it"),
|
1373
|
+
check_box("post", "secret", id: "i mean it")
|
1374
|
+
)
|
1375
|
+
end
|
1376
|
+
|
1377
|
+
def test_nil_id
|
1378
|
+
assert_dom_equal(
|
1379
|
+
'<input name="post[title]" type="text" value="Hello World" />',
|
1380
|
+
text_field("post", "title", "id" => nil)
|
1381
|
+
)
|
1382
|
+
assert_dom_equal(
|
1383
|
+
%{<textarea name="post[body]">\nBack to the hill and over it again!</textarea>},
|
1384
|
+
text_area("post", "body", "id" => nil)
|
1385
|
+
)
|
1386
|
+
assert_dom_equal(
|
1387
|
+
'<input name="post[secret]" type="hidden" value="0" /><input checked="checked" name="post[secret]" type="checkbox" value="1" />',
|
1388
|
+
check_box("post", "secret", "id" => nil)
|
1389
|
+
)
|
1390
|
+
assert_dom_equal(
|
1391
|
+
'<input type="radio" name="post[secret]" value="0" />',
|
1392
|
+
radio_button("post", "secret", "0", "id" => nil)
|
1393
|
+
)
|
1394
|
+
assert_dom_equal(
|
1395
|
+
'<select name="post[secret]"></select>',
|
1396
|
+
select("post", "secret", [], {}, "id" => nil)
|
1397
|
+
)
|
1398
|
+
assert_dom_equal(
|
1399
|
+
text_field("post", "title", "id" => nil),
|
1400
|
+
text_field("post", "title", id: nil)
|
1401
|
+
)
|
1402
|
+
assert_dom_equal(
|
1403
|
+
text_area("post", "body", "id" => nil),
|
1404
|
+
text_area("post", "body", id: nil)
|
1405
|
+
)
|
1406
|
+
assert_dom_equal(
|
1407
|
+
check_box("post", "secret", "id" => nil),
|
1408
|
+
check_box("post", "secret", id: nil)
|
1409
|
+
)
|
1410
|
+
assert_dom_equal(
|
1411
|
+
radio_button("post", "secret", "0", "id" => nil),
|
1412
|
+
radio_button("post", "secret", "0", id: nil)
|
1413
|
+
)
|
1414
|
+
end
|
1415
|
+
|
1416
|
+
def test_index
|
1417
|
+
assert_dom_equal(
|
1418
|
+
'<input name="post[5][title]" id="post_5_title" type="text" value="Hello World" />',
|
1419
|
+
text_field("post", "title", "index" => 5)
|
1420
|
+
)
|
1421
|
+
assert_dom_equal(
|
1422
|
+
%{<textarea name="post[5][body]" id="post_5_body">\nBack to the hill and over it again!</textarea>},
|
1423
|
+
text_area("post", "body", "index" => 5)
|
1424
|
+
)
|
1425
|
+
assert_dom_equal(
|
1426
|
+
'<input name="post[5][secret]" type="hidden" value="0" /><input checked="checked" name="post[5][secret]" type="checkbox" value="1" id="post_5_secret" />',
|
1427
|
+
check_box("post", "secret", "index" => 5)
|
1428
|
+
)
|
1429
|
+
assert_dom_equal(
|
1430
|
+
text_field("post", "title", "index" => 5),
|
1431
|
+
text_field("post", "title", "index" => 5)
|
1432
|
+
)
|
1433
|
+
assert_dom_equal(
|
1434
|
+
text_area("post", "body", "index" => 5),
|
1435
|
+
text_area("post", "body", "index" => 5)
|
1436
|
+
)
|
1437
|
+
assert_dom_equal(
|
1438
|
+
check_box("post", "secret", "index" => 5),
|
1439
|
+
check_box("post", "secret", "index" => 5)
|
1440
|
+
)
|
1441
|
+
end
|
1442
|
+
|
1443
|
+
def test_index_with_nil_id
|
1444
|
+
assert_dom_equal(
|
1445
|
+
'<input name="post[5][title]" type="text" value="Hello World" />',
|
1446
|
+
text_field("post", "title", "index" => 5, 'id' => nil)
|
1447
|
+
)
|
1448
|
+
assert_dom_equal(
|
1449
|
+
%{<textarea name="post[5][body]">\nBack to the hill and over it again!</textarea>},
|
1450
|
+
text_area("post", "body", "index" => 5, 'id' => nil)
|
1451
|
+
)
|
1452
|
+
assert_dom_equal(
|
1453
|
+
'<input name="post[5][secret]" type="hidden" value="0" /><input checked="checked" name="post[5][secret]" type="checkbox" value="1" />',
|
1454
|
+
check_box("post", "secret", "index" => 5, 'id' => nil)
|
1455
|
+
)
|
1456
|
+
assert_dom_equal(
|
1457
|
+
text_field("post", "title", "index" => 5, 'id' => nil),
|
1458
|
+
text_field("post", "title", index: 5, id: nil)
|
1459
|
+
)
|
1460
|
+
assert_dom_equal(
|
1461
|
+
text_area("post", "body", "index" => 5, 'id' => nil),
|
1462
|
+
text_area("post", "body", index: 5, id: nil)
|
1463
|
+
)
|
1464
|
+
assert_dom_equal(
|
1465
|
+
check_box("post", "secret", "index" => 5, 'id' => nil),
|
1466
|
+
check_box("post", "secret", index: 5, id: nil)
|
1467
|
+
)
|
1468
|
+
end
|
1469
|
+
|
1470
|
+
def test_auto_index
|
1471
|
+
pid = 123
|
1472
|
+
assert_dom_equal(
|
1473
|
+
%{<label for="post_#{pid}_title">Title</label>},
|
1474
|
+
label("post[]", "title")
|
1475
|
+
)
|
1476
|
+
assert_dom_equal(
|
1477
|
+
%{<input id="post_#{pid}_title" name="post[#{pid}][title]" type="text" value="Hello World" />},
|
1478
|
+
text_field("post[]","title")
|
1479
|
+
)
|
1480
|
+
assert_dom_equal(
|
1481
|
+
%{<textarea id="post_#{pid}_body" name="post[#{pid}][body]">\nBack to the hill and over it again!</textarea>},
|
1482
|
+
text_area("post[]", "body")
|
1483
|
+
)
|
1484
|
+
assert_dom_equal(
|
1485
|
+
%{<input name="post[#{pid}][secret]" type="hidden" value="0" /><input checked="checked" id="post_#{pid}_secret" name="post[#{pid}][secret]" type="checkbox" value="1" />},
|
1486
|
+
check_box("post[]", "secret")
|
1487
|
+
)
|
1488
|
+
assert_dom_equal(
|
1489
|
+
%{<input checked="checked" id="post_#{pid}_title_hello_world" name="post[#{pid}][title]" type="radio" value="Hello World" />},
|
1490
|
+
radio_button("post[]", "title", "Hello World")
|
1491
|
+
)
|
1492
|
+
assert_dom_equal(
|
1493
|
+
%{<input id="post_#{pid}_title_goodbye_world" name="post[#{pid}][title]" type="radio" value="Goodbye World" />},
|
1494
|
+
radio_button("post[]", "title", "Goodbye World")
|
1495
|
+
)
|
1496
|
+
end
|
1497
|
+
|
1498
|
+
def test_auto_index_with_nil_id
|
1499
|
+
pid = 123
|
1500
|
+
assert_dom_equal(
|
1501
|
+
%{<input name="post[#{pid}][title]" type="text" value="Hello World" />},
|
1502
|
+
text_field("post[]", "title", id: nil)
|
1503
|
+
)
|
1504
|
+
assert_dom_equal(
|
1505
|
+
%{<textarea name="post[#{pid}][body]">\nBack to the hill and over it again!</textarea>},
|
1506
|
+
text_area("post[]", "body", id: nil)
|
1507
|
+
)
|
1508
|
+
assert_dom_equal(
|
1509
|
+
%{<input name="post[#{pid}][secret]" type="hidden" value="0" /><input checked="checked" name="post[#{pid}][secret]" type="checkbox" value="1" />},
|
1510
|
+
check_box("post[]", "secret", id: nil)
|
1511
|
+
)
|
1512
|
+
assert_dom_equal(
|
1513
|
+
%{<input checked="checked" name="post[#{pid}][title]" type="radio" value="Hello World" />},
|
1514
|
+
radio_button("post[]", "title", "Hello World", id: nil)
|
1515
|
+
)
|
1516
|
+
assert_dom_equal(
|
1517
|
+
%{<input name="post[#{pid}][title]" type="radio" value="Goodbye World" />},
|
1518
|
+
radio_button("post[]", "title", "Goodbye World", id: nil)
|
1519
|
+
)
|
1520
|
+
end
|
1521
|
+
|
1522
|
+
def test_form_for_requires_block
|
1523
|
+
assert_raises(ArgumentError) do
|
1524
|
+
form_for(:post, @post, html: { id: 'create-post' })
|
1525
|
+
end
|
1526
|
+
end
|
1527
|
+
|
1528
|
+
def test_form_for_requires_arguments
|
1529
|
+
error = assert_raises(ArgumentError) do
|
1530
|
+
form_for(nil, html: { id: 'create-post' }) do
|
1531
|
+
end
|
1532
|
+
end
|
1533
|
+
assert_equal "First argument in form cannot contain nil or be empty", error.message
|
1534
|
+
|
1535
|
+
error = assert_raises(ArgumentError) do
|
1536
|
+
form_for([nil, nil], html: { id: 'create-post' }) do
|
1537
|
+
end
|
1538
|
+
end
|
1539
|
+
assert_equal "First argument in form cannot contain nil or be empty", error.message
|
1540
|
+
end
|
1541
|
+
|
1542
|
+
def test_form_for
|
1543
|
+
form_for(@post, html: { id: 'create-post' }) do |f|
|
1544
|
+
concat f.label(:title) { "The Title" }
|
1545
|
+
concat f.text_field(:title)
|
1546
|
+
concat f.text_area(:body)
|
1547
|
+
concat f.check_box(:secret)
|
1548
|
+
concat f.submit('Create post')
|
1549
|
+
concat f.button('Create post')
|
1550
|
+
concat f.button {
|
1551
|
+
concat content_tag(:span, 'Create post')
|
1552
|
+
}
|
1553
|
+
end
|
1554
|
+
|
1555
|
+
expected = whole_form("/posts/123", "create-post", "edit_post", method: "patch") do
|
1556
|
+
"<label for='post_title'>The Title</label>" +
|
1557
|
+
"<input name='post[title]' type='text' id='post_title' value='Hello World' />" +
|
1558
|
+
"<textarea name='post[body]' id='post_body'>\nBack to the hill and over it again!</textarea>" +
|
1559
|
+
"<input name='post[secret]' type='hidden' value='0' />" +
|
1560
|
+
"<input name='post[secret]' checked='checked' type='checkbox' id='post_secret' value='1' />" +
|
1561
|
+
"<input name='commit' type='submit' value='Create post' />" +
|
1562
|
+
"<button name='button' type='submit'>Create post</button>" +
|
1563
|
+
"<button name='button' type='submit'><span>Create post</span></button>"
|
1564
|
+
end
|
1565
|
+
|
1566
|
+
assert_dom_equal expected, output_buffer
|
1567
|
+
end
|
1568
|
+
|
1569
|
+
def test_form_for_with_collection_radio_buttons
|
1570
|
+
post = Post.new
|
1571
|
+
def post.active; false; end
|
1572
|
+
form_for(post) do |f|
|
1573
|
+
concat f.collection_radio_buttons(:active, [true, false], :to_s, :to_s)
|
1574
|
+
end
|
1575
|
+
|
1576
|
+
expected = whole_form("/posts", "new_post", "new_post") do
|
1577
|
+
"<input id='post_active_true' name='post[active]' type='radio' value='true' />" +
|
1578
|
+
"<label for='post_active_true'>true</label>" +
|
1579
|
+
"<input checked='checked' id='post_active_false' name='post[active]' type='radio' value='false' />" +
|
1580
|
+
"<label for='post_active_false'>false</label>"
|
1581
|
+
end
|
1582
|
+
|
1583
|
+
assert_dom_equal expected, output_buffer
|
1584
|
+
end
|
1585
|
+
|
1586
|
+
def test_form_for_with_collection_radio_buttons_with_custom_builder_block
|
1587
|
+
post = Post.new
|
1588
|
+
def post.active; false; end
|
1589
|
+
|
1590
|
+
form_for(post) do |f|
|
1591
|
+
rendered_radio_buttons = f.collection_radio_buttons(:active, [true, false], :to_s, :to_s) do |b|
|
1592
|
+
b.label { b.radio_button + b.text }
|
1593
|
+
end
|
1594
|
+
concat rendered_radio_buttons
|
1595
|
+
end
|
1596
|
+
|
1597
|
+
expected = whole_form("/posts", "new_post", "new_post") do
|
1598
|
+
"<label for='post_active_true'>"+
|
1599
|
+
"<input id='post_active_true' name='post[active]' type='radio' value='true' />" +
|
1600
|
+
"true</label>" +
|
1601
|
+
"<label for='post_active_false'>"+
|
1602
|
+
"<input checked='checked' id='post_active_false' name='post[active]' type='radio' value='false' />" +
|
1603
|
+
"false</label>"
|
1604
|
+
end
|
1605
|
+
|
1606
|
+
assert_dom_equal expected, output_buffer
|
1607
|
+
end
|
1608
|
+
|
1609
|
+
def test_form_for_with_collection_radio_buttons_with_custom_builder_block_does_not_leak_the_template
|
1610
|
+
post = Post.new
|
1611
|
+
def post.active; false; end
|
1612
|
+
def post.id; 1; end
|
1613
|
+
|
1614
|
+
form_for(post) do |f|
|
1615
|
+
rendered_radio_buttons = f.collection_radio_buttons(:active, [true, false], :to_s, :to_s) do |b|
|
1616
|
+
b.label { b.radio_button + b.text }
|
1617
|
+
end
|
1618
|
+
concat rendered_radio_buttons
|
1619
|
+
concat f.hidden_field :id
|
1620
|
+
end
|
1621
|
+
|
1622
|
+
expected = whole_form("/posts", "new_post_1", "new_post") do
|
1623
|
+
"<label for='post_active_true'>"+
|
1624
|
+
"<input id='post_active_true' name='post[active]' type='radio' value='true' />" +
|
1625
|
+
"true</label>" +
|
1626
|
+
"<label for='post_active_false'>"+
|
1627
|
+
"<input checked='checked' id='post_active_false' name='post[active]' type='radio' value='false' />" +
|
1628
|
+
"false</label>"+
|
1629
|
+
"<input id='post_id' name='post[id]' type='hidden' value='1' />"
|
1630
|
+
end
|
1631
|
+
|
1632
|
+
assert_dom_equal expected, output_buffer
|
1633
|
+
end
|
1634
|
+
|
1635
|
+
def test_form_with_namespace_and_with_collection_radio_buttons
|
1636
|
+
post = Post.new
|
1637
|
+
def post.active; false; end
|
1638
|
+
|
1639
|
+
form_for(post, namespace: 'foo') do |f|
|
1640
|
+
concat f.collection_radio_buttons(:active, [true, false], :to_s, :to_s)
|
1641
|
+
end
|
1642
|
+
|
1643
|
+
expected = whole_form("/posts", "foo_new_post", "new_post") do
|
1644
|
+
"<input id='foo_post_active_true' name='post[active]' type='radio' value='true' />" +
|
1645
|
+
"<label for='foo_post_active_true'>true</label>" +
|
1646
|
+
"<input checked='checked' id='foo_post_active_false' name='post[active]' type='radio' value='false' />" +
|
1647
|
+
"<label for='foo_post_active_false'>false</label>"
|
1648
|
+
end
|
1649
|
+
|
1650
|
+
assert_dom_equal expected, output_buffer
|
1651
|
+
end
|
1652
|
+
|
1653
|
+
def test_form_with_index_and_with_collection_radio_buttons
|
1654
|
+
post = Post.new
|
1655
|
+
def post.active; false; end
|
1656
|
+
|
1657
|
+
form_for(post, index: '1') do |f|
|
1658
|
+
concat f.collection_radio_buttons(:active, [true, false], :to_s, :to_s)
|
1659
|
+
end
|
1660
|
+
|
1661
|
+
expected = whole_form("/posts", "new_post", "new_post") do
|
1662
|
+
"<input id='post_1_active_true' name='post[1][active]' type='radio' value='true' />" +
|
1663
|
+
"<label for='post_1_active_true'>true</label>" +
|
1664
|
+
"<input checked='checked' id='post_1_active_false' name='post[1][active]' type='radio' value='false' />" +
|
1665
|
+
"<label for='post_1_active_false'>false</label>"
|
1666
|
+
end
|
1667
|
+
|
1668
|
+
assert_dom_equal expected, output_buffer
|
1669
|
+
end
|
1670
|
+
|
1671
|
+
def test_form_for_with_collection_check_boxes
|
1672
|
+
post = Post.new
|
1673
|
+
def post.tag_ids; [1, 3]; end
|
1674
|
+
collection = (1..3).map { |i| [i, "Tag #{i}"] }
|
1675
|
+
form_for(post) do |f|
|
1676
|
+
concat f.collection_check_boxes(:tag_ids, collection, :first, :last)
|
1677
|
+
end
|
1678
|
+
|
1679
|
+
expected = whole_form("/posts", "new_post", "new_post") do
|
1680
|
+
"<input checked='checked' id='post_tag_ids_1' name='post[tag_ids][]' type='checkbox' value='1' />" +
|
1681
|
+
"<label for='post_tag_ids_1'>Tag 1</label>" +
|
1682
|
+
"<input id='post_tag_ids_2' name='post[tag_ids][]' type='checkbox' value='2' />" +
|
1683
|
+
"<label for='post_tag_ids_2'>Tag 2</label>" +
|
1684
|
+
"<input checked='checked' id='post_tag_ids_3' name='post[tag_ids][]' type='checkbox' value='3' />" +
|
1685
|
+
"<label for='post_tag_ids_3'>Tag 3</label>" +
|
1686
|
+
"<input name='post[tag_ids][]' type='hidden' value='' />"
|
1687
|
+
end
|
1688
|
+
|
1689
|
+
assert_dom_equal expected, output_buffer
|
1690
|
+
end
|
1691
|
+
|
1692
|
+
def test_form_for_with_collection_check_boxes_with_custom_builder_block
|
1693
|
+
post = Post.new
|
1694
|
+
def post.tag_ids; [1, 3]; end
|
1695
|
+
collection = (1..3).map { |i| [i, "Tag #{i}"] }
|
1696
|
+
form_for(post) do |f|
|
1697
|
+
rendered_check_boxes = f.collection_check_boxes(:tag_ids, collection, :first, :last) do |b|
|
1698
|
+
b.label { b.check_box + b.text }
|
1699
|
+
end
|
1700
|
+
concat rendered_check_boxes
|
1701
|
+
end
|
1702
|
+
|
1703
|
+
expected = whole_form("/posts", "new_post", "new_post") do
|
1704
|
+
"<label for='post_tag_ids_1'>" +
|
1705
|
+
"<input checked='checked' id='post_tag_ids_1' name='post[tag_ids][]' type='checkbox' value='1' />" +
|
1706
|
+
"Tag 1</label>" +
|
1707
|
+
"<label for='post_tag_ids_2'>" +
|
1708
|
+
"<input id='post_tag_ids_2' name='post[tag_ids][]' type='checkbox' value='2' />" +
|
1709
|
+
"Tag 2</label>" +
|
1710
|
+
"<label for='post_tag_ids_3'>" +
|
1711
|
+
"<input checked='checked' id='post_tag_ids_3' name='post[tag_ids][]' type='checkbox' value='3' />" +
|
1712
|
+
"Tag 3</label>" +
|
1713
|
+
"<input name='post[tag_ids][]' type='hidden' value='' />"
|
1714
|
+
end
|
1715
|
+
|
1716
|
+
assert_dom_equal expected, output_buffer
|
1717
|
+
end
|
1718
|
+
|
1719
|
+
def test_form_for_with_collection_check_boxes_with_custom_builder_block_does_not_leak_the_template
|
1720
|
+
post = Post.new
|
1721
|
+
def post.tag_ids; [1, 3]; end
|
1722
|
+
def post.id; 1; end
|
1723
|
+
collection = (1..3).map { |i| [i, "Tag #{i}"] }
|
1724
|
+
|
1725
|
+
form_for(post) do |f|
|
1726
|
+
rendered_check_boxes = f.collection_check_boxes(:tag_ids, collection, :first, :last) do |b|
|
1727
|
+
b.label { b.check_box + b.text }
|
1728
|
+
end
|
1729
|
+
concat rendered_check_boxes
|
1730
|
+
concat f.hidden_field :id
|
1731
|
+
end
|
1732
|
+
|
1733
|
+
expected = whole_form("/posts", "new_post_1", "new_post") do
|
1734
|
+
"<label for='post_tag_ids_1'>" +
|
1735
|
+
"<input checked='checked' id='post_tag_ids_1' name='post[tag_ids][]' type='checkbox' value='1' />" +
|
1736
|
+
"Tag 1</label>" +
|
1737
|
+
"<label for='post_tag_ids_2'>" +
|
1738
|
+
"<input id='post_tag_ids_2' name='post[tag_ids][]' type='checkbox' value='2' />" +
|
1739
|
+
"Tag 2</label>" +
|
1740
|
+
"<label for='post_tag_ids_3'>" +
|
1741
|
+
"<input checked='checked' id='post_tag_ids_3' name='post[tag_ids][]' type='checkbox' value='3' />" +
|
1742
|
+
"Tag 3</label>" +
|
1743
|
+
"<input name='post[tag_ids][]' type='hidden' value='' />"+
|
1744
|
+
"<input id='post_id' name='post[id]' type='hidden' value='1' />"
|
1745
|
+
end
|
1746
|
+
|
1747
|
+
assert_dom_equal expected, output_buffer
|
1748
|
+
end
|
1749
|
+
|
1750
|
+
def test_form_with_namespace_and_with_collection_check_boxes
|
1751
|
+
post = Post.new
|
1752
|
+
def post.tag_ids; [1]; end
|
1753
|
+
collection = [[1, "Tag 1"]]
|
1754
|
+
|
1755
|
+
form_for(post, namespace: 'foo') do |f|
|
1756
|
+
concat f.collection_check_boxes(:tag_ids, collection, :first, :last)
|
1757
|
+
end
|
1758
|
+
|
1759
|
+
expected = whole_form("/posts", "foo_new_post", "new_post") do
|
1760
|
+
"<input checked='checked' id='foo_post_tag_ids_1' name='post[tag_ids][]' type='checkbox' value='1' />" +
|
1761
|
+
"<label for='foo_post_tag_ids_1'>Tag 1</label>" +
|
1762
|
+
"<input name='post[tag_ids][]' type='hidden' value='' />"
|
1763
|
+
end
|
1764
|
+
|
1765
|
+
assert_dom_equal expected, output_buffer
|
1766
|
+
end
|
1767
|
+
|
1768
|
+
def test_form_with_index_and_with_collection_check_boxes
|
1769
|
+
post = Post.new
|
1770
|
+
def post.tag_ids; [1]; end
|
1771
|
+
collection = [[1, "Tag 1"]]
|
1772
|
+
|
1773
|
+
form_for(post, index: '1') do |f|
|
1774
|
+
concat f.collection_check_boxes(:tag_ids, collection, :first, :last)
|
1775
|
+
end
|
1776
|
+
|
1777
|
+
expected = whole_form("/posts", "new_post", "new_post") do
|
1778
|
+
"<input checked='checked' id='post_1_tag_ids_1' name='post[1][tag_ids][]' type='checkbox' value='1' />" +
|
1779
|
+
"<label for='post_1_tag_ids_1'>Tag 1</label>" +
|
1780
|
+
"<input name='post[1][tag_ids][]' type='hidden' value='' />"
|
1781
|
+
end
|
1782
|
+
|
1783
|
+
assert_dom_equal expected, output_buffer
|
1784
|
+
end
|
1785
|
+
|
1786
|
+
def test_form_for_with_file_field_generate_multipart
|
1787
|
+
Post.send :attr_accessor, :file
|
1788
|
+
|
1789
|
+
form_for(@post, html: { id: 'create-post' }) do |f|
|
1790
|
+
concat f.file_field(:file)
|
1791
|
+
end
|
1792
|
+
|
1793
|
+
expected = whole_form("/posts/123", "create-post", "edit_post", method: "patch", multipart: true) do
|
1794
|
+
"<input name='post[file]' type='file' id='post_file' />"
|
1795
|
+
end
|
1796
|
+
|
1797
|
+
assert_dom_equal expected, output_buffer
|
1798
|
+
end
|
1799
|
+
|
1800
|
+
def test_fields_for_with_file_field_generate_multipart
|
1801
|
+
Comment.send :attr_accessor, :file
|
1802
|
+
|
1803
|
+
form_for(@post) do |f|
|
1804
|
+
concat f.fields_for(:comment, @post) { |c|
|
1805
|
+
concat c.file_field(:file)
|
1806
|
+
}
|
1807
|
+
end
|
1808
|
+
|
1809
|
+
expected = whole_form("/posts/123", "edit_post_123", "edit_post", method: "patch", multipart: true) do
|
1810
|
+
"<input name='post[comment][file]' type='file' id='post_comment_file' />"
|
1811
|
+
end
|
1812
|
+
|
1813
|
+
assert_dom_equal expected, output_buffer
|
1814
|
+
end
|
1815
|
+
|
1816
|
+
def test_form_for_with_format
|
1817
|
+
form_for(@post, format: :json, html: { id: "edit_post_123", class: "edit_post" }) do |f|
|
1818
|
+
concat f.label(:title)
|
1819
|
+
end
|
1820
|
+
|
1821
|
+
expected = whole_form("/posts/123.json", "edit_post_123", "edit_post", method: 'patch') do
|
1822
|
+
"<label for='post_title'>Title</label>"
|
1823
|
+
end
|
1824
|
+
|
1825
|
+
assert_dom_equal expected, output_buffer
|
1826
|
+
end
|
1827
|
+
|
1828
|
+
def test_form_for_with_model_using_relative_model_naming
|
1829
|
+
blog_post = Blog::Post.new("And his name will be forty and four.", 44)
|
1830
|
+
|
1831
|
+
form_for(blog_post) do |f|
|
1832
|
+
concat f.text_field :title
|
1833
|
+
concat f.submit('Edit post')
|
1834
|
+
end
|
1835
|
+
|
1836
|
+
expected = whole_form("/posts/44", "edit_post_44", "edit_post", method: "patch") do
|
1837
|
+
"<input name='post[title]' type='text' id='post_title' value='And his name will be forty and four.' />" +
|
1838
|
+
"<input name='commit' type='submit' value='Edit post' />"
|
1839
|
+
end
|
1840
|
+
|
1841
|
+
assert_dom_equal expected, output_buffer
|
1842
|
+
end
|
1843
|
+
|
1844
|
+
def test_form_for_with_symbol_object_name
|
1845
|
+
form_for(@post, as: "other_name", html: { id: "create-post" }) do |f|
|
1846
|
+
concat f.label(:title, class: 'post_title')
|
1847
|
+
concat f.text_field(:title)
|
1848
|
+
concat f.text_area(:body)
|
1849
|
+
concat f.check_box(:secret)
|
1850
|
+
concat f.submit('Create post')
|
1851
|
+
end
|
1852
|
+
|
1853
|
+
expected = whole_form("/posts/123", "create-post", "edit_other_name", method: "patch") do
|
1854
|
+
"<label for='other_name_title' class='post_title'>Title</label>" +
|
1855
|
+
"<input name='other_name[title]' id='other_name_title' value='Hello World' type='text' />" +
|
1856
|
+
"<textarea name='other_name[body]' id='other_name_body'>\nBack to the hill and over it again!</textarea>" +
|
1857
|
+
"<input name='other_name[secret]' value='0' type='hidden' />" +
|
1858
|
+
"<input name='other_name[secret]' checked='checked' id='other_name_secret' value='1' type='checkbox' />" +
|
1859
|
+
"<input name='commit' value='Create post' type='submit' />"
|
1860
|
+
end
|
1861
|
+
|
1862
|
+
assert_dom_equal expected, output_buffer
|
1863
|
+
end
|
1864
|
+
|
1865
|
+
def test_form_tags_do_not_call_private_properties_on_form_object
|
1866
|
+
obj = Class.new do
|
1867
|
+
private
|
1868
|
+
|
1869
|
+
def private_property
|
1870
|
+
raise "This method should not be called."
|
1871
|
+
end
|
1872
|
+
end.new
|
1873
|
+
|
1874
|
+
form_for(obj, as: "other_name", url: '/', html: { id: "edit-other-name" }) do |f|
|
1875
|
+
assert_raise(NoMethodError) { f.hidden_field(:private_property) }
|
1876
|
+
end
|
1877
|
+
end
|
1878
|
+
|
1879
|
+
def test_form_for_with_method_as_part_of_html_options
|
1880
|
+
form_for(@post, url: '/', html: { id: 'create-post', method: :delete }) do |f|
|
1881
|
+
concat f.text_field(:title)
|
1882
|
+
concat f.text_area(:body)
|
1883
|
+
concat f.check_box(:secret)
|
1884
|
+
end
|
1885
|
+
|
1886
|
+
expected = whole_form("/", "create-post", "edit_post", method: "delete") do
|
1887
|
+
"<input name='post[title]' type='text' id='post_title' value='Hello World' />" +
|
1888
|
+
"<textarea name='post[body]' id='post_body'>\nBack to the hill and over it again!</textarea>" +
|
1889
|
+
"<input name='post[secret]' type='hidden' value='0' />" +
|
1890
|
+
"<input name='post[secret]' checked='checked' type='checkbox' id='post_secret' value='1' />"
|
1891
|
+
end
|
1892
|
+
|
1893
|
+
assert_dom_equal expected, output_buffer
|
1894
|
+
end
|
1895
|
+
|
1896
|
+
def test_form_for_with_method
|
1897
|
+
form_for(@post, url: '/', method: :delete, html: { id: 'create-post' }) do |f|
|
1898
|
+
concat f.text_field(:title)
|
1899
|
+
concat f.text_area(:body)
|
1900
|
+
concat f.check_box(:secret)
|
1901
|
+
end
|
1902
|
+
|
1903
|
+
expected = whole_form("/", "create-post", "edit_post", method: "delete") do
|
1904
|
+
"<input name='post[title]' type='text' id='post_title' value='Hello World' />" +
|
1905
|
+
"<textarea name='post[body]' id='post_body'>\nBack to the hill and over it again!</textarea>" +
|
1906
|
+
"<input name='post[secret]' type='hidden' value='0' />" +
|
1907
|
+
"<input name='post[secret]' checked='checked' type='checkbox' id='post_secret' value='1' />"
|
1908
|
+
end
|
1909
|
+
|
1910
|
+
assert_dom_equal expected, output_buffer
|
1911
|
+
end
|
1912
|
+
|
1913
|
+
def test_form_for_with_search_field
|
1914
|
+
# Test case for bug which would emit an "object" attribute
|
1915
|
+
# when used with form_for using a search_field form helper
|
1916
|
+
form_for(Post.new, url: "/search", html: { id: "search-post", method: :get }) do |f|
|
1917
|
+
concat f.search_field(:title)
|
1918
|
+
end
|
1919
|
+
|
1920
|
+
expected = whole_form("/search", "search-post", "new_post", method: "get") do
|
1921
|
+
"<input name='post[title]' type='search' id='post_title' />"
|
1922
|
+
end
|
1923
|
+
|
1924
|
+
assert_dom_equal expected, output_buffer
|
1925
|
+
end
|
1926
|
+
|
1927
|
+
def test_form_for_with_remote
|
1928
|
+
form_for(@post, url: '/', remote: true, html: { id: 'create-post', method: :patch }) do |f|
|
1929
|
+
concat f.text_field(:title)
|
1930
|
+
concat f.text_area(:body)
|
1931
|
+
concat f.check_box(:secret)
|
1932
|
+
end
|
1933
|
+
|
1934
|
+
expected = whole_form("/", "create-post", "edit_post", method: "patch", remote: true) do
|
1935
|
+
"<input name='post[title]' type='text' id='post_title' value='Hello World' />" +
|
1936
|
+
"<textarea name='post[body]' id='post_body'>\nBack to the hill and over it again!</textarea>" +
|
1937
|
+
"<input name='post[secret]' type='hidden' value='0' />" +
|
1938
|
+
"<input name='post[secret]' checked='checked' type='checkbox' id='post_secret' value='1' />"
|
1939
|
+
end
|
1940
|
+
|
1941
|
+
assert_dom_equal expected, output_buffer
|
1942
|
+
end
|
1943
|
+
|
1944
|
+
def test_form_for_enforce_utf8_true
|
1945
|
+
form_for(:post, enforce_utf8: true) do |f|
|
1946
|
+
concat f.text_field(:title)
|
1947
|
+
end
|
1948
|
+
|
1949
|
+
expected = whole_form("/", nil, nil, enforce_utf8: true) do
|
1950
|
+
"<input name='post[title]' type='text' id='post_title' value='Hello World' />"
|
1951
|
+
end
|
1952
|
+
|
1953
|
+
assert_dom_equal expected, output_buffer
|
1954
|
+
end
|
1955
|
+
|
1956
|
+
def test_form_for_enforce_utf8_false
|
1957
|
+
form_for(:post, enforce_utf8: false) do |f|
|
1958
|
+
concat f.text_field(:title)
|
1959
|
+
end
|
1960
|
+
|
1961
|
+
expected = whole_form("/", nil, nil, enforce_utf8: false) do
|
1962
|
+
"<input name='post[title]' type='text' id='post_title' value='Hello World' />"
|
1963
|
+
end
|
1964
|
+
|
1965
|
+
assert_dom_equal expected, output_buffer
|
1966
|
+
end
|
1967
|
+
|
1968
|
+
def test_form_for_with_remote_in_html
|
1969
|
+
form_for(@post, url: '/', html: { remote: true, id: 'create-post', method: :patch }) do |f|
|
1970
|
+
concat f.text_field(:title)
|
1971
|
+
concat f.text_area(:body)
|
1972
|
+
concat f.check_box(:secret)
|
1973
|
+
end
|
1974
|
+
|
1975
|
+
expected = whole_form("/", "create-post", "edit_post", method: "patch", remote: true) do
|
1976
|
+
"<input name='post[title]' type='text' id='post_title' value='Hello World' />" +
|
1977
|
+
"<textarea name='post[body]' id='post_body'>\nBack to the hill and over it again!</textarea>" +
|
1978
|
+
"<input name='post[secret]' type='hidden' value='0' />" +
|
1979
|
+
"<input name='post[secret]' checked='checked' type='checkbox' id='post_secret' value='1' />"
|
1980
|
+
end
|
1981
|
+
|
1982
|
+
assert_dom_equal expected, output_buffer
|
1983
|
+
end
|
1984
|
+
|
1985
|
+
def test_form_for_with_remote_without_html
|
1986
|
+
@post.persisted = false
|
1987
|
+
@post.stubs(:to_key).returns(nil)
|
1988
|
+
form_for(@post, remote: true) do |f|
|
1989
|
+
concat f.text_field(:title)
|
1990
|
+
concat f.text_area(:body)
|
1991
|
+
concat f.check_box(:secret)
|
1992
|
+
end
|
1993
|
+
|
1994
|
+
expected = whole_form("/posts", "new_post", "new_post", remote: true) do
|
1995
|
+
"<input name='post[title]' type='text' id='post_title' value='Hello World' />" +
|
1996
|
+
"<textarea name='post[body]' id='post_body'>\nBack to the hill and over it again!</textarea>" +
|
1997
|
+
"<input name='post[secret]' type='hidden' value='0' />" +
|
1998
|
+
"<input name='post[secret]' checked='checked' type='checkbox' id='post_secret' value='1' />"
|
1999
|
+
end
|
2000
|
+
|
2001
|
+
assert_dom_equal expected, output_buffer
|
2002
|
+
end
|
2003
|
+
|
2004
|
+
def test_form_for_without_object
|
2005
|
+
form_for(:post, html: { id: 'create-post' }) do |f|
|
2006
|
+
concat f.text_field(:title)
|
2007
|
+
concat f.text_area(:body)
|
2008
|
+
concat f.check_box(:secret)
|
2009
|
+
end
|
2010
|
+
|
2011
|
+
expected = whole_form("/", "create-post") do
|
2012
|
+
"<input name='post[title]' type='text' id='post_title' value='Hello World' />" +
|
2013
|
+
"<textarea name='post[body]' id='post_body'>\nBack to the hill and over it again!</textarea>" +
|
2014
|
+
"<input name='post[secret]' type='hidden' value='0' />" +
|
2015
|
+
"<input name='post[secret]' checked='checked' type='checkbox' id='post_secret' value='1' />"
|
2016
|
+
end
|
2017
|
+
|
2018
|
+
assert_dom_equal expected, output_buffer
|
2019
|
+
end
|
2020
|
+
|
2021
|
+
def test_form_for_with_index
|
2022
|
+
form_for(@post, as: "post[]") do |f|
|
2023
|
+
concat f.label(:title)
|
2024
|
+
concat f.text_field(:title)
|
2025
|
+
concat f.text_area(:body)
|
2026
|
+
concat f.check_box(:secret)
|
2027
|
+
end
|
2028
|
+
|
2029
|
+
expected = whole_form('/posts/123', 'edit_post[]', 'edit_post[]', method: 'patch') do
|
2030
|
+
"<label for='post_123_title'>Title</label>" +
|
2031
|
+
"<input name='post[123][title]' type='text' id='post_123_title' value='Hello World' />" +
|
2032
|
+
"<textarea name='post[123][body]' id='post_123_body'>\nBack to the hill and over it again!</textarea>" +
|
2033
|
+
"<input name='post[123][secret]' type='hidden' value='0' />" +
|
2034
|
+
"<input name='post[123][secret]' checked='checked' type='checkbox' id='post_123_secret' value='1' />"
|
2035
|
+
end
|
2036
|
+
|
2037
|
+
assert_dom_equal expected, output_buffer
|
2038
|
+
end
|
2039
|
+
|
2040
|
+
def test_form_for_with_nil_index_option_override
|
2041
|
+
form_for(@post, as: "post[]", index: nil) do |f|
|
2042
|
+
concat f.text_field(:title)
|
2043
|
+
concat f.text_area(:body)
|
2044
|
+
concat f.check_box(:secret)
|
2045
|
+
end
|
2046
|
+
|
2047
|
+
expected = whole_form('/posts/123', 'edit_post[]', 'edit_post[]', method: 'patch') do
|
2048
|
+
"<input name='post[][title]' type='text' id='post__title' value='Hello World' />" +
|
2049
|
+
"<textarea name='post[][body]' id='post__body'>\nBack to the hill and over it again!</textarea>" +
|
2050
|
+
"<input name='post[][secret]' type='hidden' value='0' />" +
|
2051
|
+
"<input name='post[][secret]' checked='checked' type='checkbox' id='post__secret' value='1' />"
|
2052
|
+
end
|
2053
|
+
|
2054
|
+
assert_dom_equal expected, output_buffer
|
2055
|
+
end
|
2056
|
+
|
2057
|
+
def test_form_for_label_error_wrapping
|
2058
|
+
form_for(@post) do |f|
|
2059
|
+
concat f.label(:author_name, class: 'label')
|
2060
|
+
concat f.text_field(:author_name)
|
2061
|
+
concat f.submit('Create post')
|
2062
|
+
end
|
2063
|
+
|
2064
|
+
expected = whole_form('/posts/123', 'edit_post_123', 'edit_post', method: 'patch') do
|
2065
|
+
"<div class='field_with_errors'><label for='post_author_name' class='label'>Author name</label></div>" +
|
2066
|
+
"<div class='field_with_errors'><input name='post[author_name]' type='text' id='post_author_name' value='' /></div>" +
|
2067
|
+
"<input name='commit' type='submit' value='Create post' />"
|
2068
|
+
end
|
2069
|
+
|
2070
|
+
assert_dom_equal expected, output_buffer
|
2071
|
+
end
|
2072
|
+
|
2073
|
+
def test_form_for_label_error_wrapping_without_conventional_instance_variable
|
2074
|
+
post = remove_instance_variable :@post
|
2075
|
+
|
2076
|
+
form_for(post) do |f|
|
2077
|
+
concat f.label(:author_name, class: 'label')
|
2078
|
+
concat f.text_field(:author_name)
|
2079
|
+
concat f.submit('Create post')
|
2080
|
+
end
|
2081
|
+
|
2082
|
+
expected = whole_form('/posts/123', 'edit_post_123', 'edit_post', method: 'patch') do
|
2083
|
+
"<div class='field_with_errors'><label for='post_author_name' class='label'>Author name</label></div>" +
|
2084
|
+
"<div class='field_with_errors'><input name='post[author_name]' type='text' id='post_author_name' value='' /></div>" +
|
2085
|
+
"<input name='commit' type='submit' value='Create post' />"
|
2086
|
+
end
|
2087
|
+
|
2088
|
+
assert_dom_equal expected, output_buffer
|
2089
|
+
end
|
2090
|
+
|
2091
|
+
def test_form_for_label_error_wrapping_block_and_non_block_versions
|
2092
|
+
form_for(@post) do |f|
|
2093
|
+
concat f.label(:author_name, 'Name', class: 'label')
|
2094
|
+
concat f.label(:author_name, class: 'label') { 'Name' }
|
2095
|
+
end
|
2096
|
+
|
2097
|
+
expected = whole_form('/posts/123', 'edit_post_123', 'edit_post', method: 'patch') do
|
2098
|
+
"<div class='field_with_errors'><label for='post_author_name' class='label'>Name</label></div>" +
|
2099
|
+
"<div class='field_with_errors'><label for='post_author_name' class='label'>Name</label></div>"
|
2100
|
+
end
|
2101
|
+
|
2102
|
+
assert_dom_equal expected, output_buffer
|
2103
|
+
end
|
2104
|
+
|
2105
|
+
def test_form_for_with_namespace
|
2106
|
+
form_for(@post, namespace: 'namespace') do |f|
|
2107
|
+
concat f.text_field(:title)
|
2108
|
+
concat f.text_area(:body)
|
2109
|
+
concat f.check_box(:secret)
|
2110
|
+
end
|
2111
|
+
|
2112
|
+
expected = whole_form('/posts/123', 'namespace_edit_post_123', 'edit_post', method: 'patch') do
|
2113
|
+
"<input name='post[title]' type='text' id='namespace_post_title' value='Hello World' />" +
|
2114
|
+
"<textarea name='post[body]' id='namespace_post_body'>\nBack to the hill and over it again!</textarea>" +
|
2115
|
+
"<input name='post[secret]' type='hidden' value='0' />" +
|
2116
|
+
"<input name='post[secret]' checked='checked' type='checkbox' id='namespace_post_secret' value='1' />"
|
2117
|
+
end
|
2118
|
+
|
2119
|
+
assert_dom_equal expected, output_buffer
|
2120
|
+
end
|
2121
|
+
|
2122
|
+
def test_form_for_with_namespace_with_date_select
|
2123
|
+
form_for(@post, namespace: 'namespace') do |f|
|
2124
|
+
concat f.date_select(:written_on)
|
2125
|
+
end
|
2126
|
+
|
2127
|
+
assert_select 'select#namespace_post_written_on_1i'
|
2128
|
+
end
|
2129
|
+
|
2130
|
+
def test_form_for_with_namespace_with_label
|
2131
|
+
form_for(@post, namespace: 'namespace') do |f|
|
2132
|
+
concat f.label(:title)
|
2133
|
+
concat f.text_field(:title)
|
2134
|
+
end
|
2135
|
+
|
2136
|
+
expected = whole_form('/posts/123', 'namespace_edit_post_123', 'edit_post', method: 'patch') do
|
2137
|
+
"<label for='namespace_post_title'>Title</label>" +
|
2138
|
+
"<input name='post[title]' type='text' id='namespace_post_title' value='Hello World' />"
|
2139
|
+
end
|
2140
|
+
|
2141
|
+
assert_dom_equal expected, output_buffer
|
2142
|
+
end
|
2143
|
+
|
2144
|
+
def test_form_for_with_namespace_and_as_option
|
2145
|
+
form_for(@post, namespace: 'namespace', as: 'custom_name') do |f|
|
2146
|
+
concat f.text_field(:title)
|
2147
|
+
end
|
2148
|
+
|
2149
|
+
expected = whole_form('/posts/123', 'namespace_edit_custom_name', 'edit_custom_name', method: 'patch') do
|
2150
|
+
"<input id='namespace_custom_name_title' name='custom_name[title]' type='text' value='Hello World' />"
|
2151
|
+
end
|
2152
|
+
|
2153
|
+
assert_dom_equal expected, output_buffer
|
2154
|
+
end
|
2155
|
+
|
2156
|
+
def test_two_form_for_with_namespace
|
2157
|
+
form_for(@post, namespace: 'namespace_1') do |f|
|
2158
|
+
concat f.label(:title)
|
2159
|
+
concat f.text_field(:title)
|
2160
|
+
end
|
2161
|
+
|
2162
|
+
expected_1 = whole_form('/posts/123', 'namespace_1_edit_post_123', 'edit_post', method: 'patch') do
|
2163
|
+
"<label for='namespace_1_post_title'>Title</label>" +
|
2164
|
+
"<input name='post[title]' type='text' id='namespace_1_post_title' value='Hello World' />"
|
2165
|
+
end
|
2166
|
+
|
2167
|
+
assert_dom_equal expected_1, output_buffer
|
2168
|
+
|
2169
|
+
form_for(@post, namespace: 'namespace_2') do |f|
|
2170
|
+
concat f.label(:title)
|
2171
|
+
concat f.text_field(:title)
|
2172
|
+
end
|
2173
|
+
|
2174
|
+
expected_2 = whole_form('/posts/123', 'namespace_2_edit_post_123', 'edit_post', method: 'patch') do
|
2175
|
+
"<label for='namespace_2_post_title'>Title</label>" +
|
2176
|
+
"<input name='post[title]' type='text' id='namespace_2_post_title' value='Hello World' />"
|
2177
|
+
end
|
2178
|
+
|
2179
|
+
assert_dom_equal expected_2, output_buffer
|
2180
|
+
end
|
2181
|
+
|
2182
|
+
def test_fields_for_with_namespace
|
2183
|
+
@comment.body = 'Hello World'
|
2184
|
+
form_for(@post, namespace: 'namespace') do |f|
|
2185
|
+
concat f.text_field(:title)
|
2186
|
+
concat f.text_area(:body)
|
2187
|
+
concat f.fields_for(@comment) { |c|
|
2188
|
+
concat c.text_field(:body)
|
2189
|
+
}
|
2190
|
+
end
|
2191
|
+
|
2192
|
+
expected = whole_form('/posts/123', 'namespace_edit_post_123', 'edit_post', method: 'patch') do
|
2193
|
+
"<input name='post[title]' type='text' id='namespace_post_title' value='Hello World' />" +
|
2194
|
+
"<textarea name='post[body]' id='namespace_post_body'>\nBack to the hill and over it again!</textarea>" +
|
2195
|
+
"<input name='post[comment][body]' type='text' id='namespace_post_comment_body' value='Hello World' />"
|
2196
|
+
end
|
2197
|
+
|
2198
|
+
assert_dom_equal expected, output_buffer
|
2199
|
+
end
|
2200
|
+
|
2201
|
+
def test_submit_with_object_as_new_record_and_locale_strings
|
2202
|
+
with_locale :submit do
|
2203
|
+
@post.persisted = false
|
2204
|
+
@post.stubs(:to_key).returns(nil)
|
2205
|
+
form_for(@post) do |f|
|
2206
|
+
concat f.submit
|
2207
|
+
end
|
2208
|
+
|
2209
|
+
expected = whole_form('/posts', 'new_post', 'new_post') do
|
2210
|
+
"<input name='commit' type='submit' value='Create Post' />"
|
2211
|
+
end
|
2212
|
+
|
2213
|
+
assert_dom_equal expected, output_buffer
|
2214
|
+
end
|
2215
|
+
end
|
2216
|
+
|
2217
|
+
def test_submit_with_object_as_existing_record_and_locale_strings
|
2218
|
+
with_locale :submit do
|
2219
|
+
form_for(@post) do |f|
|
2220
|
+
concat f.submit
|
2221
|
+
end
|
2222
|
+
|
2223
|
+
expected = whole_form('/posts/123', 'edit_post_123', 'edit_post', method: 'patch') do
|
2224
|
+
"<input name='commit' type='submit' value='Confirm Post changes' />"
|
2225
|
+
end
|
2226
|
+
|
2227
|
+
assert_dom_equal expected, output_buffer
|
2228
|
+
end
|
2229
|
+
end
|
2230
|
+
|
2231
|
+
def test_submit_without_object_and_locale_strings
|
2232
|
+
with_locale :submit do
|
2233
|
+
form_for(:post) do |f|
|
2234
|
+
concat f.submit class: "extra"
|
2235
|
+
end
|
2236
|
+
|
2237
|
+
expected = whole_form do
|
2238
|
+
"<input name='commit' class='extra' type='submit' value='Save changes' />"
|
2239
|
+
end
|
2240
|
+
|
2241
|
+
assert_dom_equal expected, output_buffer
|
2242
|
+
end
|
2243
|
+
end
|
2244
|
+
|
2245
|
+
def test_submit_with_object_and_nested_lookup
|
2246
|
+
with_locale :submit do
|
2247
|
+
form_for(@post, as: :another_post) do |f|
|
2248
|
+
concat f.submit
|
2249
|
+
end
|
2250
|
+
|
2251
|
+
expected = whole_form('/posts/123', 'edit_another_post', 'edit_another_post', method: 'patch') do
|
2252
|
+
"<input name='commit' type='submit' value='Update your Post' />"
|
2253
|
+
end
|
2254
|
+
|
2255
|
+
assert_dom_equal expected, output_buffer
|
2256
|
+
end
|
2257
|
+
end
|
2258
|
+
|
2259
|
+
def test_nested_fields_for
|
2260
|
+
@comment.body = 'Hello World'
|
2261
|
+
form_for(@post) do |f|
|
2262
|
+
concat f.fields_for(@comment) { |c|
|
2263
|
+
concat c.text_field(:body)
|
2264
|
+
}
|
2265
|
+
end
|
2266
|
+
|
2267
|
+
expected = whole_form('/posts/123', 'edit_post_123', 'edit_post', method: 'patch') do
|
2268
|
+
"<input name='post[comment][body]' type='text' id='post_comment_body' value='Hello World' />"
|
2269
|
+
end
|
2270
|
+
|
2271
|
+
assert_dom_equal expected, output_buffer
|
2272
|
+
end
|
2273
|
+
|
2274
|
+
def test_nested_fields_for_with_nested_collections
|
2275
|
+
form_for(@post, as: 'post[]') do |f|
|
2276
|
+
concat f.text_field(:title)
|
2277
|
+
concat f.fields_for('comment[]', @comment) { |c|
|
2278
|
+
concat c.text_field(:name)
|
2279
|
+
}
|
2280
|
+
end
|
2281
|
+
|
2282
|
+
expected = whole_form('/posts/123', 'edit_post[]', 'edit_post[]', method: 'patch') do
|
2283
|
+
"<input name='post[123][title]' type='text' id='post_123_title' value='Hello World' />" +
|
2284
|
+
"<input name='post[123][comment][][name]' type='text' id='post_123_comment__name' value='new comment' />"
|
2285
|
+
end
|
2286
|
+
|
2287
|
+
assert_dom_equal expected, output_buffer
|
2288
|
+
end
|
2289
|
+
|
2290
|
+
def test_nested_fields_for_with_index_and_parent_fields
|
2291
|
+
form_for(@post, index: 1) do |c|
|
2292
|
+
concat c.text_field(:title)
|
2293
|
+
concat c.fields_for('comment', @comment, index: 1) { |r|
|
2294
|
+
concat r.text_field(:name)
|
2295
|
+
}
|
2296
|
+
end
|
2297
|
+
|
2298
|
+
expected = whole_form('/posts/123', 'edit_post_123', 'edit_post', method: 'patch') do
|
2299
|
+
"<input name='post[1][title]' type='text' id='post_1_title' value='Hello World' />" +
|
2300
|
+
"<input name='post[1][comment][1][name]' type='text' id='post_1_comment_1_name' value='new comment' />"
|
2301
|
+
end
|
2302
|
+
|
2303
|
+
assert_dom_equal expected, output_buffer
|
2304
|
+
end
|
2305
|
+
|
2306
|
+
def test_form_for_with_index_and_nested_fields_for
|
2307
|
+
output_buffer = form_for(@post, index: 1) do |f|
|
2308
|
+
concat f.fields_for(:comment, @post) { |c|
|
2309
|
+
concat c.text_field(:title)
|
2310
|
+
}
|
2311
|
+
end
|
2312
|
+
|
2313
|
+
expected = whole_form('/posts/123', 'edit_post_123', 'edit_post', method: 'patch') do
|
2314
|
+
"<input name='post[1][comment][title]' type='text' id='post_1_comment_title' value='Hello World' />"
|
2315
|
+
end
|
2316
|
+
|
2317
|
+
assert_dom_equal expected, output_buffer
|
2318
|
+
end
|
2319
|
+
|
2320
|
+
def test_nested_fields_for_with_index_on_both
|
2321
|
+
form_for(@post, index: 1) do |f|
|
2322
|
+
concat f.fields_for(:comment, @post, index: 5) { |c|
|
2323
|
+
concat c.text_field(:title)
|
2324
|
+
}
|
2325
|
+
end
|
2326
|
+
|
2327
|
+
expected = whole_form('/posts/123', 'edit_post_123', 'edit_post', method: 'patch') do
|
2328
|
+
"<input name='post[1][comment][5][title]' type='text' id='post_1_comment_5_title' value='Hello World' />"
|
2329
|
+
end
|
2330
|
+
|
2331
|
+
assert_dom_equal expected, output_buffer
|
2332
|
+
end
|
2333
|
+
|
2334
|
+
def test_nested_fields_for_with_auto_index
|
2335
|
+
form_for(@post, as: "post[]") do |f|
|
2336
|
+
concat f.fields_for(:comment, @post) { |c|
|
2337
|
+
concat c.text_field(:title)
|
2338
|
+
}
|
2339
|
+
end
|
2340
|
+
|
2341
|
+
expected = whole_form('/posts/123', 'edit_post[]', 'edit_post[]', method: 'patch') do
|
2342
|
+
"<input name='post[123][comment][title]' type='text' id='post_123_comment_title' value='Hello World' />"
|
2343
|
+
end
|
2344
|
+
|
2345
|
+
assert_dom_equal expected, output_buffer
|
2346
|
+
end
|
2347
|
+
|
2348
|
+
def test_nested_fields_for_with_index_radio_button
|
2349
|
+
form_for(@post) do |f|
|
2350
|
+
concat f.fields_for(:comment, @post, index: 5) { |c|
|
2351
|
+
concat c.radio_button(:title, "hello")
|
2352
|
+
}
|
2353
|
+
end
|
2354
|
+
|
2355
|
+
expected = whole_form('/posts/123', 'edit_post_123', 'edit_post', method: 'patch') do
|
2356
|
+
"<input name='post[comment][5][title]' type='radio' id='post_comment_5_title_hello' value='hello' />"
|
2357
|
+
end
|
2358
|
+
|
2359
|
+
assert_dom_equal expected, output_buffer
|
2360
|
+
end
|
2361
|
+
|
2362
|
+
def test_nested_fields_for_with_auto_index_on_both
|
2363
|
+
form_for(@post, as: "post[]") do |f|
|
2364
|
+
concat f.fields_for("comment[]", @post) { |c|
|
2365
|
+
concat c.text_field(:title)
|
2366
|
+
}
|
2367
|
+
end
|
2368
|
+
|
2369
|
+
expected = whole_form('/posts/123', 'edit_post[]', 'edit_post[]', method: 'patch') do
|
2370
|
+
"<input name='post[123][comment][123][title]' type='text' id='post_123_comment_123_title' value='Hello World' />"
|
2371
|
+
end
|
2372
|
+
|
2373
|
+
assert_dom_equal expected, output_buffer
|
2374
|
+
end
|
2375
|
+
|
2376
|
+
def test_nested_fields_for_with_index_and_auto_index
|
2377
|
+
output_buffer = form_for(@post, as: "post[]") do |f|
|
2378
|
+
concat f.fields_for(:comment, @post, index: 5) { |c|
|
2379
|
+
concat c.text_field(:title)
|
2380
|
+
}
|
2381
|
+
end
|
2382
|
+
|
2383
|
+
output_buffer << form_for(@post, as: :post, index: 1) do |f|
|
2384
|
+
concat f.fields_for("comment[]", @post) { |c|
|
2385
|
+
concat c.text_field(:title)
|
2386
|
+
}
|
2387
|
+
end
|
2388
|
+
|
2389
|
+
expected = whole_form('/posts/123', 'edit_post[]', 'edit_post[]', method: 'patch') do
|
2390
|
+
"<input name='post[123][comment][5][title]' type='text' id='post_123_comment_5_title' value='Hello World' />"
|
2391
|
+
end + whole_form('/posts/123', 'edit_post', 'edit_post', method: 'patch') do
|
2392
|
+
"<input name='post[1][comment][123][title]' type='text' id='post_1_comment_123_title' value='Hello World' />"
|
2393
|
+
end
|
2394
|
+
|
2395
|
+
assert_dom_equal expected, output_buffer
|
2396
|
+
end
|
2397
|
+
|
2398
|
+
def test_nested_fields_for_with_a_new_record_on_a_nested_attributes_one_to_one_association
|
2399
|
+
@post.author = Author.new
|
2400
|
+
|
2401
|
+
form_for(@post) do |f|
|
2402
|
+
concat f.text_field(:title)
|
2403
|
+
concat f.fields_for(:author) { |af|
|
2404
|
+
concat af.text_field(:name)
|
2405
|
+
}
|
2406
|
+
end
|
2407
|
+
|
2408
|
+
expected = whole_form('/posts/123', 'edit_post_123', 'edit_post', method: 'patch') do
|
2409
|
+
'<input name="post[title]" type="text" id="post_title" value="Hello World" />' +
|
2410
|
+
'<input id="post_author_attributes_name" name="post[author_attributes][name]" type="text" value="new author" />'
|
2411
|
+
end
|
2412
|
+
|
2413
|
+
assert_dom_equal expected, output_buffer
|
2414
|
+
end
|
2415
|
+
|
2416
|
+
def test_nested_fields_for_with_explicitly_passed_object_on_a_nested_attributes_one_to_one_association
|
2417
|
+
form_for(@post) do |f|
|
2418
|
+
f.fields_for(:author, Author.new(123)) do |af|
|
2419
|
+
assert_not_nil af.object
|
2420
|
+
assert_equal 123, af.object.id
|
2421
|
+
end
|
2422
|
+
end
|
2423
|
+
end
|
2424
|
+
|
2425
|
+
def test_nested_fields_for_with_an_existing_record_on_a_nested_attributes_one_to_one_association
|
2426
|
+
@post.author = Author.new(321)
|
2427
|
+
|
2428
|
+
form_for(@post) do |f|
|
2429
|
+
concat f.text_field(:title)
|
2430
|
+
concat f.fields_for(:author) { |af|
|
2431
|
+
concat af.text_field(:name)
|
2432
|
+
}
|
2433
|
+
end
|
2434
|
+
|
2435
|
+
expected = whole_form('/posts/123', 'edit_post_123', 'edit_post', method: 'patch') do
|
2436
|
+
'<input name="post[title]" type="text" id="post_title" value="Hello World" />' +
|
2437
|
+
'<input id="post_author_attributes_name" name="post[author_attributes][name]" type="text" value="author #321" />' +
|
2438
|
+
'<input id="post_author_attributes_id" name="post[author_attributes][id]" type="hidden" value="321" />'
|
2439
|
+
end
|
2440
|
+
|
2441
|
+
assert_dom_equal expected, output_buffer
|
2442
|
+
end
|
2443
|
+
|
2444
|
+
def test_nested_fields_for_with_an_existing_record_on_a_nested_attributes_one_to_one_association_using_erb_and_inline_block
|
2445
|
+
@post.author = Author.new(321)
|
2446
|
+
|
2447
|
+
form_for(@post) do |f|
|
2448
|
+
concat f.text_field(:title)
|
2449
|
+
concat f.fields_for(:author) { |af|
|
2450
|
+
af.text_field(:name)
|
2451
|
+
}
|
2452
|
+
end
|
2453
|
+
|
2454
|
+
expected = whole_form('/posts/123', 'edit_post_123', 'edit_post', method: 'patch') do
|
2455
|
+
'<input name="post[title]" type="text" id="post_title" value="Hello World" />' +
|
2456
|
+
'<input id="post_author_attributes_name" name="post[author_attributes][name]" type="text" value="author #321" />' +
|
2457
|
+
'<input id="post_author_attributes_id" name="post[author_attributes][id]" type="hidden" value="321" />'
|
2458
|
+
end
|
2459
|
+
|
2460
|
+
assert_dom_equal expected, output_buffer
|
2461
|
+
end
|
2462
|
+
|
2463
|
+
def test_nested_fields_for_with_an_existing_record_on_a_nested_attributes_one_to_one_association_with_disabled_hidden_id
|
2464
|
+
@post.author = Author.new(321)
|
2465
|
+
|
2466
|
+
form_for(@post) do |f|
|
2467
|
+
concat f.text_field(:title)
|
2468
|
+
concat f.fields_for(:author, include_id: false) { |af|
|
2469
|
+
af.text_field(:name)
|
2470
|
+
}
|
2471
|
+
end
|
2472
|
+
|
2473
|
+
expected = whole_form('/posts/123', 'edit_post_123', 'edit_post', method: 'patch') do
|
2474
|
+
'<input name="post[title]" type="text" id="post_title" value="Hello World" />' +
|
2475
|
+
'<input id="post_author_attributes_name" name="post[author_attributes][name]" type="text" value="author #321" />'
|
2476
|
+
end
|
2477
|
+
|
2478
|
+
assert_dom_equal expected, output_buffer
|
2479
|
+
end
|
2480
|
+
|
2481
|
+
def test_nested_fields_for_with_an_existing_record_on_a_nested_attributes_one_to_one_association_with_disabled_hidden_id_inherited
|
2482
|
+
@post.author = Author.new(321)
|
2483
|
+
|
2484
|
+
form_for(@post, include_id: false) do |f|
|
2485
|
+
concat f.text_field(:title)
|
2486
|
+
concat f.fields_for(:author) { |af|
|
2487
|
+
af.text_field(:name)
|
2488
|
+
}
|
2489
|
+
end
|
2490
|
+
|
2491
|
+
expected = whole_form('/posts/123', 'edit_post_123', 'edit_post', method: 'patch') do
|
2492
|
+
'<input name="post[title]" type="text" id="post_title" value="Hello World" />' +
|
2493
|
+
'<input id="post_author_attributes_name" name="post[author_attributes][name]" type="text" value="author #321" />'
|
2494
|
+
end
|
2495
|
+
|
2496
|
+
assert_dom_equal expected, output_buffer
|
2497
|
+
end
|
2498
|
+
|
2499
|
+
def test_nested_fields_for_with_an_existing_record_on_a_nested_attributes_one_to_one_association_with_disabled_hidden_id_override
|
2500
|
+
@post.author = Author.new(321)
|
2501
|
+
|
2502
|
+
form_for(@post, include_id: false) do |f|
|
2503
|
+
concat f.text_field(:title)
|
2504
|
+
concat f.fields_for(:author, include_id: true) { |af|
|
2505
|
+
af.text_field(:name)
|
2506
|
+
}
|
2507
|
+
end
|
2508
|
+
|
2509
|
+
expected = whole_form('/posts/123', 'edit_post_123', 'edit_post', method: 'patch') do
|
2510
|
+
'<input name="post[title]" type="text" id="post_title" value="Hello World" />' +
|
2511
|
+
'<input id="post_author_attributes_name" name="post[author_attributes][name]" type="text" value="author #321" />' +
|
2512
|
+
'<input id="post_author_attributes_id" name="post[author_attributes][id]" type="hidden" value="321" />'
|
2513
|
+
end
|
2514
|
+
|
2515
|
+
assert_dom_equal expected, output_buffer
|
2516
|
+
end
|
2517
|
+
|
2518
|
+
def test_nested_fields_for_with_existing_records_on_a_nested_attributes_one_to_one_association_with_explicit_hidden_field_placement
|
2519
|
+
@post.author = Author.new(321)
|
2520
|
+
|
2521
|
+
form_for(@post) do |f|
|
2522
|
+
concat f.text_field(:title)
|
2523
|
+
concat f.fields_for(:author) { |af|
|
2524
|
+
concat af.hidden_field(:id)
|
2525
|
+
concat af.text_field(:name)
|
2526
|
+
}
|
2527
|
+
end
|
2528
|
+
|
2529
|
+
expected = whole_form('/posts/123', 'edit_post_123', 'edit_post', method: 'patch') do
|
2530
|
+
'<input name="post[title]" type="text" id="post_title" value="Hello World" />' +
|
2531
|
+
'<input id="post_author_attributes_id" name="post[author_attributes][id]" type="hidden" value="321" />' +
|
2532
|
+
'<input id="post_author_attributes_name" name="post[author_attributes][name]" type="text" value="author #321" />'
|
2533
|
+
end
|
2534
|
+
|
2535
|
+
assert_dom_equal expected, output_buffer
|
2536
|
+
end
|
2537
|
+
|
2538
|
+
def test_nested_fields_for_with_existing_records_on_a_nested_attributes_collection_association
|
2539
|
+
@post.comments = Array.new(2) { |id| Comment.new(id + 1) }
|
2540
|
+
|
2541
|
+
form_for(@post) do |f|
|
2542
|
+
concat f.text_field(:title)
|
2543
|
+
@post.comments.each do |comment|
|
2544
|
+
concat f.fields_for(:comments, comment) { |cf|
|
2545
|
+
concat cf.text_field(:name)
|
2546
|
+
}
|
2547
|
+
end
|
2548
|
+
end
|
2549
|
+
|
2550
|
+
expected = whole_form('/posts/123', 'edit_post_123', 'edit_post', method: 'patch') do
|
2551
|
+
'<input name="post[title]" type="text" id="post_title" value="Hello World" />' +
|
2552
|
+
'<input id="post_comments_attributes_0_name" name="post[comments_attributes][0][name]" type="text" value="comment #1" />' +
|
2553
|
+
'<input id="post_comments_attributes_0_id" name="post[comments_attributes][0][id]" type="hidden" value="1" />' +
|
2554
|
+
'<input id="post_comments_attributes_1_name" name="post[comments_attributes][1][name]" type="text" value="comment #2" />' +
|
2555
|
+
'<input id="post_comments_attributes_1_id" name="post[comments_attributes][1][id]" type="hidden" value="2" />'
|
2556
|
+
end
|
2557
|
+
|
2558
|
+
assert_dom_equal expected, output_buffer
|
2559
|
+
end
|
2560
|
+
|
2561
|
+
def test_nested_fields_for_with_existing_records_on_a_nested_attributes_collection_association_with_disabled_hidden_id
|
2562
|
+
@post.comments = Array.new(2) { |id| Comment.new(id + 1) }
|
2563
|
+
@post.author = Author.new(321)
|
2564
|
+
|
2565
|
+
form_for(@post) do |f|
|
2566
|
+
concat f.text_field(:title)
|
2567
|
+
concat f.fields_for(:author) { |af|
|
2568
|
+
concat af.text_field(:name)
|
2569
|
+
}
|
2570
|
+
@post.comments.each do |comment|
|
2571
|
+
concat f.fields_for(:comments, comment, include_id: false) { |cf|
|
2572
|
+
concat cf.text_field(:name)
|
2573
|
+
}
|
2574
|
+
end
|
2575
|
+
end
|
2576
|
+
|
2577
|
+
expected = whole_form('/posts/123', 'edit_post_123', 'edit_post', method: 'patch') do
|
2578
|
+
'<input name="post[title]" type="text" id="post_title" value="Hello World" />' +
|
2579
|
+
'<input id="post_author_attributes_name" name="post[author_attributes][name]" type="text" value="author #321" />' +
|
2580
|
+
'<input id="post_author_attributes_id" name="post[author_attributes][id]" type="hidden" value="321" />' +
|
2581
|
+
'<input id="post_comments_attributes_0_name" name="post[comments_attributes][0][name]" type="text" value="comment #1" />' +
|
2582
|
+
'<input id="post_comments_attributes_1_name" name="post[comments_attributes][1][name]" type="text" value="comment #2" />'
|
2583
|
+
end
|
2584
|
+
|
2585
|
+
assert_dom_equal expected, output_buffer
|
2586
|
+
end
|
2587
|
+
|
2588
|
+
def test_nested_fields_for_with_existing_records_on_a_nested_attributes_collection_association_with_disabled_hidden_id_inherited
|
2589
|
+
@post.comments = Array.new(2) { |id| Comment.new(id + 1) }
|
2590
|
+
@post.author = Author.new(321)
|
2591
|
+
|
2592
|
+
form_for(@post, include_id: false) do |f|
|
2593
|
+
concat f.text_field(:title)
|
2594
|
+
concat f.fields_for(:author) { |af|
|
2595
|
+
concat af.text_field(:name)
|
2596
|
+
}
|
2597
|
+
@post.comments.each do |comment|
|
2598
|
+
concat f.fields_for(:comments, comment) { |cf|
|
2599
|
+
concat cf.text_field(:name)
|
2600
|
+
}
|
2601
|
+
end
|
2602
|
+
end
|
2603
|
+
|
2604
|
+
expected = whole_form('/posts/123', 'edit_post_123', 'edit_post', method: 'patch') do
|
2605
|
+
'<input name="post[title]" type="text" id="post_title" value="Hello World" />' +
|
2606
|
+
'<input id="post_author_attributes_name" name="post[author_attributes][name]" type="text" value="author #321" />' +
|
2607
|
+
'<input id="post_comments_attributes_0_name" name="post[comments_attributes][0][name]" type="text" value="comment #1" />' +
|
2608
|
+
'<input id="post_comments_attributes_1_name" name="post[comments_attributes][1][name]" type="text" value="comment #2" />'
|
2609
|
+
end
|
2610
|
+
|
2611
|
+
assert_dom_equal expected, output_buffer
|
2612
|
+
end
|
2613
|
+
|
2614
|
+
def test_nested_fields_for_with_existing_records_on_a_nested_attributes_collection_association_with_disabled_hidden_id_override
|
2615
|
+
@post.comments = Array.new(2) { |id| Comment.new(id + 1) }
|
2616
|
+
@post.author = Author.new(321)
|
2617
|
+
|
2618
|
+
form_for(@post, include_id: false) do |f|
|
2619
|
+
concat f.text_field(:title)
|
2620
|
+
concat f.fields_for(:author, include_id: true) { |af|
|
2621
|
+
concat af.text_field(:name)
|
2622
|
+
}
|
2623
|
+
@post.comments.each do |comment|
|
2624
|
+
concat f.fields_for(:comments, comment) { |cf|
|
2625
|
+
concat cf.text_field(:name)
|
2626
|
+
}
|
2627
|
+
end
|
2628
|
+
end
|
2629
|
+
|
2630
|
+
expected = whole_form('/posts/123', 'edit_post_123', 'edit_post', method: 'patch') do
|
2631
|
+
'<input name="post[title]" type="text" id="post_title" value="Hello World" />' +
|
2632
|
+
'<input id="post_author_attributes_name" name="post[author_attributes][name]" type="text" value="author #321" />' +
|
2633
|
+
'<input id="post_author_attributes_id" name="post[author_attributes][id]" type="hidden" value="321" />' +
|
2634
|
+
'<input id="post_comments_attributes_0_name" name="post[comments_attributes][0][name]" type="text" value="comment #1" />' +
|
2635
|
+
'<input id="post_comments_attributes_1_name" name="post[comments_attributes][1][name]" type="text" value="comment #2" />'
|
2636
|
+
end
|
2637
|
+
|
2638
|
+
assert_dom_equal expected, output_buffer
|
2639
|
+
end
|
2640
|
+
|
2641
|
+
def test_nested_fields_for_with_existing_records_on_a_nested_attributes_collection_association_using_erb_and_inline_block
|
2642
|
+
@post.comments = Array.new(2) { |id| Comment.new(id + 1) }
|
2643
|
+
|
2644
|
+
form_for(@post) do |f|
|
2645
|
+
concat f.text_field(:title)
|
2646
|
+
@post.comments.each do |comment|
|
2647
|
+
concat f.fields_for(:comments, comment) { |cf|
|
2648
|
+
cf.text_field(:name)
|
2649
|
+
}
|
2650
|
+
end
|
2651
|
+
end
|
2652
|
+
|
2653
|
+
expected = whole_form('/posts/123', 'edit_post_123', 'edit_post', method: 'patch') do
|
2654
|
+
'<input name="post[title]" type="text" id="post_title" value="Hello World" />' +
|
2655
|
+
'<input id="post_comments_attributes_0_name" name="post[comments_attributes][0][name]" type="text" value="comment #1" />' +
|
2656
|
+
'<input id="post_comments_attributes_0_id" name="post[comments_attributes][0][id]" type="hidden" value="1" />' +
|
2657
|
+
'<input id="post_comments_attributes_1_name" name="post[comments_attributes][1][name]" type="text" value="comment #2" />' +
|
2658
|
+
'<input id="post_comments_attributes_1_id" name="post[comments_attributes][1][id]" type="hidden" value="2" />'
|
2659
|
+
end
|
2660
|
+
|
2661
|
+
assert_dom_equal expected, output_buffer
|
2662
|
+
end
|
2663
|
+
|
2664
|
+
def test_nested_fields_for_with_existing_records_on_a_nested_attributes_collection_association_with_explicit_hidden_field_placement
|
2665
|
+
@post.comments = Array.new(2) { |id| Comment.new(id + 1) }
|
2666
|
+
|
2667
|
+
form_for(@post) do |f|
|
2668
|
+
concat f.text_field(:title)
|
2669
|
+
@post.comments.each do |comment|
|
2670
|
+
concat f.fields_for(:comments, comment) { |cf|
|
2671
|
+
concat cf.hidden_field(:id)
|
2672
|
+
concat cf.text_field(:name)
|
2673
|
+
}
|
2674
|
+
end
|
2675
|
+
end
|
2676
|
+
|
2677
|
+
expected = whole_form('/posts/123', 'edit_post_123', 'edit_post', method: 'patch') do
|
2678
|
+
'<input name="post[title]" type="text" id="post_title" value="Hello World" />' +
|
2679
|
+
'<input id="post_comments_attributes_0_id" name="post[comments_attributes][0][id]" type="hidden" value="1" />' +
|
2680
|
+
'<input id="post_comments_attributes_0_name" name="post[comments_attributes][0][name]" type="text" value="comment #1" />' +
|
2681
|
+
'<input id="post_comments_attributes_1_id" name="post[comments_attributes][1][id]" type="hidden" value="2" />' +
|
2682
|
+
'<input id="post_comments_attributes_1_name" name="post[comments_attributes][1][name]" type="text" value="comment #2" />'
|
2683
|
+
end
|
2684
|
+
|
2685
|
+
assert_dom_equal expected, output_buffer
|
2686
|
+
end
|
2687
|
+
|
2688
|
+
def test_nested_fields_for_with_new_records_on_a_nested_attributes_collection_association
|
2689
|
+
@post.comments = [Comment.new, Comment.new]
|
2690
|
+
|
2691
|
+
form_for(@post) do |f|
|
2692
|
+
concat f.text_field(:title)
|
2693
|
+
@post.comments.each do |comment|
|
2694
|
+
concat f.fields_for(:comments, comment) { |cf|
|
2695
|
+
concat cf.text_field(:name)
|
2696
|
+
}
|
2697
|
+
end
|
2698
|
+
end
|
2699
|
+
|
2700
|
+
expected = whole_form('/posts/123', 'edit_post_123', 'edit_post', method: 'patch') do
|
2701
|
+
'<input name="post[title]" type="text" id="post_title" value="Hello World" />' +
|
2702
|
+
'<input id="post_comments_attributes_0_name" name="post[comments_attributes][0][name]" type="text" value="new comment" />' +
|
2703
|
+
'<input id="post_comments_attributes_1_name" name="post[comments_attributes][1][name]" type="text" value="new comment" />'
|
2704
|
+
end
|
2705
|
+
|
2706
|
+
assert_dom_equal expected, output_buffer
|
2707
|
+
end
|
2708
|
+
|
2709
|
+
def test_nested_fields_for_with_existing_and_new_records_on_a_nested_attributes_collection_association
|
2710
|
+
@post.comments = [Comment.new(321), Comment.new]
|
2711
|
+
|
2712
|
+
form_for(@post) do |f|
|
2713
|
+
concat f.text_field(:title)
|
2714
|
+
@post.comments.each do |comment|
|
2715
|
+
concat f.fields_for(:comments, comment) { |cf|
|
2716
|
+
concat cf.text_field(:name)
|
2717
|
+
}
|
2718
|
+
end
|
2719
|
+
end
|
2720
|
+
|
2721
|
+
expected = whole_form('/posts/123', 'edit_post_123', 'edit_post', method: 'patch') do
|
2722
|
+
'<input name="post[title]" type="text" id="post_title" value="Hello World" />' +
|
2723
|
+
'<input id="post_comments_attributes_0_name" name="post[comments_attributes][0][name]" type="text" value="comment #321" />' +
|
2724
|
+
'<input id="post_comments_attributes_0_id" name="post[comments_attributes][0][id]" type="hidden" value="321" />' +
|
2725
|
+
'<input id="post_comments_attributes_1_name" name="post[comments_attributes][1][name]" type="text" value="new comment" />'
|
2726
|
+
end
|
2727
|
+
|
2728
|
+
assert_dom_equal expected, output_buffer
|
2729
|
+
end
|
2730
|
+
|
2731
|
+
def test_nested_fields_for_with_an_empty_supplied_attributes_collection
|
2732
|
+
form_for(@post) do |f|
|
2733
|
+
concat f.text_field(:title)
|
2734
|
+
f.fields_for(:comments, []) do |cf|
|
2735
|
+
concat cf.text_field(:name)
|
2736
|
+
end
|
2737
|
+
end
|
2738
|
+
|
2739
|
+
expected = whole_form('/posts/123', 'edit_post_123', 'edit_post', method: 'patch') do
|
2740
|
+
'<input name="post[title]" type="text" id="post_title" value="Hello World" />'
|
2741
|
+
end
|
2742
|
+
|
2743
|
+
assert_dom_equal expected, output_buffer
|
2744
|
+
end
|
2745
|
+
|
2746
|
+
def test_nested_fields_for_with_existing_records_on_a_supplied_nested_attributes_collection
|
2747
|
+
@post.comments = Array.new(2) { |id| Comment.new(id + 1) }
|
2748
|
+
|
2749
|
+
form_for(@post) do |f|
|
2750
|
+
concat f.text_field(:title)
|
2751
|
+
concat f.fields_for(:comments, @post.comments) { |cf|
|
2752
|
+
concat cf.text_field(:name)
|
2753
|
+
}
|
2754
|
+
end
|
2755
|
+
|
2756
|
+
expected = whole_form('/posts/123', 'edit_post_123', 'edit_post', method: 'patch') do
|
2757
|
+
'<input name="post[title]" type="text" id="post_title" value="Hello World" />' +
|
2758
|
+
'<input id="post_comments_attributes_0_name" name="post[comments_attributes][0][name]" type="text" value="comment #1" />' +
|
2759
|
+
'<input id="post_comments_attributes_0_id" name="post[comments_attributes][0][id]" type="hidden" value="1" />' +
|
2760
|
+
'<input id="post_comments_attributes_1_name" name="post[comments_attributes][1][name]" type="text" value="comment #2" />' +
|
2761
|
+
'<input id="post_comments_attributes_1_id" name="post[comments_attributes][1][id]" type="hidden" value="2" />'
|
2762
|
+
end
|
2763
|
+
|
2764
|
+
assert_dom_equal expected, output_buffer
|
2765
|
+
end
|
2766
|
+
|
2767
|
+
def test_nested_fields_for_arel_like
|
2768
|
+
@post.comments = ArelLike.new
|
2769
|
+
|
2770
|
+
form_for(@post) do |f|
|
2771
|
+
concat f.text_field(:title)
|
2772
|
+
concat f.fields_for(:comments, @post.comments) { |cf|
|
2773
|
+
concat cf.text_field(:name)
|
2774
|
+
}
|
2775
|
+
end
|
2776
|
+
|
2777
|
+
expected = whole_form('/posts/123', 'edit_post_123', 'edit_post', method: 'patch') do
|
2778
|
+
'<input name="post[title]" type="text" id="post_title" value="Hello World" />' +
|
2779
|
+
'<input id="post_comments_attributes_0_name" name="post[comments_attributes][0][name]" type="text" value="comment #1" />' +
|
2780
|
+
'<input id="post_comments_attributes_0_id" name="post[comments_attributes][0][id]" type="hidden" value="1" />' +
|
2781
|
+
'<input id="post_comments_attributes_1_name" name="post[comments_attributes][1][name]" type="text" value="comment #2" />' +
|
2782
|
+
'<input id="post_comments_attributes_1_id" name="post[comments_attributes][1][id]" type="hidden" value="2" />'
|
2783
|
+
end
|
2784
|
+
|
2785
|
+
assert_dom_equal expected, output_buffer
|
2786
|
+
end
|
2787
|
+
|
2788
|
+
def test_nested_fields_label_translation_with_more_than_10_records
|
2789
|
+
@post.comments = Array.new(11) { |id| Comment.new(id + 1) }
|
2790
|
+
|
2791
|
+
I18n.expects(:t).with('post.comments.body', default: [:"comment.body", ''], scope: "helpers.label").times(11).returns "Write body here"
|
2792
|
+
|
2793
|
+
form_for(@post) do |f|
|
2794
|
+
f.fields_for(:comments) do |cf|
|
2795
|
+
concat cf.label(:body)
|
2796
|
+
end
|
2797
|
+
end
|
2798
|
+
end
|
2799
|
+
|
2800
|
+
def test_nested_fields_for_with_existing_records_on_a_supplied_nested_attributes_collection_different_from_record_one
|
2801
|
+
comments = Array.new(2) { |id| Comment.new(id + 1) }
|
2802
|
+
@post.comments = []
|
2803
|
+
|
2804
|
+
form_for(@post) do |f|
|
2805
|
+
concat f.text_field(:title)
|
2806
|
+
concat f.fields_for(:comments, comments) { |cf|
|
2807
|
+
concat cf.text_field(:name)
|
2808
|
+
}
|
2809
|
+
end
|
2810
|
+
|
2811
|
+
expected = whole_form('/posts/123', 'edit_post_123', 'edit_post', method: 'patch') do
|
2812
|
+
'<input name="post[title]" type="text" id="post_title" value="Hello World" />' +
|
2813
|
+
'<input id="post_comments_attributes_0_name" name="post[comments_attributes][0][name]" type="text" value="comment #1" />' +
|
2814
|
+
'<input id="post_comments_attributes_0_id" name="post[comments_attributes][0][id]" type="hidden" value="1" />' +
|
2815
|
+
'<input id="post_comments_attributes_1_name" name="post[comments_attributes][1][name]" type="text" value="comment #2" />' +
|
2816
|
+
'<input id="post_comments_attributes_1_id" name="post[comments_attributes][1][id]" type="hidden" value="2" />'
|
2817
|
+
end
|
2818
|
+
|
2819
|
+
assert_dom_equal expected, output_buffer
|
2820
|
+
end
|
2821
|
+
|
2822
|
+
def test_nested_fields_for_on_a_nested_attributes_collection_association_yields_only_builder
|
2823
|
+
@post.comments = [Comment.new(321), Comment.new]
|
2824
|
+
yielded_comments = []
|
2825
|
+
|
2826
|
+
form_for(@post) do |f|
|
2827
|
+
concat f.text_field(:title)
|
2828
|
+
concat f.fields_for(:comments) { |cf|
|
2829
|
+
concat cf.text_field(:name)
|
2830
|
+
yielded_comments << cf.object
|
2831
|
+
}
|
2832
|
+
end
|
2833
|
+
|
2834
|
+
expected = whole_form('/posts/123', 'edit_post_123', 'edit_post', method: 'patch') do
|
2835
|
+
'<input name="post[title]" type="text" id="post_title" value="Hello World" />' +
|
2836
|
+
'<input id="post_comments_attributes_0_name" name="post[comments_attributes][0][name]" type="text" value="comment #321" />' +
|
2837
|
+
'<input id="post_comments_attributes_0_id" name="post[comments_attributes][0][id]" type="hidden" value="321" />' +
|
2838
|
+
'<input id="post_comments_attributes_1_name" name="post[comments_attributes][1][name]" type="text" value="new comment" />'
|
2839
|
+
end
|
2840
|
+
|
2841
|
+
assert_dom_equal expected, output_buffer
|
2842
|
+
assert_equal yielded_comments, @post.comments
|
2843
|
+
end
|
2844
|
+
|
2845
|
+
def test_nested_fields_for_with_child_index_option_override_on_a_nested_attributes_collection_association
|
2846
|
+
@post.comments = []
|
2847
|
+
|
2848
|
+
form_for(@post) do |f|
|
2849
|
+
concat f.fields_for(:comments, Comment.new(321), child_index: 'abc') { |cf|
|
2850
|
+
concat cf.text_field(:name)
|
2851
|
+
}
|
2852
|
+
end
|
2853
|
+
|
2854
|
+
expected = whole_form('/posts/123', 'edit_post_123', 'edit_post', method: 'patch') do
|
2855
|
+
'<input id="post_comments_attributes_abc_name" name="post[comments_attributes][abc][name]" type="text" value="comment #321" />' +
|
2856
|
+
'<input id="post_comments_attributes_abc_id" name="post[comments_attributes][abc][id]" type="hidden" value="321" />'
|
2857
|
+
end
|
2858
|
+
|
2859
|
+
assert_dom_equal expected, output_buffer
|
2860
|
+
end
|
2861
|
+
|
2862
|
+
class FakeAssociationProxy
|
2863
|
+
def to_ary
|
2864
|
+
[1, 2, 3]
|
2865
|
+
end
|
2866
|
+
end
|
2867
|
+
|
2868
|
+
def test_nested_fields_for_with_child_index_option_override_on_a_nested_attributes_collection_association_with_proxy
|
2869
|
+
@post.comments = FakeAssociationProxy.new
|
2870
|
+
|
2871
|
+
form_for(@post) do |f|
|
2872
|
+
concat f.fields_for(:comments, Comment.new(321), child_index: 'abc') { |cf|
|
2873
|
+
concat cf.text_field(:name)
|
2874
|
+
}
|
2875
|
+
end
|
2876
|
+
|
2877
|
+
expected = whole_form('/posts/123', 'edit_post_123', 'edit_post', method: 'patch') do
|
2878
|
+
'<input id="post_comments_attributes_abc_name" name="post[comments_attributes][abc][name]" type="text" value="comment #321" />' +
|
2879
|
+
'<input id="post_comments_attributes_abc_id" name="post[comments_attributes][abc][id]" type="hidden" value="321" />'
|
2880
|
+
end
|
2881
|
+
|
2882
|
+
assert_dom_equal expected, output_buffer
|
2883
|
+
end
|
2884
|
+
|
2885
|
+
def test_nested_fields_for_index_method_with_existing_records_on_a_nested_attributes_collection_association
|
2886
|
+
@post.comments = Array.new(2) { |id| Comment.new(id + 1) }
|
2887
|
+
|
2888
|
+
form_for(@post) do |f|
|
2889
|
+
expected = 0
|
2890
|
+
@post.comments.each do |comment|
|
2891
|
+
f.fields_for(:comments, comment) { |cf|
|
2892
|
+
assert_equal cf.index, expected
|
2893
|
+
expected += 1
|
2894
|
+
}
|
2895
|
+
end
|
2896
|
+
end
|
2897
|
+
end
|
2898
|
+
|
2899
|
+
def test_nested_fields_for_index_method_with_existing_and_new_records_on_a_nested_attributes_collection_association
|
2900
|
+
@post.comments = [Comment.new(321), Comment.new]
|
2901
|
+
|
2902
|
+
form_for(@post) do |f|
|
2903
|
+
expected = 0
|
2904
|
+
@post.comments.each do |comment|
|
2905
|
+
f.fields_for(:comments, comment) { |cf|
|
2906
|
+
assert_equal cf.index, expected
|
2907
|
+
expected += 1
|
2908
|
+
}
|
2909
|
+
end
|
2910
|
+
end
|
2911
|
+
end
|
2912
|
+
|
2913
|
+
def test_nested_fields_for_index_method_with_existing_records_on_a_supplied_nested_attributes_collection
|
2914
|
+
@post.comments = Array.new(2) { |id| Comment.new(id + 1) }
|
2915
|
+
|
2916
|
+
form_for(@post) do |f|
|
2917
|
+
expected = 0
|
2918
|
+
f.fields_for(:comments, @post.comments) { |cf|
|
2919
|
+
assert_equal cf.index, expected
|
2920
|
+
expected += 1
|
2921
|
+
}
|
2922
|
+
end
|
2923
|
+
end
|
2924
|
+
|
2925
|
+
def test_nested_fields_for_index_method_with_child_index_option_override_on_a_nested_attributes_collection_association
|
2926
|
+
@post.comments = []
|
2927
|
+
|
2928
|
+
form_for(@post) do |f|
|
2929
|
+
f.fields_for(:comments, Comment.new(321), child_index: 'abc') { |cf|
|
2930
|
+
assert_equal cf.index, 'abc'
|
2931
|
+
}
|
2932
|
+
end
|
2933
|
+
end
|
2934
|
+
|
2935
|
+
def test_nested_fields_uses_unique_indices_for_different_collection_associations
|
2936
|
+
@post.comments = [Comment.new(321)]
|
2937
|
+
@post.tags = [Tag.new(123), Tag.new(456)]
|
2938
|
+
@post.comments[0].relevances = []
|
2939
|
+
@post.tags[0].relevances = []
|
2940
|
+
@post.tags[1].relevances = []
|
2941
|
+
|
2942
|
+
form_for(@post) do |f|
|
2943
|
+
concat f.fields_for(:comments, @post.comments[0]) { |cf|
|
2944
|
+
concat cf.text_field(:name)
|
2945
|
+
concat cf.fields_for(:relevances, CommentRelevance.new(314)) { |crf|
|
2946
|
+
concat crf.text_field(:value)
|
2947
|
+
}
|
2948
|
+
}
|
2949
|
+
concat f.fields_for(:tags, @post.tags[0]) { |tf|
|
2950
|
+
concat tf.text_field(:value)
|
2951
|
+
concat tf.fields_for(:relevances, TagRelevance.new(3141)) { |trf|
|
2952
|
+
concat trf.text_field(:value)
|
2953
|
+
}
|
2954
|
+
}
|
2955
|
+
concat f.fields_for('tags', @post.tags[1]) { |tf|
|
2956
|
+
concat tf.text_field(:value)
|
2957
|
+
concat tf.fields_for(:relevances, TagRelevance.new(31415)) { |trf|
|
2958
|
+
concat trf.text_field(:value)
|
2959
|
+
}
|
2960
|
+
}
|
2961
|
+
end
|
2962
|
+
|
2963
|
+
expected = whole_form('/posts/123', 'edit_post_123', 'edit_post', method: 'patch') do
|
2964
|
+
'<input id="post_comments_attributes_0_name" name="post[comments_attributes][0][name]" type="text" value="comment #321" />' +
|
2965
|
+
'<input id="post_comments_attributes_0_relevances_attributes_0_value" name="post[comments_attributes][0][relevances_attributes][0][value]" type="text" value="commentrelevance #314" />' +
|
2966
|
+
'<input id="post_comments_attributes_0_relevances_attributes_0_id" name="post[comments_attributes][0][relevances_attributes][0][id]" type="hidden" value="314" />' +
|
2967
|
+
'<input id="post_comments_attributes_0_id" name="post[comments_attributes][0][id]" type="hidden" value="321" />' +
|
2968
|
+
'<input id="post_tags_attributes_0_value" name="post[tags_attributes][0][value]" type="text" value="tag #123" />' +
|
2969
|
+
'<input id="post_tags_attributes_0_relevances_attributes_0_value" name="post[tags_attributes][0][relevances_attributes][0][value]" type="text" value="tagrelevance #3141" />' +
|
2970
|
+
'<input id="post_tags_attributes_0_relevances_attributes_0_id" name="post[tags_attributes][0][relevances_attributes][0][id]" type="hidden" value="3141" />' +
|
2971
|
+
'<input id="post_tags_attributes_0_id" name="post[tags_attributes][0][id]" type="hidden" value="123" />' +
|
2972
|
+
'<input id="post_tags_attributes_1_value" name="post[tags_attributes][1][value]" type="text" value="tag #456" />' +
|
2973
|
+
'<input id="post_tags_attributes_1_relevances_attributes_0_value" name="post[tags_attributes][1][relevances_attributes][0][value]" type="text" value="tagrelevance #31415" />' +
|
2974
|
+
'<input id="post_tags_attributes_1_relevances_attributes_0_id" name="post[tags_attributes][1][relevances_attributes][0][id]" type="hidden" value="31415" />' +
|
2975
|
+
'<input id="post_tags_attributes_1_id" name="post[tags_attributes][1][id]" type="hidden" value="456" />'
|
2976
|
+
end
|
2977
|
+
|
2978
|
+
assert_dom_equal expected, output_buffer
|
2979
|
+
end
|
2980
|
+
|
2981
|
+
def test_nested_fields_for_with_hash_like_model
|
2982
|
+
@author = HashBackedAuthor.new
|
2983
|
+
|
2984
|
+
form_for(@post) do |f|
|
2985
|
+
concat f.fields_for(:author, @author) { |af|
|
2986
|
+
concat af.text_field(:name)
|
2987
|
+
}
|
2988
|
+
end
|
2989
|
+
|
2990
|
+
expected = whole_form('/posts/123', 'edit_post_123', 'edit_post', method: 'patch') do
|
2991
|
+
'<input id="post_author_attributes_name" name="post[author_attributes][name]" type="text" value="hash backed author" />'
|
2992
|
+
end
|
2993
|
+
|
2994
|
+
assert_dom_equal expected, output_buffer
|
2995
|
+
end
|
2996
|
+
|
2997
|
+
def test_fields_for
|
2998
|
+
output_buffer = fields_for(:post, @post) do |f|
|
2999
|
+
concat f.text_field(:title)
|
3000
|
+
concat f.text_area(:body)
|
3001
|
+
concat f.check_box(:secret)
|
3002
|
+
end
|
3003
|
+
|
3004
|
+
expected =
|
3005
|
+
"<input name='post[title]' type='text' id='post_title' value='Hello World' />" +
|
3006
|
+
"<textarea name='post[body]' id='post_body'>\nBack to the hill and over it again!</textarea>" +
|
3007
|
+
"<input name='post[secret]' type='hidden' value='0' />" +
|
3008
|
+
"<input name='post[secret]' checked='checked' type='checkbox' id='post_secret' value='1' />"
|
3009
|
+
|
3010
|
+
assert_dom_equal expected, output_buffer
|
3011
|
+
end
|
3012
|
+
|
3013
|
+
def test_fields_for_with_index
|
3014
|
+
output_buffer = fields_for("post[]", @post) do |f|
|
3015
|
+
concat f.text_field(:title)
|
3016
|
+
concat f.text_area(:body)
|
3017
|
+
concat f.check_box(:secret)
|
3018
|
+
end
|
3019
|
+
|
3020
|
+
expected =
|
3021
|
+
"<input name='post[123][title]' type='text' id='post_123_title' value='Hello World' />" +
|
3022
|
+
"<textarea name='post[123][body]' id='post_123_body'>\nBack to the hill and over it again!</textarea>" +
|
3023
|
+
"<input name='post[123][secret]' type='hidden' value='0' />" +
|
3024
|
+
"<input name='post[123][secret]' checked='checked' type='checkbox' id='post_123_secret' value='1' />"
|
3025
|
+
|
3026
|
+
assert_dom_equal expected, output_buffer
|
3027
|
+
end
|
3028
|
+
|
3029
|
+
def test_fields_for_with_nil_index_option_override
|
3030
|
+
output_buffer = fields_for("post[]", @post, index: nil) do |f|
|
3031
|
+
concat f.text_field(:title)
|
3032
|
+
concat f.text_area(:body)
|
3033
|
+
concat f.check_box(:secret)
|
3034
|
+
end
|
3035
|
+
|
3036
|
+
expected =
|
3037
|
+
"<input name='post[][title]' type='text' id='post__title' value='Hello World' />" +
|
3038
|
+
"<textarea name='post[][body]' id='post__body'>\nBack to the hill and over it again!</textarea>" +
|
3039
|
+
"<input name='post[][secret]' type='hidden' value='0' />" +
|
3040
|
+
"<input name='post[][secret]' checked='checked' type='checkbox' id='post__secret' value='1' />"
|
3041
|
+
|
3042
|
+
assert_dom_equal expected, output_buffer
|
3043
|
+
end
|
3044
|
+
|
3045
|
+
def test_fields_for_with_index_option_override
|
3046
|
+
output_buffer = fields_for("post[]", @post, index: "abc") do |f|
|
3047
|
+
concat f.text_field(:title)
|
3048
|
+
concat f.text_area(:body)
|
3049
|
+
concat f.check_box(:secret)
|
3050
|
+
end
|
3051
|
+
|
3052
|
+
expected =
|
3053
|
+
"<input name='post[abc][title]' type='text' id='post_abc_title' value='Hello World' />" +
|
3054
|
+
"<textarea name='post[abc][body]' id='post_abc_body'>\nBack to the hill and over it again!</textarea>" +
|
3055
|
+
"<input name='post[abc][secret]' type='hidden' value='0' />" +
|
3056
|
+
"<input name='post[abc][secret]' checked='checked' type='checkbox' id='post_abc_secret' value='1' />"
|
3057
|
+
|
3058
|
+
assert_dom_equal expected, output_buffer
|
3059
|
+
end
|
3060
|
+
|
3061
|
+
def test_fields_for_without_object
|
3062
|
+
output_buffer = fields_for(:post) do |f|
|
3063
|
+
concat f.text_field(:title)
|
3064
|
+
concat f.text_area(:body)
|
3065
|
+
concat f.check_box(:secret)
|
3066
|
+
end
|
3067
|
+
|
3068
|
+
expected =
|
3069
|
+
"<input name='post[title]' type='text' id='post_title' value='Hello World' />" +
|
3070
|
+
"<textarea name='post[body]' id='post_body'>\nBack to the hill and over it again!</textarea>" +
|
3071
|
+
"<input name='post[secret]' type='hidden' value='0' />" +
|
3072
|
+
"<input name='post[secret]' checked='checked' type='checkbox' id='post_secret' value='1' />"
|
3073
|
+
|
3074
|
+
assert_dom_equal expected, output_buffer
|
3075
|
+
end
|
3076
|
+
|
3077
|
+
def test_fields_for_with_only_object
|
3078
|
+
output_buffer = fields_for(@post) do |f|
|
3079
|
+
concat f.text_field(:title)
|
3080
|
+
concat f.text_area(:body)
|
3081
|
+
concat f.check_box(:secret)
|
3082
|
+
end
|
3083
|
+
|
3084
|
+
expected =
|
3085
|
+
"<input name='post[title]' type='text' id='post_title' value='Hello World' />" +
|
3086
|
+
"<textarea name='post[body]' id='post_body'>\nBack to the hill and over it again!</textarea>" +
|
3087
|
+
"<input name='post[secret]' type='hidden' value='0' />" +
|
3088
|
+
"<input name='post[secret]' checked='checked' type='checkbox' id='post_secret' value='1' />"
|
3089
|
+
|
3090
|
+
assert_dom_equal expected, output_buffer
|
3091
|
+
end
|
3092
|
+
|
3093
|
+
def test_fields_for_object_with_bracketed_name
|
3094
|
+
output_buffer = fields_for("author[post]", @post) do |f|
|
3095
|
+
concat f.label(:title)
|
3096
|
+
concat f.text_field(:title)
|
3097
|
+
end
|
3098
|
+
|
3099
|
+
assert_dom_equal "<label for=\"author_post_title\">Title</label>" +
|
3100
|
+
"<input name='author[post][title]' type='text' id='author_post_title' value='Hello World' />",
|
3101
|
+
output_buffer
|
3102
|
+
end
|
3103
|
+
|
3104
|
+
def test_fields_for_object_with_bracketed_name_and_index
|
3105
|
+
output_buffer = fields_for("author[post]", @post, index: 1) do |f|
|
3106
|
+
concat f.label(:title)
|
3107
|
+
concat f.text_field(:title)
|
3108
|
+
end
|
3109
|
+
|
3110
|
+
assert_dom_equal "<label for=\"author_post_1_title\">Title</label>" +
|
3111
|
+
"<input name='author[post][1][title]' type='text' id='author_post_1_title' value='Hello World' />",
|
3112
|
+
output_buffer
|
3113
|
+
end
|
3114
|
+
|
3115
|
+
def test_form_builder_does_not_have_form_for_method
|
3116
|
+
assert !ActionView::Helpers::FormBuilder.instance_methods.include?(:form_for)
|
3117
|
+
end
|
3118
|
+
|
3119
|
+
def test_form_for_and_fields_for
|
3120
|
+
form_for(@post, as: :post, html: { id: 'create-post' }) do |post_form|
|
3121
|
+
concat post_form.text_field(:title)
|
3122
|
+
concat post_form.text_area(:body)
|
3123
|
+
|
3124
|
+
concat fields_for(:parent_post, @post) { |parent_fields|
|
3125
|
+
concat parent_fields.check_box(:secret)
|
3126
|
+
}
|
3127
|
+
end
|
3128
|
+
|
3129
|
+
expected = whole_form('/posts/123', 'create-post', 'edit_post', method: 'patch') do
|
3130
|
+
"<input name='post[title]' type='text' id='post_title' value='Hello World' />" +
|
3131
|
+
"<textarea name='post[body]' id='post_body'>\nBack to the hill and over it again!</textarea>" +
|
3132
|
+
"<input name='parent_post[secret]' type='hidden' value='0' />" +
|
3133
|
+
"<input name='parent_post[secret]' checked='checked' type='checkbox' id='parent_post_secret' value='1' />"
|
3134
|
+
end
|
3135
|
+
|
3136
|
+
assert_dom_equal expected, output_buffer
|
3137
|
+
end
|
3138
|
+
|
3139
|
+
def test_form_for_and_fields_for_with_object
|
3140
|
+
form_for(@post, as: :post, html: { id: 'create-post' }) do |post_form|
|
3141
|
+
concat post_form.text_field(:title)
|
3142
|
+
concat post_form.text_area(:body)
|
3143
|
+
|
3144
|
+
concat post_form.fields_for(@comment) { |comment_fields|
|
3145
|
+
concat comment_fields.text_field(:name)
|
3146
|
+
}
|
3147
|
+
end
|
3148
|
+
|
3149
|
+
expected = whole_form('/posts/123', 'create-post', 'edit_post', method: 'patch') do
|
3150
|
+
"<input name='post[title]' type='text' id='post_title' value='Hello World' />" +
|
3151
|
+
"<textarea name='post[body]' id='post_body'>\nBack to the hill and over it again!</textarea>" +
|
3152
|
+
"<input name='post[comment][name]' type='text' id='post_comment_name' value='new comment' />"
|
3153
|
+
end
|
3154
|
+
|
3155
|
+
assert_dom_equal expected, output_buffer
|
3156
|
+
end
|
3157
|
+
|
3158
|
+
def test_form_for_and_fields_for_with_non_nested_association_and_without_object
|
3159
|
+
form_for(@post) do |f|
|
3160
|
+
concat f.fields_for(:category) { |c|
|
3161
|
+
concat c.text_field(:name)
|
3162
|
+
}
|
3163
|
+
end
|
3164
|
+
|
3165
|
+
expected = whole_form('/posts/123', 'edit_post_123', 'edit_post', method: 'patch') do
|
3166
|
+
"<input name='post[category][name]' type='text' id='post_category_name' />"
|
3167
|
+
end
|
3168
|
+
|
3169
|
+
assert_dom_equal expected, output_buffer
|
3170
|
+
end
|
3171
|
+
|
3172
|
+
class LabelledFormBuilder < ActionView::Helpers::FormBuilder
|
3173
|
+
(field_helpers - %w(hidden_field)).each do |selector|
|
3174
|
+
class_eval <<-RUBY_EVAL, __FILE__, __LINE__ + 1
|
3175
|
+
def #{selector}(field, *args, &proc)
|
3176
|
+
("<label for='\#{field}'>\#{field.to_s.humanize}:</label> " + super + "<br/>").html_safe
|
3177
|
+
end
|
3178
|
+
RUBY_EVAL
|
3179
|
+
end
|
3180
|
+
end
|
3181
|
+
|
3182
|
+
def test_form_for_with_labelled_builder
|
3183
|
+
form_for(@post, builder: LabelledFormBuilder) do |f|
|
3184
|
+
concat f.text_field(:title)
|
3185
|
+
concat f.text_area(:body)
|
3186
|
+
concat f.check_box(:secret)
|
3187
|
+
end
|
3188
|
+
|
3189
|
+
expected = whole_form('/posts/123', 'edit_post_123', 'edit_post', method: 'patch') do
|
3190
|
+
"<label for='title'>Title:</label> <input name='post[title]' type='text' id='post_title' value='Hello World' /><br/>" +
|
3191
|
+
"<label for='body'>Body:</label> <textarea name='post[body]' id='post_body'>\nBack to the hill and over it again!</textarea><br/>" +
|
3192
|
+
"<label for='secret'>Secret:</label> <input name='post[secret]' type='hidden' value='0' /><input name='post[secret]' checked='checked' type='checkbox' id='post_secret' value='1' /><br/>"
|
3193
|
+
end
|
3194
|
+
|
3195
|
+
assert_dom_equal expected, output_buffer
|
3196
|
+
end
|
3197
|
+
|
3198
|
+
def test_default_form_builder
|
3199
|
+
old_default_form_builder, ActionView::Base.default_form_builder =
|
3200
|
+
ActionView::Base.default_form_builder, LabelledFormBuilder
|
3201
|
+
|
3202
|
+
form_for(@post) do |f|
|
3203
|
+
concat f.text_field(:title)
|
3204
|
+
concat f.text_area(:body)
|
3205
|
+
concat f.check_box(:secret)
|
3206
|
+
end
|
3207
|
+
|
3208
|
+
expected = whole_form('/posts/123', 'edit_post_123', 'edit_post', method: 'patch') do
|
3209
|
+
"<label for='title'>Title:</label> <input name='post[title]' type='text' id='post_title' value='Hello World' /><br/>" +
|
3210
|
+
"<label for='body'>Body:</label> <textarea name='post[body]' id='post_body'>\nBack to the hill and over it again!</textarea><br/>" +
|
3211
|
+
"<label for='secret'>Secret:</label> <input name='post[secret]' type='hidden' value='0' /><input name='post[secret]' checked='checked' type='checkbox' id='post_secret' value='1' /><br/>"
|
3212
|
+
end
|
3213
|
+
|
3214
|
+
assert_dom_equal expected, output_buffer
|
3215
|
+
ensure
|
3216
|
+
ActionView::Base.default_form_builder = old_default_form_builder
|
3217
|
+
end
|
3218
|
+
|
3219
|
+
def test_lazy_loading_default_form_builder
|
3220
|
+
old_default_form_builder, ActionView::Base.default_form_builder =
|
3221
|
+
ActionView::Base.default_form_builder, "FormHelperTest::LabelledFormBuilder"
|
3222
|
+
|
3223
|
+
form_for(@post) do |f|
|
3224
|
+
concat f.text_field(:title)
|
3225
|
+
end
|
3226
|
+
|
3227
|
+
expected = whole_form('/posts/123', 'edit_post_123', 'edit_post', method: 'patch') do
|
3228
|
+
"<label for='title'>Title:</label> <input name='post[title]' type='text' id='post_title' value='Hello World' /><br/>"
|
3229
|
+
end
|
3230
|
+
|
3231
|
+
assert_dom_equal expected, output_buffer
|
3232
|
+
ensure
|
3233
|
+
ActionView::Base.default_form_builder = old_default_form_builder
|
3234
|
+
end
|
3235
|
+
|
3236
|
+
def test_fields_for_with_labelled_builder
|
3237
|
+
output_buffer = fields_for(:post, @post, builder: LabelledFormBuilder) do |f|
|
3238
|
+
concat f.text_field(:title)
|
3239
|
+
concat f.text_area(:body)
|
3240
|
+
concat f.check_box(:secret)
|
3241
|
+
end
|
3242
|
+
|
3243
|
+
expected =
|
3244
|
+
"<label for='title'>Title:</label> <input name='post[title]' type='text' id='post_title' value='Hello World' /><br/>" +
|
3245
|
+
"<label for='body'>Body:</label> <textarea name='post[body]' id='post_body'>\nBack to the hill and over it again!</textarea><br/>" +
|
3246
|
+
"<label for='secret'>Secret:</label> <input name='post[secret]' type='hidden' value='0' /><input name='post[secret]' checked='checked' type='checkbox' id='post_secret' value='1' /><br/>"
|
3247
|
+
|
3248
|
+
assert_dom_equal expected, output_buffer
|
3249
|
+
end
|
3250
|
+
|
3251
|
+
def test_form_for_with_labelled_builder_with_nested_fields_for_without_options_hash
|
3252
|
+
klass = nil
|
3253
|
+
|
3254
|
+
form_for(@post, builder: LabelledFormBuilder) do |f|
|
3255
|
+
f.fields_for(:comments, Comment.new) do |nested_fields|
|
3256
|
+
klass = nested_fields.class
|
3257
|
+
''
|
3258
|
+
end
|
3259
|
+
end
|
3260
|
+
|
3261
|
+
assert_equal LabelledFormBuilder, klass
|
3262
|
+
end
|
3263
|
+
|
3264
|
+
def test_form_for_with_labelled_builder_with_nested_fields_for_with_options_hash
|
3265
|
+
klass = nil
|
3266
|
+
|
3267
|
+
form_for(@post, builder: LabelledFormBuilder) do |f|
|
3268
|
+
f.fields_for(:comments, Comment.new, index: 'foo') do |nested_fields|
|
3269
|
+
klass = nested_fields.class
|
3270
|
+
''
|
3271
|
+
end
|
3272
|
+
end
|
3273
|
+
|
3274
|
+
assert_equal LabelledFormBuilder, klass
|
3275
|
+
end
|
3276
|
+
|
3277
|
+
def test_form_for_with_labelled_builder_path
|
3278
|
+
path = nil
|
3279
|
+
|
3280
|
+
form_for(@post, builder: LabelledFormBuilder) do |f|
|
3281
|
+
path = f.to_partial_path
|
3282
|
+
''
|
3283
|
+
end
|
3284
|
+
|
3285
|
+
assert_equal 'labelled_form', path
|
3286
|
+
end
|
3287
|
+
|
3288
|
+
class LabelledFormBuilderSubclass < LabelledFormBuilder; end
|
3289
|
+
|
3290
|
+
def test_form_for_with_labelled_builder_with_nested_fields_for_with_custom_builder
|
3291
|
+
klass = nil
|
3292
|
+
|
3293
|
+
form_for(@post, builder: LabelledFormBuilder) do |f|
|
3294
|
+
f.fields_for(:comments, Comment.new, builder: LabelledFormBuilderSubclass) do |nested_fields|
|
3295
|
+
klass = nested_fields.class
|
3296
|
+
''
|
3297
|
+
end
|
3298
|
+
end
|
3299
|
+
|
3300
|
+
assert_equal LabelledFormBuilderSubclass, klass
|
3301
|
+
end
|
3302
|
+
|
3303
|
+
def test_form_for_with_html_options_adds_options_to_form_tag
|
3304
|
+
form_for(@post, html: { id: 'some_form', class: 'some_class', multipart: true }) do |f| end
|
3305
|
+
expected = whole_form("/posts/123", "some_form", "some_class", method: "patch", multipart: "multipart/form-data")
|
3306
|
+
|
3307
|
+
assert_dom_equal expected, output_buffer
|
3308
|
+
end
|
3309
|
+
|
3310
|
+
def test_form_for_with_string_url_option
|
3311
|
+
form_for(@post, url: 'http://www.otherdomain.com') do |f| end
|
3312
|
+
|
3313
|
+
assert_dom_equal whole_form("http://www.otherdomain.com", "edit_post_123", "edit_post", method: "patch"), output_buffer
|
3314
|
+
end
|
3315
|
+
|
3316
|
+
def test_form_for_with_hash_url_option
|
3317
|
+
form_for(@post, url: { controller: 'controller', action: 'action' }) do |f| end
|
3318
|
+
|
3319
|
+
assert_equal 'controller', @url_for_options[:controller]
|
3320
|
+
assert_equal 'action', @url_for_options[:action]
|
3321
|
+
end
|
3322
|
+
|
3323
|
+
def test_form_for_with_record_url_option
|
3324
|
+
form_for(@post, url: @post) do |f| end
|
3325
|
+
|
3326
|
+
expected = whole_form("/posts/123", "edit_post_123", "edit_post", method: "patch")
|
3327
|
+
assert_dom_equal expected, output_buffer
|
3328
|
+
end
|
3329
|
+
|
3330
|
+
def test_form_for_with_existing_object
|
3331
|
+
form_for(@post) do |f| end
|
3332
|
+
|
3333
|
+
expected = whole_form("/posts/123", "edit_post_123", "edit_post", method: "patch")
|
3334
|
+
assert_dom_equal expected, output_buffer
|
3335
|
+
end
|
3336
|
+
|
3337
|
+
def test_form_for_with_new_object
|
3338
|
+
post = Post.new
|
3339
|
+
post.persisted = false
|
3340
|
+
def post.to_key; nil; end
|
3341
|
+
|
3342
|
+
form_for(post) do |f| end
|
3343
|
+
|
3344
|
+
expected = whole_form("/posts", "new_post", "new_post")
|
3345
|
+
assert_dom_equal expected, output_buffer
|
3346
|
+
end
|
3347
|
+
|
3348
|
+
def test_form_for_with_existing_object_in_list
|
3349
|
+
@comment.save
|
3350
|
+
form_for([@post, @comment]) {}
|
3351
|
+
|
3352
|
+
expected = whole_form(post_comment_path(@post, @comment), "edit_comment_1", "edit_comment", method: "patch")
|
3353
|
+
assert_dom_equal expected, output_buffer
|
3354
|
+
end
|
3355
|
+
|
3356
|
+
def test_form_for_with_new_object_in_list
|
3357
|
+
form_for([@post, @comment]) {}
|
3358
|
+
|
3359
|
+
expected = whole_form(post_comments_path(@post), "new_comment", "new_comment")
|
3360
|
+
assert_dom_equal expected, output_buffer
|
3361
|
+
end
|
3362
|
+
|
3363
|
+
def test_form_for_with_existing_object_and_namespace_in_list
|
3364
|
+
@comment.save
|
3365
|
+
form_for([:admin, @post, @comment]) {}
|
3366
|
+
|
3367
|
+
expected = whole_form(admin_post_comment_path(@post, @comment), "edit_comment_1", "edit_comment", method: "patch")
|
3368
|
+
assert_dom_equal expected, output_buffer
|
3369
|
+
end
|
3370
|
+
|
3371
|
+
def test_form_for_with_new_object_and_namespace_in_list
|
3372
|
+
form_for([:admin, @post, @comment]) {}
|
3373
|
+
|
3374
|
+
expected = whole_form(admin_post_comments_path(@post), "new_comment", "new_comment")
|
3375
|
+
assert_dom_equal expected, output_buffer
|
3376
|
+
end
|
3377
|
+
|
3378
|
+
def test_form_for_with_existing_object_and_custom_url
|
3379
|
+
form_for(@post, url: "/super_posts") do |f| end
|
3380
|
+
|
3381
|
+
expected = whole_form("/super_posts", "edit_post_123", "edit_post", method: "patch")
|
3382
|
+
assert_dom_equal expected, output_buffer
|
3383
|
+
end
|
3384
|
+
|
3385
|
+
def test_form_for_with_default_method_as_patch
|
3386
|
+
form_for(@post) {}
|
3387
|
+
expected = whole_form("/posts/123", "edit_post_123", "edit_post", method: "patch")
|
3388
|
+
assert_dom_equal expected, output_buffer
|
3389
|
+
end
|
3390
|
+
|
3391
|
+
def test_form_for_with_data_attributes
|
3392
|
+
form_for(@post, data: { behavior: "stuff" }, remote: true) {}
|
3393
|
+
assert_match %r|data-behavior="stuff"|, output_buffer
|
3394
|
+
assert_match %r|data-remote="true"|, output_buffer
|
3395
|
+
end
|
3396
|
+
|
3397
|
+
def test_fields_for_returns_block_result
|
3398
|
+
output = fields_for(Post.new) { |f| "fields" }
|
3399
|
+
assert_equal "fields", output
|
3400
|
+
end
|
3401
|
+
|
3402
|
+
def test_form_for_only_instantiates_builder_once
|
3403
|
+
initialization_count = 0
|
3404
|
+
builder_class = Class.new(ActionView::Helpers::FormBuilder) do
|
3405
|
+
define_method :initialize do |*args|
|
3406
|
+
super(*args)
|
3407
|
+
initialization_count += 1
|
3408
|
+
end
|
3409
|
+
end
|
3410
|
+
|
3411
|
+
form_for(@post, builder: builder_class) { }
|
3412
|
+
assert_equal 1, initialization_count, 'form builder instantiated more than once'
|
3413
|
+
end
|
3414
|
+
|
3415
|
+
protected
|
3416
|
+
|
3417
|
+
def hidden_fields(options = {})
|
3418
|
+
method = options[:method]
|
3419
|
+
|
3420
|
+
if options.fetch(:enforce_utf8, true)
|
3421
|
+
txt = %{<input name="utf8" type="hidden" value="✓" />}
|
3422
|
+
else
|
3423
|
+
txt = ''
|
3424
|
+
end
|
3425
|
+
|
3426
|
+
if method && !%w(get post).include?(method.to_s)
|
3427
|
+
txt << %{<input name="_method" type="hidden" value="#{method}" />}
|
3428
|
+
end
|
3429
|
+
|
3430
|
+
txt
|
3431
|
+
end
|
3432
|
+
|
3433
|
+
def form_text(action = "/", id = nil, html_class = nil, remote = nil, multipart = nil, method = nil)
|
3434
|
+
txt = %{<form accept-charset="UTF-8" action="#{action}"}
|
3435
|
+
txt << %{ enctype="multipart/form-data"} if multipart
|
3436
|
+
txt << %{ data-remote="true"} if remote
|
3437
|
+
txt << %{ class="#{html_class}"} if html_class
|
3438
|
+
txt << %{ id="#{id}"} if id
|
3439
|
+
method = method.to_s == "get" ? "get" : "post"
|
3440
|
+
txt << %{ method="#{method}">}
|
3441
|
+
end
|
3442
|
+
|
3443
|
+
def whole_form(action = "/", id = nil, html_class = nil, options = {})
|
3444
|
+
contents = block_given? ? yield : ""
|
3445
|
+
|
3446
|
+
method, remote, multipart = options.values_at(:method, :remote, :multipart)
|
3447
|
+
|
3448
|
+
form_text(action, id, html_class, remote, multipart, method) + hidden_fields(options.slice :method, :enforce_utf8) + contents + "</form>"
|
3449
|
+
end
|
3450
|
+
|
3451
|
+
def protect_against_forgery?
|
3452
|
+
false
|
3453
|
+
end
|
3454
|
+
|
3455
|
+
def with_locale(testing_locale = :label)
|
3456
|
+
old_locale, I18n.locale = I18n.locale, testing_locale
|
3457
|
+
yield
|
3458
|
+
ensure
|
3459
|
+
I18n.locale = old_locale
|
3460
|
+
end
|
3461
|
+
end
|