ruby-on-quails 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/.codeclimate.yml +13 -0
- data/.gitattributes +2 -0
- data/.github/issue_template.md +15 -0
- data/.github/pull_request_template.md +21 -0
- data/.github/stale.yml +28 -0
- data/.gitignore +24 -0
- data/.rubocop.yml +137 -0
- data/.travis.yml +123 -0
- data/.yardopts +4 -0
- data/CODE_OF_CONDUCT.md +12 -0
- data/CONTRIBUTING.md +49 -0
- data/Gemfile +168 -0
- data/Gemfile.lock +547 -0
- data/MIT-LICENSE +20 -0
- data/RAILS_VERSION +1 -0
- data/README.md +97 -0
- data/RELEASING_RAILS.md +225 -0
- data/Rakefile +72 -0
- data/actioncable/.gitignore +2 -0
- data/actioncable/CHANGELOG.md +26 -0
- data/actioncable/MIT-LICENSE +20 -0
- data/actioncable/README.md +567 -0
- data/actioncable/Rakefile +76 -0
- data/actioncable/actioncable.gemspec +32 -0
- data/actioncable/app/assets/javascripts/action_cable.coffee.erb +38 -0
- data/actioncable/app/assets/javascripts/action_cable/connection.coffee +116 -0
- data/actioncable/app/assets/javascripts/action_cable/connection_monitor.coffee +95 -0
- data/actioncable/app/assets/javascripts/action_cable/consumer.coffee +46 -0
- data/actioncable/app/assets/javascripts/action_cable/subscription.coffee +72 -0
- data/actioncable/app/assets/javascripts/action_cable/subscriptions.coffee +66 -0
- data/actioncable/bin/test +5 -0
- data/actioncable/blade.yml +34 -0
- data/actioncable/lib/action_cable.rb +54 -0
- data/actioncable/lib/action_cable/channel.rb +16 -0
- data/actioncable/lib/action_cable/channel/base.rb +305 -0
- data/actioncable/lib/action_cable/channel/broadcasting.rb +31 -0
- data/actioncable/lib/action_cable/channel/callbacks.rb +37 -0
- data/actioncable/lib/action_cable/channel/naming.rb +25 -0
- data/actioncable/lib/action_cable/channel/periodic_timers.rb +78 -0
- data/actioncable/lib/action_cable/channel/streams.rb +176 -0
- data/actioncable/lib/action_cable/connection.rb +21 -0
- data/actioncable/lib/action_cable/connection/authorization.rb +15 -0
- data/actioncable/lib/action_cable/connection/base.rb +260 -0
- data/actioncable/lib/action_cable/connection/client_socket.rb +157 -0
- data/actioncable/lib/action_cable/connection/identification.rb +47 -0
- data/actioncable/lib/action_cable/connection/internal_channel.rb +45 -0
- data/actioncable/lib/action_cable/connection/message_buffer.rb +57 -0
- data/actioncable/lib/action_cable/connection/stream.rb +115 -0
- data/actioncable/lib/action_cable/connection/stream_event_loop.rb +136 -0
- data/actioncable/lib/action_cable/connection/subscriptions.rb +83 -0
- data/actioncable/lib/action_cable/connection/tagged_logger_proxy.rb +42 -0
- data/actioncable/lib/action_cable/connection/web_socket.rb +43 -0
- data/actioncable/lib/action_cable/engine.rb +79 -0
- data/actioncable/lib/action_cable/gem_version.rb +17 -0
- data/actioncable/lib/action_cable/helpers/action_cable_helper.rb +42 -0
- data/actioncable/lib/action_cable/remote_connections.rb +69 -0
- data/actioncable/lib/action_cable/server.rb +17 -0
- data/actioncable/lib/action_cable/server/base.rb +89 -0
- data/actioncable/lib/action_cable/server/broadcasting.rb +54 -0
- data/actioncable/lib/action_cable/server/configuration.rb +43 -0
- data/actioncable/lib/action_cable/server/connections.rb +36 -0
- data/actioncable/lib/action_cable/server/worker.rb +77 -0
- data/actioncable/lib/action_cable/server/worker/active_record_connection_management.rb +21 -0
- data/actioncable/lib/action_cable/subscription_adapter.rb +11 -0
- data/actioncable/lib/action_cable/subscription_adapter/async.rb +29 -0
- data/actioncable/lib/action_cable/subscription_adapter/base.rb +30 -0
- data/actioncable/lib/action_cable/subscription_adapter/channel_prefix.rb +28 -0
- data/actioncable/lib/action_cable/subscription_adapter/evented_redis.rb +89 -0
- data/actioncable/lib/action_cable/subscription_adapter/inline.rb +37 -0
- data/actioncable/lib/action_cable/subscription_adapter/postgresql.rb +114 -0
- data/actioncable/lib/action_cable/subscription_adapter/redis.rb +178 -0
- data/actioncable/lib/action_cable/subscription_adapter/subscriber_map.rb +59 -0
- data/actioncable/lib/action_cable/version.rb +10 -0
- data/actioncable/lib/rails/generators/channel/USAGE +14 -0
- data/actioncable/lib/rails/generators/channel/channel_generator.rb +49 -0
- data/actioncable/lib/rails/generators/channel/templates/application_cable/channel.rb +4 -0
- data/actioncable/lib/rails/generators/channel/templates/application_cable/connection.rb +4 -0
- data/actioncable/lib/rails/generators/channel/templates/assets/cable.js +13 -0
- data/actioncable/lib/rails/generators/channel/templates/assets/channel.coffee +14 -0
- data/actioncable/lib/rails/generators/channel/templates/assets/channel.js +18 -0
- data/actioncable/lib/rails/generators/channel/templates/channel.rb +16 -0
- data/actioncable/package.json +24 -0
- data/actioncable/test/channel/base_test.rb +272 -0
- data/actioncable/test/channel/broadcasting_test.rb +31 -0
- data/actioncable/test/channel/naming_test.rb +12 -0
- data/actioncable/test/channel/periodic_timers_test.rb +74 -0
- data/actioncable/test/channel/rejection_test.rb +43 -0
- data/actioncable/test/channel/stream_test.rb +208 -0
- data/actioncable/test/client_test.rb +313 -0
- data/actioncable/test/connection/authorization_test.rb +33 -0
- data/actioncable/test/connection/base_test.rb +141 -0
- data/actioncable/test/connection/client_socket_test.rb +84 -0
- data/actioncable/test/connection/cross_site_forgery_test.rb +92 -0
- data/actioncable/test/connection/identifier_test.rb +77 -0
- data/actioncable/test/connection/multiple_identifiers_test.rb +39 -0
- data/actioncable/test/connection/stream_test.rb +66 -0
- data/actioncable/test/connection/string_identifier_test.rb +41 -0
- data/actioncable/test/connection/subscriptions_test.rb +116 -0
- data/actioncable/test/javascript/src/test.coffee +3 -0
- data/actioncable/test/javascript/src/test_helpers/consumer_test_helper.coffee +47 -0
- data/actioncable/test/javascript/src/test_helpers/index.coffee +11 -0
- data/actioncable/test/javascript/src/unit/action_cable_test.coffee +41 -0
- data/actioncable/test/javascript/src/unit/consumer_test.coffee +14 -0
- data/actioncable/test/javascript/src/unit/subscription_test.coffee +40 -0
- data/actioncable/test/javascript/src/unit/subscriptions_test.coffee +25 -0
- data/actioncable/test/javascript/vendor/mock-socket.js +4533 -0
- data/actioncable/test/server/base_test.rb +35 -0
- data/actioncable/test/server/broadcasting_test.rb +62 -0
- data/actioncable/test/stubs/global_id.rb +10 -0
- data/actioncable/test/stubs/room.rb +18 -0
- data/actioncable/test/stubs/test_adapter.rb +12 -0
- data/actioncable/test/stubs/test_connection.rb +35 -0
- data/actioncable/test/stubs/test_server.rb +32 -0
- data/actioncable/test/stubs/user.rb +17 -0
- data/actioncable/test/subscription_adapter/async_test.rb +19 -0
- data/actioncable/test/subscription_adapter/base_test.rb +65 -0
- data/actioncable/test/subscription_adapter/channel_prefix.rb +38 -0
- data/actioncable/test/subscription_adapter/common.rb +131 -0
- data/actioncable/test/subscription_adapter/evented_redis_test.rb +61 -0
- data/actioncable/test/subscription_adapter/inline_test.rb +19 -0
- data/actioncable/test/subscription_adapter/postgresql_test.rb +42 -0
- data/actioncable/test/subscription_adapter/redis_test.rb +28 -0
- data/actioncable/test/subscription_adapter/subscriber_map_test.rb +19 -0
- data/actioncable/test/test_helper.rb +37 -0
- data/actioncable/test/worker_test.rb +46 -0
- data/actionmailer/CHANGELOG.md +12 -0
- data/actionmailer/MIT-LICENSE +21 -0
- data/actionmailer/README.rdoc +175 -0
- data/actionmailer/Rakefile +25 -0
- data/actionmailer/actionmailer.gemspec +35 -0
- data/actionmailer/bin/test +5 -0
- data/actionmailer/lib/action_mailer.rb +62 -0
- data/actionmailer/lib/action_mailer/base.rb +981 -0
- data/actionmailer/lib/action_mailer/collector.rb +32 -0
- data/actionmailer/lib/action_mailer/delivery_job.rb +36 -0
- data/actionmailer/lib/action_mailer/delivery_methods.rb +82 -0
- data/actionmailer/lib/action_mailer/gem_version.rb +17 -0
- data/actionmailer/lib/action_mailer/inline_preview_interceptor.rb +59 -0
- data/actionmailer/lib/action_mailer/log_subscriber.rb +41 -0
- data/actionmailer/lib/action_mailer/mail_helper.rb +72 -0
- data/actionmailer/lib/action_mailer/message_delivery.rb +144 -0
- data/actionmailer/lib/action_mailer/parameterized.rb +154 -0
- data/actionmailer/lib/action_mailer/preview.rb +126 -0
- data/actionmailer/lib/action_mailer/railtie.rb +82 -0
- data/actionmailer/lib/action_mailer/rescuable.rb +29 -0
- data/actionmailer/lib/action_mailer/test_case.rb +123 -0
- data/actionmailer/lib/action_mailer/test_helper.rb +115 -0
- data/actionmailer/lib/action_mailer/version.rb +11 -0
- data/actionmailer/lib/rails/generators/mailer/USAGE +17 -0
- data/actionmailer/lib/rails/generators/mailer/mailer_generator.rb +38 -0
- data/actionmailer/lib/rails/generators/mailer/templates/application_mailer.rb +6 -0
- data/actionmailer/lib/rails/generators/mailer/templates/mailer.rb +17 -0
- data/actionmailer/test/abstract_unit.rb +47 -0
- data/actionmailer/test/assert_select_email_test.rb +49 -0
- data/actionmailer/test/asset_host_test.rb +39 -0
- data/actionmailer/test/base_test.rb +987 -0
- data/actionmailer/test/caching_test.rb +271 -0
- data/actionmailer/test/delivery_methods_test.rb +248 -0
- data/actionmailer/test/fixtures/anonymous/welcome.erb +1 -0
- data/actionmailer/test/fixtures/another.path/base_mailer/welcome.erb +1 -0
- data/actionmailer/test/fixtures/asset_host_mailer/email_with_asset.html.erb +1 -0
- data/actionmailer/test/fixtures/asset_mailer/welcome.html.erb +1 -0
- data/actionmailer/test/fixtures/attachments/foo.jpg +0 -0
- data/actionmailer/test/fixtures/attachments/test.jpg +0 -0
- data/actionmailer/test/fixtures/auto_layout_mailer/hello.html.erb +1 -0
- data/actionmailer/test/fixtures/auto_layout_mailer/multipart.html.erb +1 -0
- data/actionmailer/test/fixtures/auto_layout_mailer/multipart.text.erb +1 -0
- data/actionmailer/test/fixtures/base_mailer/attachment_with_content.erb +1 -0
- data/actionmailer/test/fixtures/base_mailer/attachment_with_hash.html.erb +0 -0
- data/actionmailer/test/fixtures/base_mailer/attachment_with_hash_default_encoding.html.erb +0 -0
- data/actionmailer/test/fixtures/base_mailer/different_layout.html.erb +1 -0
- data/actionmailer/test/fixtures/base_mailer/different_layout.text.erb +1 -0
- data/actionmailer/test/fixtures/base_mailer/email_with_translations.html.erb +1 -0
- data/actionmailer/test/fixtures/base_mailer/explicit_multipart_templates.html.erb +1 -0
- data/actionmailer/test/fixtures/base_mailer/explicit_multipart_templates.text.erb +1 -0
- data/actionmailer/test/fixtures/base_mailer/explicit_multipart_with_one_template.erb +1 -0
- data/actionmailer/test/fixtures/base_mailer/html_only.html.erb +1 -0
- data/actionmailer/test/fixtures/base_mailer/implicit_multipart.html.erb +1 -0
- data/actionmailer/test/fixtures/base_mailer/implicit_multipart.text.erb +1 -0
- data/actionmailer/test/fixtures/base_mailer/implicit_with_locale.de-AT.text.erb +1 -0
- data/actionmailer/test/fixtures/base_mailer/implicit_with_locale.de.html.erb +1 -0
- data/actionmailer/test/fixtures/base_mailer/implicit_with_locale.en.html.erb +1 -0
- data/actionmailer/test/fixtures/base_mailer/implicit_with_locale.html.erb +1 -0
- data/actionmailer/test/fixtures/base_mailer/implicit_with_locale.pl.text.erb +1 -0
- data/actionmailer/test/fixtures/base_mailer/implicit_with_locale.text.erb +1 -0
- data/actionmailer/test/fixtures/base_mailer/inline_attachment.html.erb +5 -0
- data/actionmailer/test/fixtures/base_mailer/inline_attachment.text.erb +4 -0
- data/actionmailer/test/fixtures/base_mailer/plain_text_only.text.erb +1 -0
- data/actionmailer/test/fixtures/base_mailer/welcome.erb +1 -0
- data/actionmailer/test/fixtures/base_mailer/welcome_with_headers.html.erb +0 -0
- data/actionmailer/test/fixtures/base_mailer/without_mail_call.erb +1 -0
- data/actionmailer/test/fixtures/base_test/after_action_mailer/welcome.html.erb +0 -0
- data/actionmailer/test/fixtures/base_test/before_action_mailer/welcome.html.erb +0 -0
- data/actionmailer/test/fixtures/base_test/default_inline_attachment_mailer/welcome.html.erb +0 -0
- data/actionmailer/test/fixtures/base_test/late_inline_attachment_mailer/on_render.erb +7 -0
- data/actionmailer/test/fixtures/caching_mailer/_partial.html.erb +3 -0
- data/actionmailer/test/fixtures/caching_mailer/fragment_cache.html.erb +3 -0
- data/actionmailer/test/fixtures/caching_mailer/fragment_cache_in_partials.html.erb +1 -0
- data/actionmailer/test/fixtures/caching_mailer/fragment_caching_options.html.erb +3 -0
- data/actionmailer/test/fixtures/caching_mailer/multipart_cache.html.erb +3 -0
- data/actionmailer/test/fixtures/caching_mailer/multipart_cache.text.erb +3 -0
- data/actionmailer/test/fixtures/caching_mailer/skip_fragment_cache_digesting.html.erb +3 -0
- data/actionmailer/test/fixtures/explicit_layout_mailer/logout.html.erb +1 -0
- data/actionmailer/test/fixtures/explicit_layout_mailer/signup.html.erb +1 -0
- data/actionmailer/test/fixtures/i18n_test_mailer/mail_with_i18n_subject.erb +4 -0
- data/actionmailer/test/fixtures/layouts/auto_layout_mailer.html.erb +1 -0
- data/actionmailer/test/fixtures/layouts/auto_layout_mailer.text.erb +1 -0
- data/actionmailer/test/fixtures/layouts/different_layout.html.erb +1 -0
- data/actionmailer/test/fixtures/layouts/different_layout.text.erb +1 -0
- data/actionmailer/test/fixtures/layouts/spam.html.erb +1 -0
- data/actionmailer/test/fixtures/mail_delivery_test/delivery_mailer/welcome.html.erb +0 -0
- data/actionmailer/test/fixtures/nested_layout_mailer/signup.html.erb +1 -0
- data/actionmailer/test/fixtures/proc_mailer/welcome.html.erb +0 -0
- data/actionmailer/test/fixtures/raw_email +14 -0
- data/actionmailer/test/fixtures/templates/signed_up.erb +3 -0
- data/actionmailer/test/fixtures/test_helper_mailer/welcome +1 -0
- data/actionmailer/test/fixtures/url_test_mailer/exercise_url_for.erb +1 -0
- data/actionmailer/test/fixtures/url_test_mailer/signed_up_with_url.erb +5 -0
- data/actionmailer/test/i18n_with_controller_test.rb +77 -0
- data/actionmailer/test/log_subscriber_test.rb +49 -0
- data/actionmailer/test/mail_helper_test.rb +125 -0
- data/actionmailer/test/mail_layout_test.rb +97 -0
- data/actionmailer/test/mailers/asset_mailer.rb +9 -0
- data/actionmailer/test/mailers/base_mailer.rb +138 -0
- data/actionmailer/test/mailers/caching_mailer.rb +25 -0
- data/actionmailer/test/mailers/delayed_mailer.rb +28 -0
- data/actionmailer/test/mailers/params_mailer.rb +13 -0
- data/actionmailer/test/mailers/proc_mailer.rb +18 -0
- data/actionmailer/test/message_delivery_test.rb +167 -0
- data/actionmailer/test/parameterized_test.rb +56 -0
- data/actionmailer/test/test_case_test.rb +68 -0
- data/actionmailer/test/test_helper_test.rb +223 -0
- data/actionmailer/test/url_test.rb +144 -0
- data/actionpack/CHANGELOG.md +75 -0
- data/actionpack/MIT-LICENSE +21 -0
- data/actionpack/README.rdoc +57 -0
- data/actionpack/Rakefile +40 -0
- data/actionpack/actionpack.gemspec +38 -0
- data/actionpack/bin/test +5 -0
- data/actionpack/lib/abstract_controller.rb +26 -0
- data/actionpack/lib/abstract_controller/asset_paths.rb +12 -0
- data/actionpack/lib/abstract_controller/base.rb +267 -0
- data/actionpack/lib/abstract_controller/caching.rb +66 -0
- data/actionpack/lib/abstract_controller/caching/fragments.rb +166 -0
- data/actionpack/lib/abstract_controller/callbacks.rb +212 -0
- data/actionpack/lib/abstract_controller/collector.rb +43 -0
- data/actionpack/lib/abstract_controller/error.rb +6 -0
- data/actionpack/lib/abstract_controller/helpers.rb +194 -0
- data/actionpack/lib/abstract_controller/logger.rb +14 -0
- data/actionpack/lib/abstract_controller/railties/routes_helpers.rb +20 -0
- data/actionpack/lib/abstract_controller/rendering.rb +136 -0
- data/actionpack/lib/abstract_controller/translation.rb +31 -0
- data/actionpack/lib/abstract_controller/url_for.rb +35 -0
- data/actionpack/lib/action_controller.rb +65 -0
- data/actionpack/lib/action_controller/api.rb +149 -0
- data/actionpack/lib/action_controller/api/api_rendering.rb +16 -0
- data/actionpack/lib/action_controller/base.rb +275 -0
- data/actionpack/lib/action_controller/caching.rb +46 -0
- data/actionpack/lib/action_controller/form_builder.rb +50 -0
- data/actionpack/lib/action_controller/log_subscriber.rb +78 -0
- data/actionpack/lib/action_controller/metal.rb +258 -0
- data/actionpack/lib/action_controller/metal/basic_implicit_render.rb +13 -0
- data/actionpack/lib/action_controller/metal/conditional_get.rb +274 -0
- data/actionpack/lib/action_controller/metal/cookies.rb +16 -0
- data/actionpack/lib/action_controller/metal/data_streaming.rb +152 -0
- data/actionpack/lib/action_controller/metal/etag_with_flash.rb +18 -0
- data/actionpack/lib/action_controller/metal/etag_with_template_digest.rb +57 -0
- data/actionpack/lib/action_controller/metal/exceptions.rb +56 -0
- data/actionpack/lib/action_controller/metal/flash.rb +61 -0
- data/actionpack/lib/action_controller/metal/force_ssl.rb +99 -0
- data/actionpack/lib/action_controller/metal/head.rb +60 -0
- data/actionpack/lib/action_controller/metal/helpers.rb +123 -0
- data/actionpack/lib/action_controller/metal/http_authentication.rb +522 -0
- data/actionpack/lib/action_controller/metal/implicit_render.rb +73 -0
- data/actionpack/lib/action_controller/metal/instrumentation.rb +111 -0
- data/actionpack/lib/action_controller/metal/live.rb +312 -0
- data/actionpack/lib/action_controller/metal/mime_responds.rb +313 -0
- data/actionpack/lib/action_controller/metal/parameter_encoding.rb +51 -0
- data/actionpack/lib/action_controller/metal/params_wrapper.rb +285 -0
- data/actionpack/lib/action_controller/metal/redirecting.rb +124 -0
- data/actionpack/lib/action_controller/metal/renderers.rb +181 -0
- data/actionpack/lib/action_controller/metal/rendering.rb +124 -0
- data/actionpack/lib/action_controller/metal/request_forgery_protection.rb +433 -0
- data/actionpack/lib/action_controller/metal/rescue.rb +28 -0
- data/actionpack/lib/action_controller/metal/streaming.rb +223 -0
- data/actionpack/lib/action_controller/metal/strong_parameters.rb +1085 -0
- data/actionpack/lib/action_controller/metal/testing.rb +22 -0
- data/actionpack/lib/action_controller/metal/url_for.rb +58 -0
- data/actionpack/lib/action_controller/railtie.rb +89 -0
- data/actionpack/lib/action_controller/railties/helpers.rb +24 -0
- data/actionpack/lib/action_controller/renderer.rb +117 -0
- data/actionpack/lib/action_controller/template_assertions.rb +11 -0
- data/actionpack/lib/action_controller/test_case.rb +626 -0
- data/actionpack/lib/action_dispatch.rb +111 -0
- data/actionpack/lib/action_dispatch/http/cache.rb +216 -0
- data/actionpack/lib/action_dispatch/http/filter_parameters.rb +84 -0
- data/actionpack/lib/action_dispatch/http/filter_redirect.rb +37 -0
- data/actionpack/lib/action_dispatch/http/headers.rb +132 -0
- data/actionpack/lib/action_dispatch/http/mime_negotiation.rb +173 -0
- data/actionpack/lib/action_dispatch/http/mime_type.rb +342 -0
- data/actionpack/lib/action_dispatch/http/mime_types.rb +37 -0
- data/actionpack/lib/action_dispatch/http/parameter_filter.rb +86 -0
- data/actionpack/lib/action_dispatch/http/parameters.rb +131 -0
- data/actionpack/lib/action_dispatch/http/rack_cache.rb +63 -0
- data/actionpack/lib/action_dispatch/http/request.rb +412 -0
- data/actionpack/lib/action_dispatch/http/response.rb +519 -0
- data/actionpack/lib/action_dispatch/http/upload.rb +84 -0
- data/actionpack/lib/action_dispatch/http/url.rb +350 -0
- data/actionpack/lib/action_dispatch/journey.rb +7 -0
- data/actionpack/lib/action_dispatch/journey/formatter.rb +189 -0
- data/actionpack/lib/action_dispatch/journey/gtg/builder.rb +164 -0
- data/actionpack/lib/action_dispatch/journey/gtg/simulator.rb +41 -0
- data/actionpack/lib/action_dispatch/journey/gtg/transition_table.rb +158 -0
- data/actionpack/lib/action_dispatch/journey/nfa/builder.rb +78 -0
- data/actionpack/lib/action_dispatch/journey/nfa/dot.rb +36 -0
- data/actionpack/lib/action_dispatch/journey/nfa/simulator.rb +49 -0
- data/actionpack/lib/action_dispatch/journey/nfa/transition_table.rb +120 -0
- data/actionpack/lib/action_dispatch/journey/nodes/node.rb +140 -0
- data/actionpack/lib/action_dispatch/journey/parser.rb +199 -0
- data/actionpack/lib/action_dispatch/journey/parser.y +50 -0
- data/actionpack/lib/action_dispatch/journey/parser_extras.rb +31 -0
- data/actionpack/lib/action_dispatch/journey/path/pattern.rb +198 -0
- data/actionpack/lib/action_dispatch/journey/route.rb +203 -0
- data/actionpack/lib/action_dispatch/journey/router.rb +156 -0
- data/actionpack/lib/action_dispatch/journey/router/utils.rb +102 -0
- data/actionpack/lib/action_dispatch/journey/routes.rb +81 -0
- data/actionpack/lib/action_dispatch/journey/scanner.rb +64 -0
- data/actionpack/lib/action_dispatch/journey/visitors.rb +268 -0
- data/actionpack/lib/action_dispatch/journey/visualizer/fsm.css +30 -0
- data/actionpack/lib/action_dispatch/journey/visualizer/fsm.js +134 -0
- data/actionpack/lib/action_dispatch/journey/visualizer/index.html.erb +52 -0
- data/actionpack/lib/action_dispatch/middleware/callbacks.rb +36 -0
- data/actionpack/lib/action_dispatch/middleware/cookies.rb +686 -0
- data/actionpack/lib/action_dispatch/middleware/debug_exceptions.rb +205 -0
- data/actionpack/lib/action_dispatch/middleware/debug_locks.rb +124 -0
- data/actionpack/lib/action_dispatch/middleware/exception_wrapper.rb +146 -0
- data/actionpack/lib/action_dispatch/middleware/executor.rb +21 -0
- data/actionpack/lib/action_dispatch/middleware/flash.rb +300 -0
- data/actionpack/lib/action_dispatch/middleware/public_exceptions.rb +57 -0
- data/actionpack/lib/action_dispatch/middleware/reloader.rb +12 -0
- data/actionpack/lib/action_dispatch/middleware/remote_ip.rb +183 -0
- data/actionpack/lib/action_dispatch/middleware/request_id.rb +43 -0
- data/actionpack/lib/action_dispatch/middleware/session/abstract_store.rb +92 -0
- data/actionpack/lib/action_dispatch/middleware/session/cache_store.rb +54 -0
- data/actionpack/lib/action_dispatch/middleware/session/cookie_store.rb +131 -0
- data/actionpack/lib/action_dispatch/middleware/session/mem_cache_store.rb +28 -0
- data/actionpack/lib/action_dispatch/middleware/show_exceptions.rb +62 -0
- data/actionpack/lib/action_dispatch/middleware/ssl.rb +144 -0
- data/actionpack/lib/action_dispatch/middleware/stack.rb +116 -0
- data/actionpack/lib/action_dispatch/middleware/static.rb +130 -0
- data/actionpack/lib/action_dispatch/middleware/templates/rescues/_request_and_response.html.erb +22 -0
- data/actionpack/lib/action_dispatch/middleware/templates/rescues/_request_and_response.text.erb +23 -0
- data/actionpack/lib/action_dispatch/middleware/templates/rescues/_source.html.erb +27 -0
- data/actionpack/lib/action_dispatch/middleware/templates/rescues/_source.text.erb +8 -0
- data/actionpack/lib/action_dispatch/middleware/templates/rescues/_trace.html.erb +52 -0
- data/actionpack/lib/action_dispatch/middleware/templates/rescues/_trace.text.erb +9 -0
- data/actionpack/lib/action_dispatch/middleware/templates/rescues/diagnostics.html.erb +16 -0
- data/actionpack/lib/action_dispatch/middleware/templates/rescues/diagnostics.text.erb +9 -0
- data/actionpack/lib/action_dispatch/middleware/templates/rescues/layout.erb +160 -0
- data/actionpack/lib/action_dispatch/middleware/templates/rescues/missing_template.html.erb +11 -0
- data/actionpack/lib/action_dispatch/middleware/templates/rescues/missing_template.text.erb +3 -0
- data/actionpack/lib/action_dispatch/middleware/templates/rescues/routing_error.html.erb +32 -0
- data/actionpack/lib/action_dispatch/middleware/templates/rescues/routing_error.text.erb +11 -0
- data/actionpack/lib/action_dispatch/middleware/templates/rescues/template_error.html.erb +20 -0
- data/actionpack/lib/action_dispatch/middleware/templates/rescues/template_error.text.erb +7 -0
- data/actionpack/lib/action_dispatch/middleware/templates/rescues/unknown_action.html.erb +6 -0
- data/actionpack/lib/action_dispatch/middleware/templates/rescues/unknown_action.text.erb +3 -0
- data/actionpack/lib/action_dispatch/middleware/templates/routes/_route.html.erb +16 -0
- data/actionpack/lib/action_dispatch/middleware/templates/routes/_table.html.erb +200 -0
- data/actionpack/lib/action_dispatch/railtie.rb +50 -0
- data/actionpack/lib/action_dispatch/request/session.rb +233 -0
- data/actionpack/lib/action_dispatch/request/utils.rb +76 -0
- data/actionpack/lib/action_dispatch/routing.rb +260 -0
- data/actionpack/lib/action_dispatch/routing/endpoint.rb +12 -0
- data/actionpack/lib/action_dispatch/routing/inspector.rb +225 -0
- data/actionpack/lib/action_dispatch/routing/mapper.rb +2256 -0
- data/actionpack/lib/action_dispatch/routing/polymorphic_routes.rb +352 -0
- data/actionpack/lib/action_dispatch/routing/redirection.rb +201 -0
- data/actionpack/lib/action_dispatch/routing/route_set.rb +870 -0
- data/actionpack/lib/action_dispatch/routing/routes_proxy.rb +69 -0
- data/actionpack/lib/action_dispatch/routing/url_for.rb +218 -0
- data/actionpack/lib/action_dispatch/system_test_case.rb +133 -0
- data/actionpack/lib/action_dispatch/system_testing/driver.rb +55 -0
- data/actionpack/lib/action_dispatch/system_testing/server.rb +45 -0
- data/actionpack/lib/action_dispatch/system_testing/test_helpers/screenshot_helper.rb +100 -0
- data/actionpack/lib/action_dispatch/system_testing/test_helpers/setup_and_teardown.rb +27 -0
- data/actionpack/lib/action_dispatch/system_testing/test_helpers/undef_methods.rb +26 -0
- data/actionpack/lib/action_dispatch/testing/assertion_response.rb +47 -0
- data/actionpack/lib/action_dispatch/testing/assertions.rb +24 -0
- data/actionpack/lib/action_dispatch/testing/assertions/response.rb +107 -0
- data/actionpack/lib/action_dispatch/testing/assertions/routing.rb +222 -0
- data/actionpack/lib/action_dispatch/testing/integration.rb +652 -0
- data/actionpack/lib/action_dispatch/testing/request_encoder.rb +55 -0
- data/actionpack/lib/action_dispatch/testing/test_process.rb +50 -0
- data/actionpack/lib/action_dispatch/testing/test_request.rb +71 -0
- data/actionpack/lib/action_dispatch/testing/test_response.rb +53 -0
- data/actionpack/lib/action_pack.rb +26 -0
- data/actionpack/lib/action_pack/gem_version.rb +17 -0
- data/actionpack/lib/action_pack/version.rb +10 -0
- data/actionpack/test/abstract/callbacks_test.rb +270 -0
- data/actionpack/test/abstract/collector_test.rb +65 -0
- data/actionpack/test/abstract/translation_test.rb +79 -0
- data/actionpack/test/abstract_unit.rb +451 -0
- data/actionpack/test/assertions/response_assertions_test.rb +141 -0
- data/actionpack/test/controller/action_pack_assertions_test.rb +493 -0
- data/actionpack/test/controller/api/conditional_get_test.rb +59 -0
- data/actionpack/test/controller/api/data_streaming_test.rb +28 -0
- data/actionpack/test/controller/api/force_ssl_test.rb +22 -0
- data/actionpack/test/controller/api/implicit_render_test.rb +17 -0
- data/actionpack/test/controller/api/params_wrapper_test.rb +28 -0
- data/actionpack/test/controller/api/redirect_to_test.rb +21 -0
- data/actionpack/test/controller/api/renderers_test.rb +50 -0
- data/actionpack/test/controller/api/url_for_test.rb +22 -0
- data/actionpack/test/controller/api/with_cookies_test.rb +23 -0
- data/actionpack/test/controller/api/with_helpers_test.rb +44 -0
- data/actionpack/test/controller/base_test.rb +323 -0
- data/actionpack/test/controller/caching_test.rb +503 -0
- data/actionpack/test/controller/content_type_test.rb +169 -0
- data/actionpack/test/controller/controller_fixtures/app/controllers/admin/user_controller.rb +0 -0
- data/actionpack/test/controller/controller_fixtures/app/controllers/user_controller.rb +0 -0
- data/actionpack/test/controller/controller_fixtures/vendor/plugins/bad_plugin/lib/plugin_controller.rb +0 -0
- data/actionpack/test/controller/default_url_options_with_before_action_test.rb +28 -0
- data/actionpack/test/controller/filters_test.rb +1050 -0
- data/actionpack/test/controller/flash_hash_test.rb +216 -0
- data/actionpack/test/controller/flash_test.rb +371 -0
- data/actionpack/test/controller/force_ssl_test.rb +333 -0
- data/actionpack/test/controller/form_builder_test.rb +19 -0
- data/actionpack/test/controller/helper_test.rb +295 -0
- data/actionpack/test/controller/http_basic_authentication_test.rb +179 -0
- data/actionpack/test/controller/http_digest_authentication_test.rb +282 -0
- data/actionpack/test/controller/http_token_authentication_test.rb +216 -0
- data/actionpack/test/controller/integration_test.rb +1122 -0
- data/actionpack/test/controller/live_stream_test.rb +518 -0
- data/actionpack/test/controller/localized_templates_test.rb +48 -0
- data/actionpack/test/controller/log_subscriber_test.rb +371 -0
- data/actionpack/test/controller/metal/renderers_test.rb +50 -0
- data/actionpack/test/controller/metal_test.rb +32 -0
- data/actionpack/test/controller/mime/accept_format_test.rb +94 -0
- data/actionpack/test/controller/mime/respond_to_test.rb +843 -0
- data/actionpack/test/controller/new_base/bare_metal_test.rb +184 -0
- data/actionpack/test/controller/new_base/base_test.rb +134 -0
- data/actionpack/test/controller/new_base/content_negotiation_test.rb +28 -0
- data/actionpack/test/controller/new_base/content_type_test.rb +116 -0
- data/actionpack/test/controller/new_base/middleware_test.rb +112 -0
- data/actionpack/test/controller/new_base/render_action_test.rb +314 -0
- data/actionpack/test/controller/new_base/render_body_test.rb +172 -0
- data/actionpack/test/controller/new_base/render_context_test.rb +54 -0
- data/actionpack/test/controller/new_base/render_file_test.rb +72 -0
- data/actionpack/test/controller/new_base/render_html_test.rb +192 -0
- data/actionpack/test/controller/new_base/render_implicit_action_test.rb +59 -0
- data/actionpack/test/controller/new_base/render_layout_test.rb +128 -0
- data/actionpack/test/controller/new_base/render_partial_test.rb +62 -0
- data/actionpack/test/controller/new_base/render_plain_test.rb +170 -0
- data/actionpack/test/controller/new_base/render_streaming_test.rb +116 -0
- data/actionpack/test/controller/new_base/render_template_test.rb +240 -0
- data/actionpack/test/controller/new_base/render_test.rb +142 -0
- data/actionpack/test/controller/new_base/render_xml_test.rb +12 -0
- data/actionpack/test/controller/output_escaping_test.rb +17 -0
- data/actionpack/test/controller/parameter_encoding_test.rb +52 -0
- data/actionpack/test/controller/parameters/accessors_test.rb +279 -0
- data/actionpack/test/controller/parameters/always_permitted_parameters_test.rb +30 -0
- data/actionpack/test/controller/parameters/dup_test.rb +67 -0
- data/actionpack/test/controller/parameters/log_on_unpermitted_params_test.rb +70 -0
- data/actionpack/test/controller/parameters/multi_parameter_attributes_test.rb +39 -0
- data/actionpack/test/controller/parameters/mutators_test.rb +122 -0
- data/actionpack/test/controller/parameters/nested_parameters_permit_test.rb +184 -0
- data/actionpack/test/controller/parameters/parameters_permit_test.rb +513 -0
- data/actionpack/test/controller/parameters/raise_on_unpermitted_params_test.rb +33 -0
- data/actionpack/test/controller/parameters/serialization_test.rb +55 -0
- data/actionpack/test/controller/params_wrapper_test.rb +408 -0
- data/actionpack/test/controller/permitted_params_test.rb +27 -0
- data/actionpack/test/controller/redirect_test.rb +358 -0
- data/actionpack/test/controller/render_js_test.rb +36 -0
- data/actionpack/test/controller/render_json_test.rb +137 -0
- data/actionpack/test/controller/render_test.rb +810 -0
- data/actionpack/test/controller/render_xml_test.rb +102 -0
- data/actionpack/test/controller/renderer_test.rb +136 -0
- data/actionpack/test/controller/renderers_test.rb +91 -0
- data/actionpack/test/controller/request/test_request_test.rb +42 -0
- data/actionpack/test/controller/request_forgery_protection_test.rb +998 -0
- data/actionpack/test/controller/required_params_test.rb +100 -0
- data/actionpack/test/controller/rescue_test.rb +364 -0
- data/actionpack/test/controller/resources_test.rb +1369 -0
- data/actionpack/test/controller/routing_test.rb +2108 -0
- data/actionpack/test/controller/runner_test.rb +24 -0
- data/actionpack/test/controller/send_file_test.rb +259 -0
- data/actionpack/test/controller/show_exceptions_test.rb +114 -0
- data/actionpack/test/controller/streaming_test.rb +28 -0
- data/actionpack/test/controller/test_case_test.rb +1120 -0
- data/actionpack/test/controller/url_for_integration_test.rb +193 -0
- data/actionpack/test/controller/url_for_test.rb +519 -0
- data/actionpack/test/controller/url_rewriter_test.rb +92 -0
- data/actionpack/test/controller/webservice_test.rb +135 -0
- data/actionpack/test/dispatch/callbacks_test.rb +47 -0
- data/actionpack/test/dispatch/cookies_test.rb +1288 -0
- data/actionpack/test/dispatch/debug_exceptions_test.rb +502 -0
- data/actionpack/test/dispatch/debug_locks_test.rb +38 -0
- data/actionpack/test/dispatch/exception_wrapper_test.rb +120 -0
- data/actionpack/test/dispatch/executor_test.rb +136 -0
- data/actionpack/test/dispatch/header_test.rb +169 -0
- data/actionpack/test/dispatch/live_response_test.rb +98 -0
- data/actionpack/test/dispatch/mapper_test.rb +210 -0
- data/actionpack/test/dispatch/middleware_stack_test.rb +115 -0
- data/actionpack/test/dispatch/mime_type_test.rb +187 -0
- data/actionpack/test/dispatch/mount_test.rb +95 -0
- data/actionpack/test/dispatch/prefix_generation_test.rb +463 -0
- data/actionpack/test/dispatch/rack_cache_test.rb +23 -0
- data/actionpack/test/dispatch/reloader_test.rb +167 -0
- data/actionpack/test/dispatch/request/json_params_parsing_test.rb +207 -0
- data/actionpack/test/dispatch/request/multipart_params_parsing_test.rb +202 -0
- data/actionpack/test/dispatch/request/query_string_parsing_test.rb +176 -0
- data/actionpack/test/dispatch/request/session_test.rb +164 -0
- data/actionpack/test/dispatch/request/url_encoded_params_parsing_test.rb +181 -0
- data/actionpack/test/dispatch/request_id_test.rb +70 -0
- data/actionpack/test/dispatch/request_test.rb +1306 -0
- data/actionpack/test/dispatch/response_test.rb +536 -0
- data/actionpack/test/dispatch/routing/concerns_test.rb +124 -0
- data/actionpack/test/dispatch/routing/custom_url_helpers_test.rb +333 -0
- data/actionpack/test/dispatch/routing/inspector_test.rb +425 -0
- data/actionpack/test/dispatch/routing/ipv6_redirect_test.rb +46 -0
- data/actionpack/test/dispatch/routing/route_set_test.rb +166 -0
- data/actionpack/test/dispatch/routing_assertions_test.rb +132 -0
- data/actionpack/test/dispatch/routing_test.rb +5055 -0
- data/actionpack/test/dispatch/runner_test.rb +19 -0
- data/actionpack/test/dispatch/session/abstract_store_test.rb +58 -0
- data/actionpack/test/dispatch/session/cache_store_test.rb +183 -0
- data/actionpack/test/dispatch/session/cookie_store_test.rb +370 -0
- data/actionpack/test/dispatch/session/mem_cache_store_test.rb +205 -0
- data/actionpack/test/dispatch/session/test_session_test.rb +65 -0
- data/actionpack/test/dispatch/show_exceptions_test.rb +138 -0
- data/actionpack/test/dispatch/ssl_test.rb +220 -0
- data/actionpack/test/dispatch/static_test.rb +309 -0
- data/actionpack/test/dispatch/system_testing/driver_test.rb +37 -0
- data/actionpack/test/dispatch/system_testing/screenshot_helper_test.rb +74 -0
- data/actionpack/test/dispatch/system_testing/server_test.rb +19 -0
- data/actionpack/test/dispatch/system_testing/system_test_case_test.rb +67 -0
- data/actionpack/test/dispatch/test_request_test.rb +131 -0
- data/actionpack/test/dispatch/test_response_test.rb +37 -0
- data/actionpack/test/dispatch/uploaded_file_test.rb +113 -0
- data/actionpack/test/dispatch/url_generation_test.rb +141 -0
- data/actionpack/test/fixtures/_top_level_partial_only.erb +1 -0
- data/actionpack/test/fixtures/alternate_helpers/foo_helper.rb +5 -0
- data/actionpack/test/fixtures/bad_customers/_bad_customer.html.erb +1 -0
- data/actionpack/test/fixtures/collection_cache/index.html.erb +1 -0
- data/actionpack/test/fixtures/company.rb +11 -0
- data/actionpack/test/fixtures/customers/_commented_customer.html.erb +5 -0
- data/actionpack/test/fixtures/customers/_customer.html.erb +4 -0
- data/actionpack/test/fixtures/filter_test/implicit_actions/edit.html.erb +1 -0
- data/actionpack/test/fixtures/filter_test/implicit_actions/show.html.erb +1 -0
- data/actionpack/test/fixtures/functional_caching/_partial.erb +3 -0
- data/actionpack/test/fixtures/functional_caching/formatted_fragment_cached.html.erb +3 -0
- data/actionpack/test/fixtures/functional_caching/formatted_fragment_cached.xml.builder +5 -0
- data/actionpack/test/fixtures/functional_caching/formatted_fragment_cached_with_variant.html+phone.erb +3 -0
- data/actionpack/test/fixtures/functional_caching/fragment_cached.html.erb +3 -0
- data/actionpack/test/fixtures/functional_caching/fragment_cached_with_options.html.erb +3 -0
- data/actionpack/test/fixtures/functional_caching/fragment_cached_without_digest.html.erb +3 -0
- data/actionpack/test/fixtures/functional_caching/html_fragment_cached_with_partial.html.erb +1 -0
- data/actionpack/test/fixtures/functional_caching/inline_fragment_cached.html.erb +2 -0
- data/actionpack/test/fixtures/helpers/abc_helper.rb +5 -0
- data/actionpack/test/fixtures/helpers/fun/games_helper.rb +7 -0
- data/actionpack/test/fixtures/helpers/fun/pdf_helper.rb +7 -0
- data/actionpack/test/fixtures/helpers/just_me_helper.rb +5 -0
- data/actionpack/test/fixtures/helpers/me_too_helper.rb +5 -0
- data/actionpack/test/fixtures/helpers1_pack/pack1_helper.rb +7 -0
- data/actionpack/test/fixtures/helpers2_pack/pack2_helper.rb +7 -0
- data/actionpack/test/fixtures/helpers_typo/admin/users_helper.rb +6 -0
- data/actionpack/test/fixtures/implicit_render_test/empty_action_with_mobile_variant.html+mobile.erb +1 -0
- data/actionpack/test/fixtures/implicit_render_test/empty_action_with_template.html.erb +1 -0
- data/actionpack/test/fixtures/layouts/_customers.erb +1 -0
- data/actionpack/test/fixtures/layouts/block_with_layout.erb +3 -0
- data/actionpack/test/fixtures/layouts/builder.builder +3 -0
- data/actionpack/test/fixtures/layouts/partial_with_layout.erb +3 -0
- data/actionpack/test/fixtures/layouts/standard.html.erb +1 -0
- data/actionpack/test/fixtures/layouts/talk_from_action.erb +2 -0
- data/actionpack/test/fixtures/layouts/with_html_partial.html.erb +1 -0
- data/actionpack/test/fixtures/layouts/xhr.html.erb +2 -0
- data/actionpack/test/fixtures/layouts/yield.erb +2 -0
- data/actionpack/test/fixtures/load_me.rb +4 -0
- data/actionpack/test/fixtures/localized/hello_world.de.html +1 -0
- data/actionpack/test/fixtures/localized/hello_world.en.html +1 -0
- data/actionpack/test/fixtures/localized/hello_world.it.erb +1 -0
- data/actionpack/test/fixtures/multipart/binary_file +0 -0
- data/actionpack/test/fixtures/multipart/boundary_problem_file +10 -0
- data/actionpack/test/fixtures/multipart/bracketed_param +5 -0
- data/actionpack/test/fixtures/multipart/bracketed_utf8_param +5 -0
- data/actionpack/test/fixtures/multipart/empty +10 -0
- data/actionpack/test/fixtures/multipart/hello.txt +1 -0
- data/actionpack/test/fixtures/multipart/large_text_file +10 -0
- data/actionpack/test/fixtures/multipart/mixed_files +0 -0
- data/actionpack/test/fixtures/multipart/none +9 -0
- data/actionpack/test/fixtures/multipart/ruby_on_rails.jpg +0 -0
- data/actionpack/test/fixtures/multipart/single_parameter +5 -0
- data/actionpack/test/fixtures/multipart/single_utf8_param +5 -0
- data/actionpack/test/fixtures/multipart/text_file +10 -0
- data/actionpack/test/fixtures/multipart/utf8_filename +10 -0
- data/actionpack/test/fixtures/namespaced/implicit_render_test/hello_world.erb +1 -0
- data/actionpack/test/fixtures/old_content_type/render_default_content_types_for_respond_to.xml.erb +1 -0
- data/actionpack/test/fixtures/old_content_type/render_default_for_builder.builder +1 -0
- data/actionpack/test/fixtures/old_content_type/render_default_for_erb.erb +1 -0
- data/actionpack/test/fixtures/post_test/layouts/post.html.erb +1 -0
- data/actionpack/test/fixtures/post_test/layouts/super_post.iphone.erb +1 -0
- data/actionpack/test/fixtures/post_test/post/index.html.erb +1 -0
- data/actionpack/test/fixtures/post_test/post/index.iphone.erb +1 -0
- data/actionpack/test/fixtures/post_test/super_post/index.html.erb +1 -0
- data/actionpack/test/fixtures/post_test/super_post/index.iphone.erb +1 -0
- data/actionpack/test/fixtures/public/400.html +1 -0
- data/actionpack/test/fixtures/public/404.html +1 -0
- data/actionpack/test/fixtures/public/500.da.html +1 -0
- data/actionpack/test/fixtures/public/500.html +1 -0
- data/actionpack/test/fixtures/public/bar.html +1 -0
- data/actionpack/test/fixtures/public/bar/index.html +1 -0
- data/actionpack/test/fixtures/public/foo/bar.html +1 -0
- data/actionpack/test/fixtures/public/foo/baz.css +3 -0
- data/actionpack/test/fixtures/public/foo/index.html +1 -0
- data/actionpack/test/fixtures/public/foo/other-index.html +1 -0
- data/actionpack/test/fixtures/public/foo//343/201/223/343/202/223/343/201/253/343/201/241/343/201/257.html +1 -0
- data/actionpack/test/fixtures/public/gzip/application-a71b3024f80aea3181c09774ca17e712.js +4 -0
- data/actionpack/test/fixtures/public/gzip/application-a71b3024f80aea3181c09774ca17e712.js.gz +0 -0
- data/actionpack/test/fixtures/public/gzip/foo.zoo +4 -0
- data/actionpack/test/fixtures/public/gzip/foo.zoo.gz +0 -0
- data/actionpack/test/fixtures/public/index.html +1 -0
- data/actionpack/test/fixtures/public/other-index.html +1 -0
- data/actionpack/test/fixtures/respond_to/all_types_with_layout.html.erb +1 -0
- data/actionpack/test/fixtures/respond_to/custom_constant_handling_without_block.mobile.erb +1 -0
- data/actionpack/test/fixtures/respond_to/iphone_with_html_response_type.html.erb +1 -0
- data/actionpack/test/fixtures/respond_to/iphone_with_html_response_type.iphone.erb +1 -0
- data/actionpack/test/fixtures/respond_to/layouts/missing.html.erb +1 -0
- data/actionpack/test/fixtures/respond_to/layouts/standard.html.erb +1 -0
- data/actionpack/test/fixtures/respond_to/layouts/standard.iphone.erb +1 -0
- data/actionpack/test/fixtures/respond_to/using_defaults.html.erb +1 -0
- data/actionpack/test/fixtures/respond_to/using_defaults.xml.builder +1 -0
- data/actionpack/test/fixtures/respond_to/using_defaults_with_all.html.erb +1 -0
- data/actionpack/test/fixtures/respond_to/using_defaults_with_type_list.html.erb +1 -0
- data/actionpack/test/fixtures/respond_to/using_defaults_with_type_list.xml.builder +1 -0
- data/actionpack/test/fixtures/respond_to/variant_any_implicit_render.html+phablet.erb +1 -0
- data/actionpack/test/fixtures/respond_to/variant_any_implicit_render.html+tablet.erb +1 -0
- data/actionpack/test/fixtures/respond_to/variant_inline_syntax_without_block.html+phone.erb +1 -0
- data/actionpack/test/fixtures/respond_to/variant_plus_none_for_format.html.erb +1 -0
- data/actionpack/test/fixtures/respond_to/variant_with_implicit_template_rendering.html+mobile.erb +1 -0
- data/actionpack/test/fixtures/ruby_template.ruby +2 -0
- data/actionpack/test/fixtures/session_autoload_test/session_autoload_test/foo.rb +12 -0
- data/actionpack/test/fixtures/shared.html.erb +1 -0
- data/actionpack/test/fixtures/star_star_mime/index.js.erb +1 -0
- data/actionpack/test/fixtures/test/_partial.erb +1 -0
- data/actionpack/test/fixtures/test/_partial.html.erb +1 -0
- data/actionpack/test/fixtures/test/_partial.js.erb +1 -0
- data/actionpack/test/fixtures/test/dot.directory/render_file_with_ivar.erb +1 -0
- data/actionpack/test/fixtures/test/formatted_xml_erb.builder +1 -0
- data/actionpack/test/fixtures/test/formatted_xml_erb.html.erb +1 -0
- data/actionpack/test/fixtures/test/formatted_xml_erb.xml.erb +1 -0
- data/actionpack/test/fixtures/test/hello/hello.erb +1 -0
- data/actionpack/test/fixtures/test/hello_world.erb +1 -0
- data/actionpack/test/fixtures/test/hello_world_with_partial.html.erb +2 -0
- data/actionpack/test/fixtures/test/hello_xml_world.builder +11 -0
- data/actionpack/test/fixtures/test/implicit_content_type.atom.builder +2 -0
- data/actionpack/test/fixtures/test/render_file_with_ivar.erb +1 -0
- data/actionpack/test/fixtures/test/render_file_with_locals.erb +1 -0
- data/actionpack/test/fixtures/test/with_implicit_template.erb +1 -0
- data/actionpack/test/fixtures//345/205/254/345/205/261/bar.html +1 -0
- data/actionpack/test/fixtures//345/205/254/345/205/261/bar/index.html +1 -0
- data/actionpack/test/fixtures//345/205/254/345/205/261/foo/bar.html +1 -0
- data/actionpack/test/fixtures//345/205/254/345/205/261/foo/baz.css +3 -0
- data/actionpack/test/fixtures//345/205/254/345/205/261/foo/index.html +1 -0
- data/actionpack/test/fixtures//345/205/254/345/205/261/foo/other-index.html +1 -0
- data/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/actionpack/test/fixtures//345/205/254/345/205/261/gzip/application-a71b3024f80aea3181c09774ca17e712.js +4 -0
- data/actionpack/test/fixtures//345/205/254/345/205/261/gzip/application-a71b3024f80aea3181c09774ca17e712.js.gz +0 -0
- data/actionpack/test/fixtures//345/205/254/345/205/261/gzip/foo.zoo +4 -0
- data/actionpack/test/fixtures//345/205/254/345/205/261/gzip/foo.zoo.gz +0 -0
- data/actionpack/test/fixtures//345/205/254/345/205/261/index.html +1 -0
- data/actionpack/test/fixtures//345/205/254/345/205/261/other-index.html +1 -0
- data/actionpack/test/journey/gtg/builder_test.rb +81 -0
- data/actionpack/test/journey/gtg/transition_table_test.rb +125 -0
- data/actionpack/test/journey/nfa/simulator_test.rb +100 -0
- data/actionpack/test/journey/nfa/transition_table_test.rb +74 -0
- data/actionpack/test/journey/nodes/symbol_test.rb +19 -0
- data/actionpack/test/journey/path/pattern_test.rb +286 -0
- data/actionpack/test/journey/route/definition/parser_test.rb +112 -0
- data/actionpack/test/journey/route/definition/scanner_test.rb +71 -0
- data/actionpack/test/journey/route_test.rb +113 -0
- data/actionpack/test/journey/router/utils_test.rb +48 -0
- data/actionpack/test/journey/router_test.rb +535 -0
- data/actionpack/test/journey/routes_test.rb +62 -0
- data/actionpack/test/lib/controller/fake_controllers.rb +37 -0
- data/actionpack/test/lib/controller/fake_models.rb +79 -0
- data/actionpack/test/routing/helper_test.rb +33 -0
- data/actionview/.gitignore +2 -0
- data/actionview/CHANGELOG.md +35 -0
- data/actionview/MIT-LICENSE +21 -0
- data/actionview/README.rdoc +38 -0
- data/actionview/RUNNING_UJS_TESTS.rdoc +7 -0
- data/actionview/RUNNING_UNIT_TESTS.rdoc +27 -0
- data/actionview/Rakefile +136 -0
- data/actionview/actionview.gemspec +38 -0
- data/actionview/app/assets/javascripts/MIT-LICENSE +20 -0
- data/actionview/app/assets/javascripts/README.md +60 -0
- data/actionview/app/assets/javascripts/rails-ujs.coffee +39 -0
- data/actionview/app/assets/javascripts/rails-ujs/BANNER.js +5 -0
- data/actionview/app/assets/javascripts/rails-ujs/features/confirm.coffee +26 -0
- data/actionview/app/assets/javascripts/rails-ujs/features/disable.coffee +82 -0
- data/actionview/app/assets/javascripts/rails-ujs/features/method.coffee +34 -0
- data/actionview/app/assets/javascripts/rails-ujs/features/remote.coffee +90 -0
- data/actionview/app/assets/javascripts/rails-ujs/start.coffee +70 -0
- data/actionview/app/assets/javascripts/rails-ujs/utils/ajax.coffee +96 -0
- data/actionview/app/assets/javascripts/rails-ujs/utils/csrf.coffee +25 -0
- data/actionview/app/assets/javascripts/rails-ujs/utils/dom.coffee +28 -0
- data/actionview/app/assets/javascripts/rails-ujs/utils/event.coffee +40 -0
- data/actionview/app/assets/javascripts/rails-ujs/utils/form.coffee +36 -0
- data/actionview/bin/test +5 -0
- data/actionview/blade.yml +11 -0
- data/actionview/coffeelint.json +135 -0
- data/actionview/lib/action_view.rb +98 -0
- data/actionview/lib/action_view/base.rb +215 -0
- data/actionview/lib/action_view/buffers.rb +52 -0
- data/actionview/lib/action_view/context.rb +38 -0
- data/actionview/lib/action_view/dependency_tracker.rb +175 -0
- data/actionview/lib/action_view/digestor.rb +128 -0
- data/actionview/lib/action_view/flows.rb +76 -0
- data/actionview/lib/action_view/gem_version.rb +17 -0
- data/actionview/lib/action_view/helpers.rb +66 -0
- data/actionview/lib/action_view/helpers/active_model_helper.rb +51 -0
- data/actionview/lib/action_view/helpers/asset_tag_helper.rb +400 -0
- data/actionview/lib/action_view/helpers/asset_url_helper.rb +469 -0
- data/actionview/lib/action_view/helpers/atom_feed_helper.rb +205 -0
- data/actionview/lib/action_view/helpers/cache_helper.rb +263 -0
- data/actionview/lib/action_view/helpers/capture_helper.rb +212 -0
- data/actionview/lib/action_view/helpers/controller_helper.rb +36 -0
- data/actionview/lib/action_view/helpers/csrf_helper.rb +35 -0
- data/actionview/lib/action_view/helpers/date_helper.rb +1156 -0
- data/actionview/lib/action_view/helpers/debug_helper.rb +36 -0
- data/actionview/lib/action_view/helpers/form_helper.rb +2355 -0
- data/actionview/lib/action_view/helpers/form_options_helper.rb +883 -0
- data/actionview/lib/action_view/helpers/form_tag_helper.rb +916 -0
- data/actionview/lib/action_view/helpers/javascript_helper.rb +83 -0
- data/actionview/lib/action_view/helpers/number_helper.rb +451 -0
- data/actionview/lib/action_view/helpers/output_safety_helper.rb +70 -0
- data/actionview/lib/action_view/helpers/record_tag_helper.rb +23 -0
- data/actionview/lib/action_view/helpers/rendering_helper.rb +100 -0
- data/actionview/lib/action_view/helpers/sanitize_helper.rb +177 -0
- data/actionview/lib/action_view/helpers/tag_helper.rb +313 -0
- data/actionview/lib/action_view/helpers/tags.rb +44 -0
- data/actionview/lib/action_view/helpers/tags/base.rb +192 -0
- data/actionview/lib/action_view/helpers/tags/check_box.rb +66 -0
- data/actionview/lib/action_view/helpers/tags/checkable.rb +18 -0
- data/actionview/lib/action_view/helpers/tags/collection_check_boxes.rb +36 -0
- data/actionview/lib/action_view/helpers/tags/collection_helpers.rb +119 -0
- data/actionview/lib/action_view/helpers/tags/collection_radio_buttons.rb +31 -0
- data/actionview/lib/action_view/helpers/tags/collection_select.rb +30 -0
- data/actionview/lib/action_view/helpers/tags/color_field.rb +27 -0
- data/actionview/lib/action_view/helpers/tags/date_field.rb +15 -0
- data/actionview/lib/action_view/helpers/tags/date_select.rb +74 -0
- data/actionview/lib/action_view/helpers/tags/datetime_field.rb +32 -0
- data/actionview/lib/action_view/helpers/tags/datetime_local_field.rb +21 -0
- data/actionview/lib/action_view/helpers/tags/datetime_select.rb +10 -0
- data/actionview/lib/action_view/helpers/tags/email_field.rb +10 -0
- data/actionview/lib/action_view/helpers/tags/file_field.rb +10 -0
- data/actionview/lib/action_view/helpers/tags/grouped_collection_select.rb +31 -0
- data/actionview/lib/action_view/helpers/tags/hidden_field.rb +10 -0
- data/actionview/lib/action_view/helpers/tags/label.rb +85 -0
- data/actionview/lib/action_view/helpers/tags/month_field.rb +15 -0
- data/actionview/lib/action_view/helpers/tags/number_field.rb +20 -0
- data/actionview/lib/action_view/helpers/tags/password_field.rb +14 -0
- data/actionview/lib/action_view/helpers/tags/placeholderable.rb +24 -0
- data/actionview/lib/action_view/helpers/tags/radio_button.rb +33 -0
- data/actionview/lib/action_view/helpers/tags/range_field.rb +10 -0
- data/actionview/lib/action_view/helpers/tags/search_field.rb +27 -0
- data/actionview/lib/action_view/helpers/tags/select.rb +43 -0
- data/actionview/lib/action_view/helpers/tags/tel_field.rb +10 -0
- data/actionview/lib/action_view/helpers/tags/text_area.rb +24 -0
- data/actionview/lib/action_view/helpers/tags/text_field.rb +34 -0
- data/actionview/lib/action_view/helpers/tags/time_field.rb +15 -0
- data/actionview/lib/action_view/helpers/tags/time_select.rb +10 -0
- data/actionview/lib/action_view/helpers/tags/time_zone_select.rb +22 -0
- data/actionview/lib/action_view/helpers/tags/translator.rb +44 -0
- data/actionview/lib/action_view/helpers/tags/url_field.rb +10 -0
- data/actionview/lib/action_view/helpers/tags/week_field.rb +15 -0
- data/actionview/lib/action_view/helpers/text_helper.rb +486 -0
- data/actionview/lib/action_view/helpers/translation_helper.rb +141 -0
- data/actionview/lib/action_view/helpers/url_helper.rb +654 -0
- data/actionview/lib/action_view/layouts.rb +433 -0
- data/actionview/lib/action_view/locale/en.yml +56 -0
- data/actionview/lib/action_view/log_subscriber.rb +96 -0
- data/actionview/lib/action_view/lookup_context.rb +274 -0
- data/actionview/lib/action_view/model_naming.rb +14 -0
- data/actionview/lib/action_view/path_set.rb +100 -0
- data/actionview/lib/action_view/railtie.rb +75 -0
- data/actionview/lib/action_view/record_identifier.rb +112 -0
- data/actionview/lib/action_view/renderer/abstract_renderer.rb +55 -0
- data/actionview/lib/action_view/renderer/partial_renderer.rb +552 -0
- data/actionview/lib/action_view/renderer/partial_renderer/collection_caching.rb +57 -0
- data/actionview/lib/action_view/renderer/renderer.rb +56 -0
- data/actionview/lib/action_view/renderer/streaming_template_renderer.rb +103 -0
- data/actionview/lib/action_view/renderer/template_renderer.rb +102 -0
- data/actionview/lib/action_view/rendering.rb +155 -0
- data/actionview/lib/action_view/routing_url_for.rb +145 -0
- data/actionview/lib/action_view/tasks/cache_digests.rake +25 -0
- data/actionview/lib/action_view/template.rb +361 -0
- data/actionview/lib/action_view/template/error.rb +144 -0
- data/actionview/lib/action_view/template/handlers.rb +66 -0
- data/actionview/lib/action_view/template/handlers/builder.rb +25 -0
- data/actionview/lib/action_view/template/handlers/erb.rb +77 -0
- data/actionview/lib/action_view/template/handlers/erb/deprecated_erubis.rb +11 -0
- data/actionview/lib/action_view/template/handlers/erb/erubi.rb +83 -0
- data/actionview/lib/action_view/template/handlers/erb/erubis.rb +83 -0
- data/actionview/lib/action_view/template/handlers/html.rb +11 -0
- data/actionview/lib/action_view/template/handlers/raw.rb +11 -0
- data/actionview/lib/action_view/template/html.rb +34 -0
- data/actionview/lib/action_view/template/resolver.rb +391 -0
- data/actionview/lib/action_view/template/text.rb +33 -0
- data/actionview/lib/action_view/template/types.rb +57 -0
- data/actionview/lib/action_view/test_case.rb +300 -0
- data/actionview/lib/action_view/testing/resolvers.rb +54 -0
- data/actionview/lib/action_view/version.rb +10 -0
- data/actionview/lib/action_view/view_paths.rb +105 -0
- data/actionview/package.json +36 -0
- data/actionview/test/abstract_unit.rb +287 -0
- data/actionview/test/actionpack/abstract/abstract_controller_test.rb +292 -0
- data/actionview/test/actionpack/abstract/helper_test.rb +128 -0
- data/actionview/test/actionpack/abstract/layouts_test.rb +568 -0
- data/actionview/test/actionpack/abstract/render_test.rb +103 -0
- data/actionview/test/actionpack/abstract/views/abstract_controller/testing/me3/formatted.html.erb +1 -0
- data/actionview/test/actionpack/abstract/views/abstract_controller/testing/me3/index.erb +1 -0
- data/actionview/test/actionpack/abstract/views/abstract_controller/testing/me4/index.erb +1 -0
- data/actionview/test/actionpack/abstract/views/action_with_ivars.erb +1 -0
- data/actionview/test/actionpack/abstract/views/helper_test.erb +1 -0
- data/actionview/test/actionpack/abstract/views/index.erb +1 -0
- data/actionview/test/actionpack/abstract/views/layouts/abstract_controller/testing/me4.erb +1 -0
- data/actionview/test/actionpack/abstract/views/layouts/application.erb +1 -0
- data/actionview/test/actionpack/abstract/views/naked_render.erb +1 -0
- data/actionview/test/actionpack/controller/capture_test.rb +83 -0
- data/actionview/test/actionpack/controller/layout_test.rb +270 -0
- data/actionview/test/actionpack/controller/render_test.rb +1294 -0
- data/actionview/test/actionpack/controller/view_paths_test.rb +174 -0
- data/actionview/test/active_record_unit.rb +92 -0
- data/actionview/test/activerecord/controller_runtime_test.rb +95 -0
- data/actionview/test/activerecord/debug_helper_test.rb +19 -0
- data/actionview/test/activerecord/form_helper_activerecord_test.rb +90 -0
- data/actionview/test/activerecord/polymorphic_routes_test.rb +780 -0
- data/actionview/test/activerecord/relation_cache_test.rb +23 -0
- data/actionview/test/activerecord/render_partial_with_record_identification_test.rb +198 -0
- data/actionview/test/fixtures/_top_level_partial.html.erb +1 -0
- data/actionview/test/fixtures/_top_level_partial_only.erb +1 -0
- data/actionview/test/fixtures/actionpack/bad_customers/_bad_customer.html.erb +1 -0
- data/actionview/test/fixtures/actionpack/customers/_customer.html.erb +1 -0
- data/actionview/test/fixtures/actionpack/fun/games/_form.erb +1 -0
- data/actionview/test/fixtures/actionpack/fun/games/hello_world.erb +1 -0
- data/actionview/test/fixtures/actionpack/good_customers/_good_customer.html.erb +1 -0
- data/actionview/test/fixtures/actionpack/hello.html +1 -0
- data/actionview/test/fixtures/actionpack/layout_tests/alt/layouts/alt.erb +1 -0
- data/actionview/test/fixtures/actionpack/layout_tests/layouts/controller_name_space/nested.erb +1 -0
- data/actionview/test/fixtures/actionpack/layout_tests/layouts/item.erb +1 -0
- data/actionview/test/fixtures/actionpack/layout_tests/layouts/layout_test.erb +1 -0
- data/actionview/test/fixtures/actionpack/layout_tests/layouts/multiple_extensions.html.erb +1 -0
- data/actionview/test/fixtures/actionpack/layout_tests/layouts/symlinked/symlinked_layout.erb +5 -0
- data/actionview/test/fixtures/actionpack/layout_tests/layouts/third_party_template_library.mab +1 -0
- data/actionview/test/fixtures/actionpack/layout_tests/views/goodbye.erb +1 -0
- data/actionview/test/fixtures/actionpack/layout_tests/views/hello.erb +1 -0
- data/actionview/test/fixtures/actionpack/layouts/_column.html.erb +2 -0
- data/actionview/test/fixtures/actionpack/layouts/_customers.erb +1 -0
- data/actionview/test/fixtures/actionpack/layouts/_partial_and_yield.erb +2 -0
- data/actionview/test/fixtures/actionpack/layouts/_yield_only.erb +1 -0
- data/actionview/test/fixtures/actionpack/layouts/_yield_with_params.erb +1 -0
- data/actionview/test/fixtures/actionpack/layouts/block_with_layout.erb +3 -0
- data/actionview/test/fixtures/actionpack/layouts/builder.builder +3 -0
- data/actionview/test/fixtures/actionpack/layouts/partial_with_layout.erb +3 -0
- data/actionview/test/fixtures/actionpack/layouts/standard.html.erb +1 -0
- data/actionview/test/fixtures/actionpack/layouts/standard.text.erb +1 -0
- data/actionview/test/fixtures/actionpack/layouts/streaming.erb +4 -0
- data/actionview/test/fixtures/actionpack/layouts/talk_from_action.erb +2 -0
- data/actionview/test/fixtures/actionpack/layouts/with_html_partial.html.erb +1 -0
- data/actionview/test/fixtures/actionpack/layouts/xhr.html.erb +2 -0
- data/actionview/test/fixtures/actionpack/layouts/yield.erb +2 -0
- data/actionview/test/fixtures/actionpack/layouts/yield_with_render_inline_inside.erb +2 -0
- data/actionview/test/fixtures/actionpack/layouts/yield_with_render_partial_inside.erb +2 -0
- data/actionview/test/fixtures/actionpack/quiz/questions/_question.html.erb +1 -0
- data/actionview/test/fixtures/actionpack/shared.html.erb +1 -0
- data/actionview/test/fixtures/actionpack/test/_changing_priority.html.erb +1 -0
- data/actionview/test/fixtures/actionpack/test/_changing_priority.json.erb +1 -0
- data/actionview/test/fixtures/actionpack/test/_counter.html.erb +1 -0
- data/actionview/test/fixtures/actionpack/test/_customer.erb +1 -0
- data/actionview/test/fixtures/actionpack/test/_customer_counter.erb +1 -0
- data/actionview/test/fixtures/actionpack/test/_customer_counter_with_as.erb +1 -0
- data/actionview/test/fixtures/actionpack/test/_customer_greeting.erb +1 -0
- data/actionview/test/fixtures/actionpack/test/_customer_iteration.erb +1 -0
- data/actionview/test/fixtures/actionpack/test/_customer_iteration_with_as.erb +1 -0
- data/actionview/test/fixtures/actionpack/test/_customer_with_var.erb +1 -0
- data/actionview/test/fixtures/actionpack/test/_directory/_partial_with_locales.html.erb +1 -0
- data/actionview/test/fixtures/actionpack/test/_first_json_partial.json.erb +1 -0
- data/actionview/test/fixtures/actionpack/test/_form.erb +1 -0
- data/actionview/test/fixtures/actionpack/test/_hash_greeting.erb +1 -0
- data/actionview/test/fixtures/actionpack/test/_hash_object.erb +2 -0
- data/actionview/test/fixtures/actionpack/test/_hello.builder +1 -0
- data/actionview/test/fixtures/actionpack/test/_json_change_priority.json.erb +0 -0
- data/actionview/test/fixtures/actionpack/test/_labelling_form.erb +1 -0
- data/actionview/test/fixtures/actionpack/test/_layout_for_partial.html.erb +3 -0
- data/actionview/test/fixtures/actionpack/test/_partial.erb +1 -0
- data/actionview/test/fixtures/actionpack/test/_partial.html.erb +1 -0
- data/actionview/test/fixtures/actionpack/test/_partial.js.erb +1 -0
- data/actionview/test/fixtures/actionpack/test/_partial_for_use_in_layout.html.erb +1 -0
- data/actionview/test/fixtures/actionpack/test/_partial_html_erb.html.erb +1 -0
- data/actionview/test/fixtures/actionpack/test/_partial_name_local_variable.erb +1 -0
- data/actionview/test/fixtures/actionpack/test/_partial_only.erb +1 -0
- data/actionview/test/fixtures/actionpack/test/_partial_only_html.html +1 -0
- data/actionview/test/fixtures/actionpack/test/_partial_with_partial.erb +2 -0
- data/actionview/test/fixtures/actionpack/test/_person.erb +2 -0
- data/actionview/test/fixtures/actionpack/test/_raise_indentation.html.erb +13 -0
- data/actionview/test/fixtures/actionpack/test/_second_json_partial.json.erb +1 -0
- data/actionview/test/fixtures/actionpack/test/action_talk_to_layout.erb +2 -0
- data/actionview/test/fixtures/actionpack/test/calling_partial_with_layout.html.erb +1 -0
- data/actionview/test/fixtures/actionpack/test/capturing.erb +4 -0
- data/actionview/test/fixtures/actionpack/test/change_priority.html.erb +2 -0
- data/actionview/test/fixtures/actionpack/test/content_for.erb +1 -0
- data/actionview/test/fixtures/actionpack/test/content_for_concatenated.erb +3 -0
- data/actionview/test/fixtures/actionpack/test/content_for_with_parameter.erb +2 -0
- data/actionview/test/fixtures/actionpack/test/dot.directory/render_file_with_ivar.erb +1 -0
- data/actionview/test/fixtures/actionpack/test/formatted_html_erb.html.erb +1 -0
- data/actionview/test/fixtures/actionpack/test/formatted_xml_erb.builder +1 -0
- data/actionview/test/fixtures/actionpack/test/formatted_xml_erb.html.erb +1 -0
- data/actionview/test/fixtures/actionpack/test/formatted_xml_erb.xml.erb +1 -0
- data/actionview/test/fixtures/actionpack/test/greeting.html.erb +1 -0
- data/actionview/test/fixtures/actionpack/test/greeting.xml.erb +1 -0
- data/actionview/test/fixtures/actionpack/test/hello,world.erb +1 -0
- data/actionview/test/fixtures/actionpack/test/hello.builder +4 -0
- data/actionview/test/fixtures/actionpack/test/hello/hello.erb +1 -0
- data/actionview/test/fixtures/actionpack/test/hello_world.erb +1 -0
- data/actionview/test/fixtures/actionpack/test/hello_world_container.builder +3 -0
- data/actionview/test/fixtures/actionpack/test/hello_world_from_rxml.builder +3 -0
- data/actionview/test/fixtures/actionpack/test/hello_world_with_layout_false.erb +1 -0
- data/actionview/test/fixtures/actionpack/test/hello_world_with_partial.html.erb +2 -0
- data/actionview/test/fixtures/actionpack/test/hello_xml_world.builder +11 -0
- data/actionview/test/fixtures/actionpack/test/html_template.html.erb +1 -0
- data/actionview/test/fixtures/actionpack/test/hyphen-ated.erb +1 -0
- data/actionview/test/fixtures/actionpack/test/implicit_content_type.atom.builder +2 -0
- data/actionview/test/fixtures/actionpack/test/list.erb +1 -0
- data/actionview/test/fixtures/actionpack/test/non_erb_block_content_for.builder +4 -0
- data/actionview/test/fixtures/actionpack/test/potential_conflicts.erb +4 -0
- data/actionview/test/fixtures/actionpack/test/proper_block_detection.erb +1 -0
- data/actionview/test/fixtures/actionpack/test/render_file_from_template.html.erb +1 -0
- data/actionview/test/fixtures/actionpack/test/render_file_with_ivar.erb +1 -0
- data/actionview/test/fixtures/actionpack/test/render_file_with_locals.erb +1 -0
- data/actionview/test/fixtures/actionpack/test/render_file_with_locals_and_default.erb +1 -0
- data/actionview/test/fixtures/actionpack/test/render_implicit_html_template_from_xhr_request.da.html.erb +1 -0
- data/actionview/test/fixtures/actionpack/test/render_implicit_html_template_from_xhr_request.html.erb +1 -0
- data/actionview/test/fixtures/actionpack/test/render_implicit_js_template_without_layout.js.erb +1 -0
- data/actionview/test/fixtures/actionpack/test/render_partial_inside_directory.html.erb +1 -0
- data/actionview/test/fixtures/actionpack/test/render_to_string_test.erb +1 -0
- data/actionview/test/fixtures/actionpack/test/render_two_partials.html.erb +2 -0
- data/actionview/test/fixtures/actionpack/test/using_layout_around_block.html.erb +1 -0
- data/actionview/test/fixtures/actionpack/test/with_html_partial.html.erb +1 -0
- data/actionview/test/fixtures/actionpack/test/with_partial.html.erb +1 -0
- data/actionview/test/fixtures/actionpack/test/with_partial.text.erb +1 -0
- data/actionview/test/fixtures/actionpack/test/with_xml_template.html.erb +1 -0
- data/actionview/test/fixtures/comments/empty.de.html.erb +1 -0
- data/actionview/test/fixtures/comments/empty.html+grid.erb +1 -0
- data/actionview/test/fixtures/comments/empty.html.builder +1 -0
- data/actionview/test/fixtures/comments/empty.html.erb +1 -0
- data/actionview/test/fixtures/comments/empty.xml.erb +1 -0
- data/actionview/test/fixtures/companies.yml +24 -0
- data/actionview/test/fixtures/company.rb +11 -0
- data/actionview/test/fixtures/custom_pattern/another.html.erb +1 -0
- data/actionview/test/fixtures/custom_pattern/html/another.erb +1 -0
- data/actionview/test/fixtures/custom_pattern/html/path.erb +1 -0
- data/actionview/test/fixtures/customers/_customer.html.erb +1 -0
- data/actionview/test/fixtures/customers/_customer.xml.erb +1 -0
- data/actionview/test/fixtures/db_definitions/sqlite.sql +49 -0
- data/actionview/test/fixtures/developer.rb +8 -0
- data/actionview/test/fixtures/developers.yml +21 -0
- data/actionview/test/fixtures/developers/_developer.erb +1 -0
- data/actionview/test/fixtures/developers_projects.yml +13 -0
- data/actionview/test/fixtures/digestor/api/comments/_comment.json.erb +1 -0
- data/actionview/test/fixtures/digestor/api/comments/_comments.json.erb +1 -0
- data/actionview/test/fixtures/digestor/comments/_comment.html.erb +1 -0
- data/actionview/test/fixtures/digestor/comments/_comments.html.erb +1 -0
- data/actionview/test/fixtures/digestor/events/_completed.html.erb +0 -0
- data/actionview/test/fixtures/digestor/events/_event.html.erb +0 -0
- data/actionview/test/fixtures/digestor/events/index.html.erb +1 -0
- data/actionview/test/fixtures/digestor/level/_recursion.html.erb +1 -0
- data/actionview/test/fixtures/digestor/level/below/_header.html.erb +0 -0
- data/actionview/test/fixtures/digestor/level/below/index.html.erb +1 -0
- data/actionview/test/fixtures/digestor/level/recursion.html.erb +1 -0
- data/actionview/test/fixtures/digestor/messages/_form.html.erb +0 -0
- data/actionview/test/fixtures/digestor/messages/_header.html.erb +0 -0
- data/actionview/test/fixtures/digestor/messages/_message.html.erb +1 -0
- data/actionview/test/fixtures/digestor/messages/actions/_move.html.erb +0 -0
- data/actionview/test/fixtures/digestor/messages/edit.html.erb +5 -0
- data/actionview/test/fixtures/digestor/messages/index.html.erb +2 -0
- data/actionview/test/fixtures/digestor/messages/new.html+iphone.erb +15 -0
- data/actionview/test/fixtures/digestor/messages/peek.html.erb +2 -0
- data/actionview/test/fixtures/digestor/messages/show.html.erb +14 -0
- data/actionview/test/fixtures/digestor/messages/thread.json.erb +1 -0
- data/actionview/test/fixtures/fun/games/_game.erb +1 -0
- data/actionview/test/fixtures/fun/games/hello_world.erb +1 -0
- data/actionview/test/fixtures/fun/serious/games/_game.erb +1 -0
- data/actionview/test/fixtures/games/_game.erb +1 -0
- data/actionview/test/fixtures/good_customers/_good_customer.html.erb +1 -0
- data/actionview/test/fixtures/helpers/abc_helper.rb +5 -0
- data/actionview/test/fixtures/helpers/helpery_test_helper.rb +7 -0
- data/actionview/test/fixtures/helpers_missing/invalid_require_helper.rb +6 -0
- data/actionview/test/fixtures/layout_tests/alt/hello.erb +1 -0
- data/actionview/test/fixtures/layouts/_column.html.erb +2 -0
- data/actionview/test/fixtures/layouts/_customers.erb +1 -0
- data/actionview/test/fixtures/layouts/_partial_and_yield.erb +2 -0
- data/actionview/test/fixtures/layouts/_yield_only.erb +1 -0
- data/actionview/test/fixtures/layouts/_yield_with_params.erb +1 -0
- data/actionview/test/fixtures/layouts/render_partial_html.erb +2 -0
- data/actionview/test/fixtures/layouts/streaming.erb +4 -0
- data/actionview/test/fixtures/layouts/streaming_with_capture.erb +6 -0
- data/actionview/test/fixtures/layouts/yield.erb +2 -0
- data/actionview/test/fixtures/layouts/yield_with_render_inline_inside.erb +2 -0
- data/actionview/test/fixtures/layouts/yield_with_render_partial_inside.erb +2 -0
- data/actionview/test/fixtures/mascot.rb +5 -0
- data/actionview/test/fixtures/mascots.yml +4 -0
- data/actionview/test/fixtures/mascots/_mascot.html.erb +1 -0
- data/actionview/test/fixtures/override/test/hello_world.erb +1 -0
- data/actionview/test/fixtures/override2/layouts/test/sub.erb +1 -0
- data/actionview/test/fixtures/plain_text.raw +1 -0
- data/actionview/test/fixtures/plain_text_with_characters.raw +1 -0
- data/actionview/test/fixtures/project.rb +9 -0
- data/actionview/test/fixtures/projects.yml +7 -0
- data/actionview/test/fixtures/projects/_project.erb +1 -0
- data/actionview/test/fixtures/public/.gitignore +1 -0
- data/actionview/test/fixtures/public/elsewhere/cools.js +1 -0
- data/actionview/test/fixtures/public/elsewhere/file.css +1 -0
- data/actionview/test/fixtures/public/foo/baz.css +3 -0
- data/actionview/test/fixtures/public/javascripts/application.js +1 -0
- data/actionview/test/fixtures/public/javascripts/bank.js +1 -0
- data/actionview/test/fixtures/public/javascripts/common.javascript +1 -0
- data/actionview/test/fixtures/public/javascripts/controls.js +1 -0
- data/actionview/test/fixtures/public/javascripts/dragdrop.js +1 -0
- data/actionview/test/fixtures/public/javascripts/effects.js +1 -0
- data/actionview/test/fixtures/public/javascripts/prototype.js +1 -0
- data/actionview/test/fixtures/public/javascripts/robber.js +1 -0
- data/actionview/test/fixtures/public/javascripts/subdir/subdir.js +1 -0
- data/actionview/test/fixtures/public/javascripts/version.1.0.js +1 -0
- data/actionview/test/fixtures/public/stylesheets/bank.css +1 -0
- data/actionview/test/fixtures/public/stylesheets/random.styles +1 -0
- data/actionview/test/fixtures/public/stylesheets/robber.css +1 -0
- data/actionview/test/fixtures/public/stylesheets/subdir/subdir.css +1 -0
- data/actionview/test/fixtures/public/stylesheets/version.1.0.css +1 -0
- data/actionview/test/fixtures/replies.yml +15 -0
- data/actionview/test/fixtures/replies/_reply.erb +1 -0
- data/actionview/test/fixtures/reply.rb +9 -0
- data/actionview/test/fixtures/respond_to/using_defaults_with_all.html.erb +1 -0
- data/actionview/test/fixtures/ruby_template.ruby +2 -0
- data/actionview/test/fixtures/shared.html.erb +1 -0
- data/actionview/test/fixtures/test/_200.html.erb +1 -0
- data/actionview/test/fixtures/test/_FooBar.html.erb +1 -0
- data/actionview/test/fixtures/test/_a-in.html.erb +0 -0
- data/actionview/test/fixtures/test/_b_layout_for_partial.html.erb +1 -0
- data/actionview/test/fixtures/test/_b_layout_for_partial_with_object.html.erb +1 -0
- data/actionview/test/fixtures/test/_b_layout_for_partial_with_object_counter.html.erb +1 -0
- data/actionview/test/fixtures/test/_builder_tag_nested_in_content_tag.erb +3 -0
- data/actionview/test/fixtures/test/_cached_customer.erb +3 -0
- data/actionview/test/fixtures/test/_cached_customer_as.erb +3 -0
- data/actionview/test/fixtures/test/_cached_nested_cached_customer.erb +3 -0
- data/actionview/test/fixtures/test/_changing_priority.html.erb +1 -0
- data/actionview/test/fixtures/test/_changing_priority.json.erb +1 -0
- data/actionview/test/fixtures/test/_content_tag_nested_in_content_tag.erb +3 -0
- data/actionview/test/fixtures/test/_counter.html.erb +1 -0
- data/actionview/test/fixtures/test/_customer.erb +1 -0
- data/actionview/test/fixtures/test/_customer.mobile.erb +1 -0
- data/actionview/test/fixtures/test/_customer_greeting.erb +1 -0
- data/actionview/test/fixtures/test/_customer_with_var.erb +1 -0
- data/actionview/test/fixtures/test/_directory/_partial_with_locales.html.erb +1 -0
- data/actionview/test/fixtures/test/_first_json_partial.json.erb +1 -0
- data/actionview/test/fixtures/test/_from_helper.erb +1 -0
- data/actionview/test/fixtures/test/_json_change_priority.json.erb +0 -0
- data/actionview/test/fixtures/test/_klass.erb +1 -0
- data/actionview/test/fixtures/test/_label_with_block.erb +4 -0
- data/actionview/test/fixtures/test/_layout_for_block_with_args.html.erb +3 -0
- data/actionview/test/fixtures/test/_layout_for_partial.html.erb +3 -0
- data/actionview/test/fixtures/test/_layout_with_partial_and_yield.html.erb +4 -0
- data/actionview/test/fixtures/test/_local_inspector.html.erb +1 -0
- data/actionview/test/fixtures/test/_nested_cached_customer.erb +1 -0
- data/actionview/test/fixtures/test/_object_inspector.erb +1 -0
- data/actionview/test/fixtures/test/_one.html.erb +1 -0
- data/actionview/test/fixtures/test/_partial.erb +1 -0
- data/actionview/test/fixtures/test/_partial.html.erb +1 -0
- data/actionview/test/fixtures/test/_partial.js.erb +1 -0
- data/actionview/test/fixtures/test/_partial_for_use_in_layout.html.erb +1 -0
- data/actionview/test/fixtures/test/_partial_iteration_1.erb +1 -0
- data/actionview/test/fixtures/test/_partial_iteration_2.erb +1 -0
- data/actionview/test/fixtures/test/_partial_name_in_local_assigns.erb +1 -0
- data/actionview/test/fixtures/test/_partial_name_local_variable.erb +1 -0
- data/actionview/test/fixtures/test/_partial_only.erb +1 -0
- data/actionview/test/fixtures/test/_partial_shortcut_with_block_content.html.erb +3 -0
- data/actionview/test/fixtures/test/_partial_with_layout.erb +2 -0
- data/actionview/test/fixtures/test/_partial_with_layout_block_content.erb +4 -0
- data/actionview/test/fixtures/test/_partial_with_layout_block_partial.erb +4 -0
- data/actionview/test/fixtures/test/_partial_with_only_html_version.html.erb +1 -0
- data/actionview/test/fixtures/test/_partial_with_partial.erb +2 -0
- data/actionview/test/fixtures/test/_partial_with_variants.html+grid.erb +1 -0
- data/actionview/test/fixtures/test/_partialhtml.html +1 -0
- data/actionview/test/fixtures/test/_raise.html.erb +1 -0
- data/actionview/test/fixtures/test/_raise_indentation.html.erb +13 -0
- data/actionview/test/fixtures/test/_second_json_partial.json.erb +1 -0
- data/actionview/test/fixtures/test/_two.html.erb +1 -0
- data/actionview/test/fixtures/test/_utf8_partial.html.erb +1 -0
- data/actionview/test/fixtures/test/_utf8_partial_magic.html.erb +2 -0
- data/actionview/test/fixtures/test/_/360/237/215/243.erb +1 -0
- data/actionview/test/fixtures/test/basic.html.erb +1 -0
- data/actionview/test/fixtures/test/calling_partial_with_layout.html.erb +1 -0
- data/actionview/test/fixtures/test/change_priority.html.erb +2 -0
- data/actionview/test/fixtures/test/dont_pick_me +1 -0
- data/actionview/test/fixtures/test/dot.directory/render_file_with_ivar.erb +1 -0
- data/actionview/test/fixtures/test/greeting.xml.erb +1 -0
- data/actionview/test/fixtures/test/hello.builder +4 -0
- data/actionview/test/fixtures/test/hello/hello.erb +1 -0
- data/actionview/test/fixtures/test/hello_world.da.html.erb +1 -0
- data/actionview/test/fixtures/test/hello_world.erb +1 -0
- data/actionview/test/fixtures/test/hello_world.erb~ +1 -0
- data/actionview/test/fixtures/test/hello_world.html+phone.erb +1 -0
- data/actionview/test/fixtures/test/hello_world.pt-BR.html.erb +1 -0
- data/actionview/test/fixtures/test/hello_world.text+phone.erb +1 -0
- data/actionview/test/fixtures/test/hello_world_with_partial.html.erb +2 -0
- data/actionview/test/fixtures/test/html_template.html.erb +1 -0
- data/actionview/test/fixtures/test/layout_render_file.erb +2 -0
- data/actionview/test/fixtures/test/layout_render_object.erb +1 -0
- data/actionview/test/fixtures/test/list.erb +1 -0
- data/actionview/test/fixtures/test/malformed/malformed.en.html.erb~ +1 -0
- data/actionview/test/fixtures/test/malformed/malformed.erb~ +1 -0
- data/actionview/test/fixtures/test/malformed/malformed.html.erb~ +1 -0
- data/actionview/test/fixtures/test/malformed/malformed~ +1 -0
- data/actionview/test/fixtures/test/nested_layout.erb +3 -0
- data/actionview/test/fixtures/test/nested_streaming.erb +3 -0
- data/actionview/test/fixtures/test/nil_return.erb +1 -0
- data/actionview/test/fixtures/test/one.html.erb +1 -0
- data/actionview/test/fixtures/test/render_file_inspect_local_assigns.erb +1 -0
- data/actionview/test/fixtures/test/render_file_instance_variable.erb +1 -0
- data/actionview/test/fixtures/test/render_file_unicode_local.erb +1 -0
- data/actionview/test/fixtures/test/render_file_with_ivar.erb +1 -0
- data/actionview/test/fixtures/test/render_file_with_locals.erb +1 -0
- data/actionview/test/fixtures/test/render_file_with_locals_and_default.erb +1 -0
- data/actionview/test/fixtures/test/render_file_with_ruby_keyword_locals.erb +1 -0
- data/actionview/test/fixtures/test/render_partial_inside_directory.html.erb +1 -0
- data/actionview/test/fixtures/test/render_two_partials.html.erb +2 -0
- data/actionview/test/fixtures/test/streaming.erb +3 -0
- data/actionview/test/fixtures/test/streaming_buster.erb +3 -0
- data/actionview/test/fixtures/test/sub_template_raise.html.erb +1 -0
- data/actionview/test/fixtures/test/template.erb +1 -0
- data/actionview/test/fixtures/test/test_template_with_delegation_reserved_keywords.erb +1 -0
- data/actionview/test/fixtures/test/update_element_with_capture.erb +9 -0
- data/actionview/test/fixtures/test/utf8.html.erb +4 -0
- data/actionview/test/fixtures/test/utf8_magic.html.erb +5 -0
- data/actionview/test/fixtures/test/utf8_magic_with_bare_partial.html.erb +5 -0
- data/actionview/test/fixtures/topic.rb +5 -0
- data/actionview/test/fixtures/topics.yml +22 -0
- data/actionview/test/fixtures/topics/_topic.html.erb +1 -0
- data/actionview/test/fixtures/translations/templates/array.erb +1 -0
- data/actionview/test/fixtures/translations/templates/default.erb +1 -0
- data/actionview/test/fixtures/translations/templates/found.erb +1 -0
- data/actionview/test/fixtures/translations/templates/missing.erb +1 -0
- data/actionview/test/fixtures/with_format.json.erb +1 -0
- data/actionview/test/lib/controller/fake_models.rb +204 -0
- data/actionview/test/template/active_model_helper_test.rb +100 -0
- data/actionview/test/template/asset_tag_helper_test.rb +831 -0
- data/actionview/test/template/atom_feed_helper_test.rb +375 -0
- data/actionview/test/template/capture_helper_test.rb +228 -0
- data/actionview/test/template/compiled_templates_test.rb +94 -0
- data/actionview/test/template/controller_helper_test.rb +34 -0
- data/actionview/test/template/date_helper_i18n_test.rb +166 -0
- data/actionview/test/template/date_helper_test.rb +3642 -0
- data/actionview/test/template/dependency_tracker_test.rb +195 -0
- data/actionview/test/template/digestor_test.rb +388 -0
- data/actionview/test/template/erb/deprecated_erubis_implementation_test.rb +15 -0
- data/actionview/test/template/erb/form_for_test.rb +13 -0
- data/actionview/test/template/erb/helper.rb +26 -0
- data/actionview/test/template/erb/tag_helper_test.rb +32 -0
- data/actionview/test/template/erb_util_test.rb +114 -0
- data/actionview/test/template/form_collections_helper_test.rb +527 -0
- data/actionview/test/template/form_helper/form_with_test.rb +2239 -0
- data/actionview/test/template/form_helper_test.rb +3522 -0
- data/actionview/test/template/form_options_helper_i18n_test.rb +30 -0
- data/actionview/test/template/form_options_helper_test.rb +1417 -0
- data/actionview/test/template/form_tag_helper_test.rb +785 -0
- data/actionview/test/template/html_test.rb +19 -0
- data/actionview/test/template/javascript_helper_test.rb +64 -0
- data/actionview/test/template/log_subscriber_test.rb +224 -0
- data/actionview/test/template/lookup_context_test.rb +289 -0
- data/actionview/test/template/number_helper_test.rb +204 -0
- data/actionview/test/template/output_safety_helper_test.rb +119 -0
- data/actionview/test/template/partial_iteration_test.rb +35 -0
- data/actionview/test/template/record_identifier_test.rb +93 -0
- data/actionview/test/template/record_tag_helper_test.rb +33 -0
- data/actionview/test/template/render_test.rb +725 -0
- data/actionview/test/template/resolver_cache_test.rb +9 -0
- data/actionview/test/template/resolver_patterns_test.rb +44 -0
- data/actionview/test/template/sanitize_helper_test.rb +43 -0
- data/actionview/test/template/streaming_render_test.rb +113 -0
- data/actionview/test/template/tag_helper_test.rb +357 -0
- data/actionview/test/template/template_error_test.rb +37 -0
- data/actionview/test/template/template_test.rb +207 -0
- data/actionview/test/template/test_case_test.rb +335 -0
- data/actionview/test/template/test_test.rb +94 -0
- data/actionview/test/template/testing/fixture_resolver_test.rb +20 -0
- data/actionview/test/template/testing/null_resolver_test.rb +14 -0
- data/actionview/test/template/text_helper_test.rb +535 -0
- data/actionview/test/template/text_test.rb +25 -0
- data/actionview/test/template/translation_helper_test.rb +238 -0
- data/actionview/test/template/url_helper_test.rb +969 -0
- data/actionview/test/ujs/.gitignore +1 -0
- data/actionview/test/ujs/config.ru +6 -0
- data/actionview/test/ujs/public/test/.eslintrc.yml +21 -0
- data/actionview/test/ujs/public/test/call-remote-callbacks.js +273 -0
- data/actionview/test/ujs/public/test/call-remote.js +275 -0
- data/actionview/test/ujs/public/test/csrf-refresh.js +24 -0
- data/actionview/test/ujs/public/test/csrf-token.js +27 -0
- data/actionview/test/ujs/public/test/data-confirm.js +316 -0
- data/actionview/test/ujs/public/test/data-disable-with.js +391 -0
- data/actionview/test/ujs/public/test/data-disable.js +321 -0
- data/actionview/test/ujs/public/test/data-method.js +85 -0
- data/actionview/test/ujs/public/test/data-remote.js +438 -0
- data/actionview/test/ujs/public/test/override.js +56 -0
- data/actionview/test/ujs/public/test/settings.js +116 -0
- data/actionview/test/ujs/public/vendor/jquery-2.2.0.js +9831 -0
- data/actionview/test/ujs/public/vendor/jquery.metadata.js +122 -0
- data/actionview/test/ujs/public/vendor/qunit.css +237 -0
- data/actionview/test/ujs/public/vendor/qunit.js +2288 -0
- data/actionview/test/ujs/server.rb +74 -0
- data/actionview/test/ujs/views/layouts/application.html.erb +25 -0
- data/actionview/test/ujs/views/tests/index.html.erb +11 -0
- data/activejob/CHANGELOG.md +8 -0
- data/activejob/MIT-LICENSE +21 -0
- data/activejob/README.md +126 -0
- data/activejob/Rakefile +79 -0
- data/activejob/activejob.gemspec +30 -0
- data/activejob/bin/test +5 -0
- data/activejob/lib/active_job.rb +39 -0
- data/activejob/lib/active_job/arguments.rb +156 -0
- data/activejob/lib/active_job/base.rb +74 -0
- data/activejob/lib/active_job/callbacks.rb +155 -0
- data/activejob/lib/active_job/configured_job.rb +18 -0
- data/activejob/lib/active_job/core.rb +140 -0
- data/activejob/lib/active_job/enqueuing.rb +59 -0
- data/activejob/lib/active_job/exceptions.rb +124 -0
- data/activejob/lib/active_job/execution.rb +49 -0
- data/activejob/lib/active_job/gem_version.rb +17 -0
- data/activejob/lib/active_job/logging.rb +130 -0
- data/activejob/lib/active_job/queue_adapter.rb +66 -0
- data/activejob/lib/active_job/queue_adapters.rb +139 -0
- data/activejob/lib/active_job/queue_adapters/async_adapter.rb +116 -0
- data/activejob/lib/active_job/queue_adapters/backburner_adapter.rb +36 -0
- data/activejob/lib/active_job/queue_adapters/delayed_job_adapter.rb +43 -0
- data/activejob/lib/active_job/queue_adapters/inline_adapter.rb +23 -0
- data/activejob/lib/active_job/queue_adapters/qu_adapter.rb +46 -0
- data/activejob/lib/active_job/queue_adapters/que_adapter.rb +39 -0
- data/activejob/lib/active_job/queue_adapters/queue_classic_adapter.rb +58 -0
- data/activejob/lib/active_job/queue_adapters/resque_adapter.rb +53 -0
- data/activejob/lib/active_job/queue_adapters/sidekiq_adapter.rb +47 -0
- data/activejob/lib/active_job/queue_adapters/sneakers_adapter.rb +48 -0
- data/activejob/lib/active_job/queue_adapters/sucker_punch_adapter.rb +49 -0
- data/activejob/lib/active_job/queue_adapters/test_adapter.rb +67 -0
- data/activejob/lib/active_job/queue_name.rb +49 -0
- data/activejob/lib/active_job/queue_priority.rb +43 -0
- data/activejob/lib/active_job/railtie.rb +34 -0
- data/activejob/lib/active_job/test_case.rb +11 -0
- data/activejob/lib/active_job/test_helper.rb +448 -0
- data/activejob/lib/active_job/translation.rb +13 -0
- data/activejob/lib/active_job/version.rb +10 -0
- data/activejob/lib/rails/generators/job/job_generator.rb +40 -0
- data/activejob/lib/rails/generators/job/templates/application_job.rb +9 -0
- data/activejob/lib/rails/generators/job/templates/job.rb +9 -0
- data/activejob/test/adapters/async.rb +4 -0
- data/activejob/test/adapters/backburner.rb +5 -0
- data/activejob/test/adapters/delayed_job.rb +8 -0
- data/activejob/test/adapters/inline.rb +3 -0
- data/activejob/test/adapters/qu.rb +5 -0
- data/activejob/test/adapters/que.rb +6 -0
- data/activejob/test/adapters/queue_classic.rb +4 -0
- data/activejob/test/adapters/resque.rb +4 -0
- data/activejob/test/adapters/sidekiq.rb +4 -0
- data/activejob/test/adapters/sneakers.rb +4 -0
- data/activejob/test/adapters/sucker_punch.rb +4 -0
- data/activejob/test/adapters/test.rb +5 -0
- data/activejob/test/cases/adapter_test.rb +9 -0
- data/activejob/test/cases/argument_serialization_test.rb +113 -0
- data/activejob/test/cases/callbacks_test.rb +25 -0
- data/activejob/test/cases/exceptions_test.rb +109 -0
- data/activejob/test/cases/job_serialization_test.rb +57 -0
- data/activejob/test/cases/logging_test.rb +137 -0
- data/activejob/test/cases/queue_adapter_test.rb +51 -0
- data/activejob/test/cases/queue_naming_test.rb +104 -0
- data/activejob/test/cases/queue_priority_test.rb +49 -0
- data/activejob/test/cases/queuing_test.rb +44 -0
- data/activejob/test/cases/rescue_test.rb +36 -0
- data/activejob/test/cases/test_case_test.rb +25 -0
- data/activejob/test/cases/test_helper_test.rb +929 -0
- data/activejob/test/cases/translation_test.rb +22 -0
- data/activejob/test/helper.rb +18 -0
- data/activejob/test/integration/queuing_test.rb +117 -0
- data/activejob/test/jobs/application_job.rb +4 -0
- data/activejob/test/jobs/callback_job.rb +29 -0
- data/activejob/test/jobs/gid_job.rb +9 -0
- data/activejob/test/jobs/hello_job.rb +9 -0
- data/activejob/test/jobs/inherited_job.rb +7 -0
- data/activejob/test/jobs/kwargs_job.rb +9 -0
- data/activejob/test/jobs/logging_job.rb +11 -0
- data/activejob/test/jobs/nested_job.rb +11 -0
- data/activejob/test/jobs/overridden_logging_job.rb +11 -0
- data/activejob/test/jobs/provider_jid_job.rb +9 -0
- data/activejob/test/jobs/queue_adapter_job.rb +5 -0
- data/activejob/test/jobs/queue_as_job.rb +12 -0
- data/activejob/test/jobs/rescue_job.rb +29 -0
- data/activejob/test/jobs/retry_job.rb +31 -0
- data/activejob/test/jobs/translated_hello_job.rb +12 -0
- data/activejob/test/models/person.rb +22 -0
- data/activejob/test/support/backburner/inline.rb +10 -0
- data/activejob/test/support/delayed_job/delayed/backend/test.rb +112 -0
- data/activejob/test/support/delayed_job/delayed/serialization/test.rb +0 -0
- data/activejob/test/support/integration/adapters/async.rb +12 -0
- data/activejob/test/support/integration/adapters/backburner.rb +39 -0
- data/activejob/test/support/integration/adapters/delayed_job.rb +23 -0
- data/activejob/test/support/integration/adapters/inline.rb +16 -0
- data/activejob/test/support/integration/adapters/qu.rb +40 -0
- data/activejob/test/support/integration/adapters/que.rb +41 -0
- data/activejob/test/support/integration/adapters/queue_classic.rb +39 -0
- data/activejob/test/support/integration/adapters/resque.rb +51 -0
- data/activejob/test/support/integration/adapters/sidekiq.rb +104 -0
- data/activejob/test/support/integration/adapters/sneakers.rb +90 -0
- data/activejob/test/support/integration/adapters/sucker_punch.rb +8 -0
- data/activejob/test/support/integration/dummy_app_template.rb +32 -0
- data/activejob/test/support/integration/helper.rb +33 -0
- data/activejob/test/support/integration/jobs_manager.rb +29 -0
- data/activejob/test/support/integration/test_case_helpers.rb +65 -0
- data/activejob/test/support/job_buffer.rb +21 -0
- data/activejob/test/support/que/inline.rb +16 -0
- data/activejob/test/support/queue_classic/inline.rb +25 -0
- data/activejob/test/support/sneakers/inline.rb +14 -0
- data/activemodel/CHANGELOG.md +41 -0
- data/activemodel/MIT-LICENSE +21 -0
- data/activemodel/README.rdoc +264 -0
- data/activemodel/Rakefile +23 -0
- data/activemodel/activemodel.gemspec +29 -0
- data/activemodel/bin/test +5 -0
- data/activemodel/lib/active_model.rb +74 -0
- data/activemodel/lib/active_model/attribute_assignment.rb +55 -0
- data/activemodel/lib/active_model/attribute_methods.rb +478 -0
- data/activemodel/lib/active_model/callbacks.rb +153 -0
- data/activemodel/lib/active_model/conversion.rb +111 -0
- data/activemodel/lib/active_model/dirty.rb +274 -0
- data/activemodel/lib/active_model/errors.rb +513 -0
- data/activemodel/lib/active_model/forbidden_attributes_protection.rb +31 -0
- data/activemodel/lib/active_model/gem_version.rb +17 -0
- data/activemodel/lib/active_model/lint.rb +118 -0
- data/activemodel/lib/active_model/locale/en.yml +36 -0
- data/activemodel/lib/active_model/model.rb +99 -0
- data/activemodel/lib/active_model/naming.rb +318 -0
- data/activemodel/lib/active_model/railtie.rb +14 -0
- data/activemodel/lib/active_model/secure_password.rb +129 -0
- data/activemodel/lib/active_model/serialization.rb +192 -0
- data/activemodel/lib/active_model/serializers/json.rb +146 -0
- data/activemodel/lib/active_model/translation.rb +70 -0
- data/activemodel/lib/active_model/type.rb +49 -0
- data/activemodel/lib/active_model/type/big_integer.rb +15 -0
- data/activemodel/lib/active_model/type/binary.rb +52 -0
- data/activemodel/lib/active_model/type/boolean.rb +34 -0
- data/activemodel/lib/active_model/type/date.rb +56 -0
- data/activemodel/lib/active_model/type/date_time.rb +50 -0
- data/activemodel/lib/active_model/type/decimal.rb +70 -0
- data/activemodel/lib/active_model/type/float.rb +36 -0
- data/activemodel/lib/active_model/type/helpers.rb +6 -0
- data/activemodel/lib/active_model/type/helpers/accepts_multiparameter_time.rb +41 -0
- data/activemodel/lib/active_model/type/helpers/mutable.rb +20 -0
- data/activemodel/lib/active_model/type/helpers/numeric.rb +37 -0
- data/activemodel/lib/active_model/type/helpers/time_value.rb +79 -0
- data/activemodel/lib/active_model/type/immutable_string.rb +32 -0
- data/activemodel/lib/active_model/type/integer.rb +70 -0
- data/activemodel/lib/active_model/type/registry.rb +70 -0
- data/activemodel/lib/active_model/type/string.rb +26 -0
- data/activemodel/lib/active_model/type/time.rb +48 -0
- data/activemodel/lib/active_model/type/value.rb +122 -0
- data/activemodel/lib/active_model/validations.rb +439 -0
- data/activemodel/lib/active_model/validations/absence.rb +33 -0
- data/activemodel/lib/active_model/validations/acceptance.rb +106 -0
- data/activemodel/lib/active_model/validations/callbacks.rb +116 -0
- data/activemodel/lib/active_model/validations/clusivity.rb +54 -0
- data/activemodel/lib/active_model/validations/confirmation.rb +80 -0
- data/activemodel/lib/active_model/validations/exclusion.rb +49 -0
- data/activemodel/lib/active_model/validations/format.rb +114 -0
- data/activemodel/lib/active_model/validations/helper_methods.rb +15 -0
- data/activemodel/lib/active_model/validations/inclusion.rb +47 -0
- data/activemodel/lib/active_model/validations/length.rb +123 -0
- data/activemodel/lib/active_model/validations/numericality.rb +165 -0
- data/activemodel/lib/active_model/validations/presence.rb +39 -0
- data/activemodel/lib/active_model/validations/validates.rb +174 -0
- data/activemodel/lib/active_model/validations/with.rb +147 -0
- data/activemodel/lib/active_model/validator.rb +183 -0
- data/activemodel/lib/active_model/version.rb +10 -0
- data/activemodel/test/cases/attribute_assignment_test.rb +131 -0
- data/activemodel/test/cases/attribute_methods_test.rb +283 -0
- data/activemodel/test/cases/callbacks_test.rb +134 -0
- data/activemodel/test/cases/conversion_test.rb +52 -0
- data/activemodel/test/cases/dirty_test.rb +222 -0
- data/activemodel/test/cases/errors_test.rb +420 -0
- data/activemodel/test/cases/forbidden_attributes_protection_test.rb +44 -0
- data/activemodel/test/cases/helper.rb +25 -0
- data/activemodel/test/cases/lint_test.rb +22 -0
- data/activemodel/test/cases/model_test.rb +79 -0
- data/activemodel/test/cases/naming_test.rb +282 -0
- data/activemodel/test/cases/railtie_test.rb +34 -0
- data/activemodel/test/cases/secure_password_test.rb +220 -0
- data/activemodel/test/cases/serialization_test.rb +177 -0
- data/activemodel/test/cases/serializers/json_serialization_test.rb +204 -0
- data/activemodel/test/cases/translation_test.rb +113 -0
- data/activemodel/test/cases/type/big_integer_test.rb +26 -0
- data/activemodel/test/cases/type/binary_test.rb +17 -0
- data/activemodel/test/cases/type/boolean_test.rb +41 -0
- data/activemodel/test/cases/type/date_test.rb +21 -0
- data/activemodel/test/cases/type/date_time_test.rb +40 -0
- data/activemodel/test/cases/type/decimal_test.rb +74 -0
- data/activemodel/test/cases/type/float_test.rb +32 -0
- data/activemodel/test/cases/type/immutable_string_test.rb +23 -0
- data/activemodel/test/cases/type/integer_test.rb +118 -0
- data/activemodel/test/cases/type/registry_test.rb +43 -0
- data/activemodel/test/cases/type/string_test.rb +39 -0
- data/activemodel/test/cases/type/time_test.rb +23 -0
- data/activemodel/test/cases/type/value_test.rb +16 -0
- data/activemodel/test/cases/validations/absence_validation_test.rb +69 -0
- data/activemodel/test/cases/validations/acceptance_validation_test.rb +88 -0
- data/activemodel/test/cases/validations/callbacks_test.rb +145 -0
- data/activemodel/test/cases/validations/conditional_validation_test.rb +149 -0
- data/activemodel/test/cases/validations/confirmation_validation_test.rb +121 -0
- data/activemodel/test/cases/validations/exclusion_validation_test.rb +109 -0
- data/activemodel/test/cases/validations/format_validation_test.rb +149 -0
- data/activemodel/test/cases/validations/i18n_generate_message_validation_test.rb +152 -0
- data/activemodel/test/cases/validations/i18n_validation_test.rb +344 -0
- data/activemodel/test/cases/validations/inclusion_validation_test.rb +161 -0
- data/activemodel/test/cases/validations/length_validation_test.rb +413 -0
- data/activemodel/test/cases/validations/numericality_validation_test.rb +305 -0
- data/activemodel/test/cases/validations/presence_validation_test.rb +107 -0
- data/activemodel/test/cases/validations/validates_test.rb +159 -0
- data/activemodel/test/cases/validations/validations_context_test.rb +70 -0
- data/activemodel/test/cases/validations/with_validation_test.rb +185 -0
- data/activemodel/test/cases/validations_test.rb +465 -0
- data/activemodel/test/models/account.rb +7 -0
- data/activemodel/test/models/blog_post.rb +11 -0
- data/activemodel/test/models/contact.rb +42 -0
- data/activemodel/test/models/custom_reader.rb +17 -0
- data/activemodel/test/models/helicopter.rb +9 -0
- data/activemodel/test/models/person.rb +19 -0
- data/activemodel/test/models/person_with_validator.rb +26 -0
- data/activemodel/test/models/reply.rb +34 -0
- data/activemodel/test/models/sheep.rb +5 -0
- data/activemodel/test/models/topic.rb +41 -0
- data/activemodel/test/models/track_back.rb +13 -0
- data/activemodel/test/models/user.rb +12 -0
- data/activemodel/test/models/visitor.rb +12 -0
- data/activemodel/test/validators/email_validator.rb +8 -0
- data/activemodel/test/validators/namespace/email_validator.rb +8 -0
- data/activerecord/CHANGELOG.md +242 -0
- data/activerecord/MIT-LICENSE +20 -0
- data/activerecord/README.rdoc +217 -0
- data/activerecord/RUNNING_UNIT_TESTS.rdoc +51 -0
- data/activerecord/Rakefile +142 -0
- data/activerecord/activerecord.gemspec +35 -0
- data/activerecord/bin/test +20 -0
- data/activerecord/examples/.gitignore +1 -0
- data/activerecord/examples/performance.rb +185 -0
- data/activerecord/examples/simple.rb +15 -0
- data/activerecord/lib/active_record.rb +183 -0
- data/activerecord/lib/active_record/aggregations.rb +284 -0
- data/activerecord/lib/active_record/association_relation.rb +40 -0
- data/activerecord/lib/active_record/associations.rb +1885 -0
- data/activerecord/lib/active_record/associations/alias_tracker.rb +94 -0
- data/activerecord/lib/active_record/associations/association.rb +284 -0
- data/activerecord/lib/active_record/associations/association_scope.rb +181 -0
- data/activerecord/lib/active_record/associations/belongs_to_association.rb +113 -0
- data/activerecord/lib/active_record/associations/belongs_to_polymorphic_association.rb +42 -0
- data/activerecord/lib/active_record/associations/builder/association.rb +145 -0
- data/activerecord/lib/active_record/associations/builder/belongs_to.rb +150 -0
- data/activerecord/lib/active_record/associations/builder/collection_association.rb +82 -0
- data/activerecord/lib/active_record/associations/builder/has_and_belongs_to_many.rb +135 -0
- data/activerecord/lib/active_record/associations/builder/has_many.rb +17 -0
- data/activerecord/lib/active_record/associations/builder/has_one.rb +30 -0
- data/activerecord/lib/active_record/associations/builder/singular_association.rb +42 -0
- data/activerecord/lib/active_record/associations/collection_association.rb +505 -0
- data/activerecord/lib/active_record/associations/collection_proxy.rb +1159 -0
- data/activerecord/lib/active_record/associations/foreign_association.rb +13 -0
- data/activerecord/lib/active_record/associations/has_many_association.rb +135 -0
- data/activerecord/lib/active_record/associations/has_many_through_association.rb +216 -0
- data/activerecord/lib/active_record/associations/has_one_association.rb +111 -0
- data/activerecord/lib/active_record/associations/has_one_through_association.rb +42 -0
- data/activerecord/lib/active_record/associations/join_dependency.rb +287 -0
- data/activerecord/lib/active_record/associations/join_dependency/join_association.rb +61 -0
- data/activerecord/lib/active_record/associations/join_dependency/join_base.rb +23 -0
- data/activerecord/lib/active_record/associations/join_dependency/join_part.rb +64 -0
- data/activerecord/lib/active_record/associations/preloader.rb +204 -0
- data/activerecord/lib/active_record/associations/preloader/association.rb +133 -0
- data/activerecord/lib/active_record/associations/preloader/belongs_to.rb +17 -0
- data/activerecord/lib/active_record/associations/preloader/collection_association.rb +19 -0
- data/activerecord/lib/active_record/associations/preloader/has_many.rb +17 -0
- data/activerecord/lib/active_record/associations/preloader/has_many_through.rb +21 -0
- data/activerecord/lib/active_record/associations/preloader/has_one.rb +17 -0
- data/activerecord/lib/active_record/associations/preloader/has_one_through.rb +11 -0
- data/activerecord/lib/active_record/associations/preloader/singular_association.rb +20 -0
- data/activerecord/lib/active_record/associations/preloader/through_association.rb +111 -0
- data/activerecord/lib/active_record/associations/singular_association.rb +79 -0
- data/activerecord/lib/active_record/associations/through_association.rb +108 -0
- data/activerecord/lib/active_record/attribute.rb +242 -0
- data/activerecord/lib/active_record/attribute/user_provided_default.rb +32 -0
- data/activerecord/lib/active_record/attribute_assignment.rb +93 -0
- data/activerecord/lib/active_record/attribute_decorators.rb +90 -0
- data/activerecord/lib/active_record/attribute_methods.rb +449 -0
- data/activerecord/lib/active_record/attribute_methods/before_type_cast.rb +78 -0
- data/activerecord/lib/active_record/attribute_methods/dirty.rb +251 -0
- data/activerecord/lib/active_record/attribute_methods/primary_key.rb +141 -0
- data/activerecord/lib/active_record/attribute_methods/query.rb +42 -0
- data/activerecord/lib/active_record/attribute_methods/read.rb +84 -0
- data/activerecord/lib/active_record/attribute_methods/serialization.rb +90 -0
- data/activerecord/lib/active_record/attribute_methods/time_zone_conversion.rb +91 -0
- data/activerecord/lib/active_record/attribute_methods/write.rb +67 -0
- data/activerecord/lib/active_record/attribute_mutation_tracker.rb +111 -0
- data/activerecord/lib/active_record/attribute_set.rb +113 -0
- data/activerecord/lib/active_record/attribute_set/builder.rb +126 -0
- data/activerecord/lib/active_record/attribute_set/yaml_encoder.rb +43 -0
- data/activerecord/lib/active_record/attributes.rb +266 -0
- data/activerecord/lib/active_record/autosave_association.rb +490 -0
- data/activerecord/lib/active_record/base.rb +329 -0
- data/activerecord/lib/active_record/callbacks.rb +349 -0
- data/activerecord/lib/active_record/coders/json.rb +15 -0
- data/activerecord/lib/active_record/coders/yaml_column.rb +50 -0
- data/activerecord/lib/active_record/collection_cache_key.rb +51 -0
- data/activerecord/lib/active_record/connection_adapters/abstract/connection_pool.rb +990 -0
- data/activerecord/lib/active_record/connection_adapters/abstract/database_limits.rb +67 -0
- data/activerecord/lib/active_record/connection_adapters/abstract/database_statements.rb +491 -0
- data/activerecord/lib/active_record/connection_adapters/abstract/query_cache.rb +140 -0
- data/activerecord/lib/active_record/connection_adapters/abstract/quoting.rb +216 -0
- data/activerecord/lib/active_record/connection_adapters/abstract/savepoints.rb +23 -0
- data/activerecord/lib/active_record/connection_adapters/abstract/schema_creation.rb +145 -0
- data/activerecord/lib/active_record/connection_adapters/abstract/schema_definitions.rb +654 -0
- data/activerecord/lib/active_record/connection_adapters/abstract/schema_dumper.rb +95 -0
- data/activerecord/lib/active_record/connection_adapters/abstract/schema_statements.rb +1378 -0
- data/activerecord/lib/active_record/connection_adapters/abstract/transaction.rb +274 -0
- data/activerecord/lib/active_record/connection_adapters/abstract_adapter.rb +599 -0
- data/activerecord/lib/active_record/connection_adapters/abstract_mysql_adapter.rb +885 -0
- data/activerecord/lib/active_record/connection_adapters/column.rb +91 -0
- data/activerecord/lib/active_record/connection_adapters/connection_specification.rb +275 -0
- data/activerecord/lib/active_record/connection_adapters/determine_if_preparable_visitor.rb +24 -0
- data/activerecord/lib/active_record/connection_adapters/mysql/column.rb +27 -0
- data/activerecord/lib/active_record/connection_adapters/mysql/database_statements.rb +97 -0
- data/activerecord/lib/active_record/connection_adapters/mysql/explain_pretty_printer.rb +72 -0
- data/activerecord/lib/active_record/connection_adapters/mysql/quoting.rb +44 -0
- data/activerecord/lib/active_record/connection_adapters/mysql/schema_creation.rb +73 -0
- data/activerecord/lib/active_record/connection_adapters/mysql/schema_definitions.rb +92 -0
- data/activerecord/lib/active_record/connection_adapters/mysql/schema_dumper.rb +73 -0
- data/activerecord/lib/active_record/connection_adapters/mysql/schema_statements.rb +139 -0
- data/activerecord/lib/active_record/connection_adapters/mysql/type_metadata.rb +35 -0
- data/activerecord/lib/active_record/connection_adapters/mysql2_adapter.rb +125 -0
- data/activerecord/lib/active_record/connection_adapters/postgresql/column.rb +17 -0
- data/activerecord/lib/active_record/connection_adapters/postgresql/database_statements.rb +163 -0
- data/activerecord/lib/active_record/connection_adapters/postgresql/explain_pretty_printer.rb +44 -0
- data/activerecord/lib/active_record/connection_adapters/postgresql/oid.rb +33 -0
- data/activerecord/lib/active_record/connection_adapters/postgresql/oid/array.rb +82 -0
- data/activerecord/lib/active_record/connection_adapters/postgresql/oid/bit.rb +56 -0
- data/activerecord/lib/active_record/connection_adapters/postgresql/oid/bit_varying.rb +15 -0
- data/activerecord/lib/active_record/connection_adapters/postgresql/oid/bytea.rb +17 -0
- data/activerecord/lib/active_record/connection_adapters/postgresql/oid/cidr.rb +50 -0
- data/activerecord/lib/active_record/connection_adapters/postgresql/oid/date_time.rb +23 -0
- data/activerecord/lib/active_record/connection_adapters/postgresql/oid/decimal.rb +15 -0
- data/activerecord/lib/active_record/connection_adapters/postgresql/oid/enum.rb +21 -0
- data/activerecord/lib/active_record/connection_adapters/postgresql/oid/hstore.rb +71 -0
- data/activerecord/lib/active_record/connection_adapters/postgresql/oid/inet.rb +15 -0
- data/activerecord/lib/active_record/connection_adapters/postgresql/oid/jsonb.rb +15 -0
- data/activerecord/lib/active_record/connection_adapters/postgresql/oid/legacy_point.rb +45 -0
- data/activerecord/lib/active_record/connection_adapters/postgresql/oid/money.rb +41 -0
- data/activerecord/lib/active_record/connection_adapters/postgresql/oid/oid.rb +15 -0
- data/activerecord/lib/active_record/connection_adapters/postgresql/oid/point.rb +65 -0
- data/activerecord/lib/active_record/connection_adapters/postgresql/oid/range.rb +93 -0
- data/activerecord/lib/active_record/connection_adapters/postgresql/oid/specialized_string.rb +18 -0
- data/activerecord/lib/active_record/connection_adapters/postgresql/oid/type_map_initializer.rb +111 -0
- data/activerecord/lib/active_record/connection_adapters/postgresql/oid/uuid.rb +23 -0
- data/activerecord/lib/active_record/connection_adapters/postgresql/oid/vector.rb +28 -0
- data/activerecord/lib/active_record/connection_adapters/postgresql/oid/xml.rb +30 -0
- data/activerecord/lib/active_record/connection_adapters/postgresql/quoting.rb +152 -0
- data/activerecord/lib/active_record/connection_adapters/postgresql/referential_integrity.rb +51 -0
- data/activerecord/lib/active_record/connection_adapters/postgresql/schema_creation.rb +17 -0
- data/activerecord/lib/active_record/connection_adapters/postgresql/schema_definitions.rb +195 -0
- data/activerecord/lib/active_record/connection_adapters/postgresql/schema_dumper.rb +38 -0
- data/activerecord/lib/active_record/connection_adapters/postgresql/schema_statements.rb +678 -0
- data/activerecord/lib/active_record/connection_adapters/postgresql/type_metadata.rb +39 -0
- data/activerecord/lib/active_record/connection_adapters/postgresql/utils.rb +81 -0
- data/activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb +838 -0
- data/activerecord/lib/active_record/connection_adapters/schema_cache.rb +118 -0
- data/activerecord/lib/active_record/connection_adapters/sql_type_metadata.rb +34 -0
- data/activerecord/lib/active_record/connection_adapters/sqlite3/explain_pretty_printer.rb +21 -0
- data/activerecord/lib/active_record/connection_adapters/sqlite3/quoting.rb +62 -0
- data/activerecord/lib/active_record/connection_adapters/sqlite3/schema_creation.rb +17 -0
- data/activerecord/lib/active_record/connection_adapters/sqlite3/schema_definitions.rb +30 -0
- data/activerecord/lib/active_record/connection_adapters/sqlite3/schema_dumper.rb +18 -0
- data/activerecord/lib/active_record/connection_adapters/sqlite3/schema_statements.rb +102 -0
- data/activerecord/lib/active_record/connection_adapters/sqlite3_adapter.rb +531 -0
- data/activerecord/lib/active_record/connection_adapters/statement_pool.rb +61 -0
- data/activerecord/lib/active_record/connection_handling.rb +145 -0
- data/activerecord/lib/active_record/core.rb +560 -0
- data/activerecord/lib/active_record/counter_cache.rb +214 -0
- data/activerecord/lib/active_record/define_callbacks.rb +22 -0
- data/activerecord/lib/active_record/dynamic_matchers.rb +122 -0
- data/activerecord/lib/active_record/enum.rb +241 -0
- data/activerecord/lib/active_record/errors.rb +342 -0
- data/activerecord/lib/active_record/explain.rb +50 -0
- data/activerecord/lib/active_record/explain_registry.rb +32 -0
- data/activerecord/lib/active_record/explain_subscriber.rb +34 -0
- data/activerecord/lib/active_record/fixture_set/file.rb +82 -0
- data/activerecord/lib/active_record/fixtures.rb +1074 -0
- data/activerecord/lib/active_record/gem_version.rb +17 -0
- data/activerecord/lib/active_record/inheritance.rb +254 -0
- data/activerecord/lib/active_record/integration.rb +155 -0
- data/activerecord/lib/active_record/internal_metadata.rb +45 -0
- data/activerecord/lib/active_record/legacy_yaml_adapter.rb +48 -0
- data/activerecord/lib/active_record/locale/en.yml +48 -0
- data/activerecord/lib/active_record/locking/optimistic.rb +212 -0
- data/activerecord/lib/active_record/locking/pessimistic.rb +88 -0
- data/activerecord/lib/active_record/log_subscriber.rb +96 -0
- data/activerecord/lib/active_record/migration.rb +1340 -0
- data/activerecord/lib/active_record/migration/command_recorder.rb +240 -0
- data/activerecord/lib/active_record/migration/compatibility.rb +170 -0
- data/activerecord/lib/active_record/migration/join_table.rb +17 -0
- data/activerecord/lib/active_record/model_schema.rb +515 -0
- data/activerecord/lib/active_record/nested_attributes.rb +589 -0
- data/activerecord/lib/active_record/no_touching.rb +58 -0
- data/activerecord/lib/active_record/null_relation.rb +68 -0
- data/activerecord/lib/active_record/persistence.rb +623 -0
- data/activerecord/lib/active_record/query_cache.rb +49 -0
- data/activerecord/lib/active_record/querying.rb +70 -0
- data/activerecord/lib/active_record/railtie.rb +214 -0
- data/activerecord/lib/active_record/railties/console_sandbox.rb +7 -0
- data/activerecord/lib/active_record/railties/controller_runtime.rb +56 -0
- data/activerecord/lib/active_record/railties/databases.rake +369 -0
- data/activerecord/lib/active_record/railties/jdbcmysql_error.rb +18 -0
- data/activerecord/lib/active_record/readonly_attributes.rb +24 -0
- data/activerecord/lib/active_record/reflection.rb +1102 -0
- data/activerecord/lib/active_record/relation.rb +730 -0
- data/activerecord/lib/active_record/relation/batches.rb +280 -0
- data/activerecord/lib/active_record/relation/batches/batch_enumerator.rb +69 -0
- data/activerecord/lib/active_record/relation/calculations.rb +407 -0
- data/activerecord/lib/active_record/relation/delegation.rb +113 -0
- data/activerecord/lib/active_record/relation/finder_methods.rb +566 -0
- data/activerecord/lib/active_record/relation/from_clause.rb +26 -0
- data/activerecord/lib/active_record/relation/merger.rb +168 -0
- data/activerecord/lib/active_record/relation/predicate_builder.rb +133 -0
- data/activerecord/lib/active_record/relation/predicate_builder/array_handler.rb +48 -0
- data/activerecord/lib/active_record/relation/predicate_builder/association_query_value.rb +46 -0
- data/activerecord/lib/active_record/relation/predicate_builder/base_handler.rb +19 -0
- data/activerecord/lib/active_record/relation/predicate_builder/basic_object_handler.rb +20 -0
- data/activerecord/lib/active_record/relation/predicate_builder/polymorphic_array_value.rb +54 -0
- data/activerecord/lib/active_record/relation/predicate_builder/range_handler.rb +41 -0
- data/activerecord/lib/active_record/relation/predicate_builder/relation_handler.rb +15 -0
- data/activerecord/lib/active_record/relation/query_attribute.rb +26 -0
- data/activerecord/lib/active_record/relation/query_methods.rb +1194 -0
- data/activerecord/lib/active_record/relation/record_fetch_warning.rb +51 -0
- data/activerecord/lib/active_record/relation/spawn_methods.rb +77 -0
- data/activerecord/lib/active_record/relation/where_clause.rb +172 -0
- data/activerecord/lib/active_record/relation/where_clause_factory.rb +35 -0
- data/activerecord/lib/active_record/result.rb +149 -0
- data/activerecord/lib/active_record/runtime_registry.rb +24 -0
- data/activerecord/lib/active_record/sanitization.rb +216 -0
- data/activerecord/lib/active_record/schema.rb +70 -0
- data/activerecord/lib/active_record/schema_dumper.rb +254 -0
- data/activerecord/lib/active_record/schema_migration.rb +56 -0
- data/activerecord/lib/active_record/scoping.rb +106 -0
- data/activerecord/lib/active_record/scoping/default.rb +152 -0
- data/activerecord/lib/active_record/scoping/named.rb +199 -0
- data/activerecord/lib/active_record/secure_token.rb +40 -0
- data/activerecord/lib/active_record/serialization.rb +22 -0
- data/activerecord/lib/active_record/statement_cache.rb +121 -0
- data/activerecord/lib/active_record/store.rb +211 -0
- data/activerecord/lib/active_record/suppressor.rb +61 -0
- data/activerecord/lib/active_record/table_metadata.rb +75 -0
- data/activerecord/lib/active_record/tasks/database_tasks.rb +327 -0
- data/activerecord/lib/active_record/tasks/mysql_database_tasks.rb +162 -0
- data/activerecord/lib/active_record/tasks/postgresql_database_tasks.rb +143 -0
- data/activerecord/lib/active_record/tasks/sqlite_database_tasks.rb +83 -0
- data/activerecord/lib/active_record/timestamp.rb +146 -0
- data/activerecord/lib/active_record/touch_later.rb +64 -0
- data/activerecord/lib/active_record/transactions.rb +499 -0
- data/activerecord/lib/active_record/translation.rb +24 -0
- data/activerecord/lib/active_record/type.rb +79 -0
- data/activerecord/lib/active_record/type/adapter_specific_registry.rb +136 -0
- data/activerecord/lib/active_record/type/date.rb +9 -0
- data/activerecord/lib/active_record/type/date_time.rb +9 -0
- data/activerecord/lib/active_record/type/decimal_without_scale.rb +15 -0
- data/activerecord/lib/active_record/type/hash_lookup_type_map.rb +25 -0
- data/activerecord/lib/active_record/type/internal/timezone.rb +17 -0
- data/activerecord/lib/active_record/type/json.rb +30 -0
- data/activerecord/lib/active_record/type/serialized.rb +67 -0
- data/activerecord/lib/active_record/type/text.rb +11 -0
- data/activerecord/lib/active_record/type/time.rb +21 -0
- data/activerecord/lib/active_record/type/type_map.rb +62 -0
- data/activerecord/lib/active_record/type/unsigned_integer.rb +17 -0
- data/activerecord/lib/active_record/type_caster.rb +9 -0
- data/activerecord/lib/active_record/type_caster/connection.rb +33 -0
- data/activerecord/lib/active_record/type_caster/map.rb +23 -0
- data/activerecord/lib/active_record/validations.rb +93 -0
- data/activerecord/lib/active_record/validations/absence.rb +25 -0
- data/activerecord/lib/active_record/validations/associated.rb +60 -0
- data/activerecord/lib/active_record/validations/length.rb +26 -0
- data/activerecord/lib/active_record/validations/presence.rb +68 -0
- data/activerecord/lib/active_record/validations/uniqueness.rb +240 -0
- data/activerecord/lib/active_record/version.rb +10 -0
- data/activerecord/lib/rails/generators/active_record.rb +19 -0
- data/activerecord/lib/rails/generators/active_record/application_record/application_record_generator.rb +27 -0
- data/activerecord/lib/rails/generators/active_record/application_record/templates/application_record.rb +5 -0
- data/activerecord/lib/rails/generators/active_record/migration.rb +35 -0
- data/activerecord/lib/rails/generators/active_record/migration/migration_generator.rb +78 -0
- data/activerecord/lib/rails/generators/active_record/migration/templates/create_table_migration.rb +24 -0
- data/activerecord/lib/rails/generators/active_record/migration/templates/migration.rb +46 -0
- data/activerecord/lib/rails/generators/active_record/model/model_generator.rb +48 -0
- data/activerecord/lib/rails/generators/active_record/model/templates/model.rb +13 -0
- data/activerecord/lib/rails/generators/active_record/model/templates/module.rb +7 -0
- data/activerecord/test/.gitignore +1 -0
- data/activerecord/test/active_record/connection_adapters/fake_adapter.rb +51 -0
- data/activerecord/test/assets/example.log +1 -0
- data/activerecord/test/assets/flowers.jpg +0 -0
- data/activerecord/test/assets/schema_dump_5_1.yml +345 -0
- data/activerecord/test/assets/test.txt +1 -0
- data/activerecord/test/cases/adapter_test.rb +404 -0
- data/activerecord/test/cases/adapters/mysql2/active_schema_test.rb +195 -0
- data/activerecord/test/cases/adapters/mysql2/bind_parameter_test.rb +52 -0
- data/activerecord/test/cases/adapters/mysql2/boolean_test.rb +102 -0
- data/activerecord/test/cases/adapters/mysql2/case_sensitivity_test.rb +65 -0
- data/activerecord/test/cases/adapters/mysql2/charset_collation_test.rb +56 -0
- data/activerecord/test/cases/adapters/mysql2/connection_test.rb +225 -0
- data/activerecord/test/cases/adapters/mysql2/datetime_precision_quoting_test.rb +54 -0
- data/activerecord/test/cases/adapters/mysql2/enum_test.rb +23 -0
- data/activerecord/test/cases/adapters/mysql2/explain_test.rb +23 -0
- data/activerecord/test/cases/adapters/mysql2/json_test.rb +24 -0
- data/activerecord/test/cases/adapters/mysql2/mysql2_adapter_test.rb +77 -0
- data/activerecord/test/cases/adapters/mysql2/schema_migrations_test.rb +65 -0
- data/activerecord/test/cases/adapters/mysql2/schema_test.rb +128 -0
- data/activerecord/test/cases/adapters/mysql2/sp_test.rb +38 -0
- data/activerecord/test/cases/adapters/mysql2/sql_types_test.rb +16 -0
- data/activerecord/test/cases/adapters/mysql2/table_options_test.rb +44 -0
- data/activerecord/test/cases/adapters/mysql2/transaction_test.rb +69 -0
- data/activerecord/test/cases/adapters/mysql2/unsigned_type_test.rb +68 -0
- data/activerecord/test/cases/adapters/mysql2/virtual_column_test.rb +61 -0
- data/activerecord/test/cases/adapters/postgresql/active_schema_test.rb +100 -0
- data/activerecord/test/cases/adapters/postgresql/array_test.rb +388 -0
- data/activerecord/test/cases/adapters/postgresql/bit_string_test.rb +84 -0
- data/activerecord/test/cases/adapters/postgresql/bytea_test.rb +137 -0
- data/activerecord/test/cases/adapters/postgresql/case_insensitive_test.rb +28 -0
- data/activerecord/test/cases/adapters/postgresql/change_schema_test.rb +40 -0
- data/activerecord/test/cases/adapters/postgresql/cidr_test.rb +27 -0
- data/activerecord/test/cases/adapters/postgresql/citext_test.rb +80 -0
- data/activerecord/test/cases/adapters/postgresql/collation_test.rb +55 -0
- data/activerecord/test/cases/adapters/postgresql/composite_test.rb +134 -0
- data/activerecord/test/cases/adapters/postgresql/connection_test.rb +272 -0
- data/activerecord/test/cases/adapters/postgresql/datatype_test.rb +93 -0
- data/activerecord/test/cases/adapters/postgresql/domain_test.rb +49 -0
- data/activerecord/test/cases/adapters/postgresql/enum_test.rb +93 -0
- data/activerecord/test/cases/adapters/postgresql/explain_test.rb +22 -0
- data/activerecord/test/cases/adapters/postgresql/extension_migration_test.rb +65 -0
- data/activerecord/test/cases/adapters/postgresql/full_text_test.rb +46 -0
- data/activerecord/test/cases/adapters/postgresql/geometric_test.rb +373 -0
- data/activerecord/test/cases/adapters/postgresql/hstore_test.rb +380 -0
- data/activerecord/test/cases/adapters/postgresql/infinity_test.rb +71 -0
- data/activerecord/test/cases/adapters/postgresql/integer_test.rb +27 -0
- data/activerecord/test/cases/adapters/postgresql/json_test.rb +52 -0
- data/activerecord/test/cases/adapters/postgresql/ltree_test.rb +55 -0
- data/activerecord/test/cases/adapters/postgresql/money_test.rb +98 -0
- data/activerecord/test/cases/adapters/postgresql/network_test.rb +96 -0
- data/activerecord/test/cases/adapters/postgresql/numbers_test.rb +51 -0
- data/activerecord/test/cases/adapters/postgresql/postgresql_adapter_test.rb +390 -0
- data/activerecord/test/cases/adapters/postgresql/prepared_statements_disabled_test.rb +27 -0
- data/activerecord/test/cases/adapters/postgresql/quoting_test.rb +45 -0
- data/activerecord/test/cases/adapters/postgresql/range_test.rb +351 -0
- data/activerecord/test/cases/adapters/postgresql/referential_integrity_test.rb +113 -0
- data/activerecord/test/cases/adapters/postgresql/rename_table_test.rb +36 -0
- data/activerecord/test/cases/adapters/postgresql/schema_authorization_test.rb +110 -0
- data/activerecord/test/cases/adapters/postgresql/schema_test.rb +592 -0
- data/activerecord/test/cases/adapters/postgresql/serial_test.rb +88 -0
- data/activerecord/test/cases/adapters/postgresql/statement_pool_test.rb +43 -0
- data/activerecord/test/cases/adapters/postgresql/timestamp_test.rb +92 -0
- data/activerecord/test/cases/adapters/postgresql/transaction_test.rb +104 -0
- data/activerecord/test/cases/adapters/postgresql/type_lookup_test.rb +35 -0
- data/activerecord/test/cases/adapters/postgresql/utils_test.rb +64 -0
- data/activerecord/test/cases/adapters/postgresql/uuid_test.rb +376 -0
- data/activerecord/test/cases/adapters/postgresql/xml_test.rb +56 -0
- data/activerecord/test/cases/adapters/sqlite3/collation_test.rb +55 -0
- data/activerecord/test/cases/adapters/sqlite3/copy_table_test.rb +101 -0
- data/activerecord/test/cases/adapters/sqlite3/explain_test.rb +23 -0
- data/activerecord/test/cases/adapters/sqlite3/quoting_test.rb +58 -0
- data/activerecord/test/cases/adapters/sqlite3/sqlite3_adapter_test.rb +421 -0
- data/activerecord/test/cases/adapters/sqlite3/sqlite3_create_folder_test.rb +26 -0
- data/activerecord/test/cases/adapters/sqlite3/statement_pool_test.rb +21 -0
- data/activerecord/test/cases/aggregations_test.rb +170 -0
- data/activerecord/test/cases/ar_schema_test.rb +145 -0
- data/activerecord/test/cases/associations/belongs_to_associations_test.rb +1196 -0
- data/activerecord/test/cases/associations/bidirectional_destroy_dependencies_test.rb +43 -0
- data/activerecord/test/cases/associations/callbacks_test.rb +191 -0
- data/activerecord/test/cases/associations/cascaded_eager_loading_test.rb +184 -0
- data/activerecord/test/cases/associations/eager_load_includes_full_sti_class_test.rb +44 -0
- data/activerecord/test/cases/associations/eager_load_nested_include_test.rb +126 -0
- data/activerecord/test/cases/associations/eager_singularization_test.rb +148 -0
- data/activerecord/test/cases/associations/eager_test.rb +1500 -0
- data/activerecord/test/cases/associations/extension_test.rb +94 -0
- data/activerecord/test/cases/associations/has_and_belongs_to_many_associations_test.rb +1033 -0
- data/activerecord/test/cases/associations/has_many_associations_test.rb +2619 -0
- data/activerecord/test/cases/associations/has_many_through_associations_test.rb +1309 -0
- data/activerecord/test/cases/associations/has_one_associations_test.rb +727 -0
- data/activerecord/test/cases/associations/has_one_through_associations_test.rb +392 -0
- data/activerecord/test/cases/associations/inner_join_association_test.rb +141 -0
- data/activerecord/test/cases/associations/inverse_associations_test.rb +727 -0
- data/activerecord/test/cases/associations/join_model_test.rb +778 -0
- data/activerecord/test/cases/associations/left_outer_join_association_test.rb +90 -0
- data/activerecord/test/cases/associations/nested_through_associations_test.rb +581 -0
- data/activerecord/test/cases/associations/required_test.rb +132 -0
- data/activerecord/test/cases/associations_test.rb +370 -0
- data/activerecord/test/cases/attribute_decorators_test.rb +127 -0
- data/activerecord/test/cases/attribute_methods/read_test.rb +61 -0
- data/activerecord/test/cases/attribute_methods_test.rb +1038 -0
- data/activerecord/test/cases/attribute_set_test.rb +255 -0
- data/activerecord/test/cases/attribute_test.rb +255 -0
- data/activerecord/test/cases/attributes_test.rb +269 -0
- data/activerecord/test/cases/autosave_association_test.rb +1738 -0
- data/activerecord/test/cases/base_test.rb +1460 -0
- data/activerecord/test/cases/batches_test.rb +676 -0
- data/activerecord/test/cases/binary_test.rb +46 -0
- data/activerecord/test/cases/bind_parameter_test.rb +108 -0
- data/activerecord/test/cases/cache_key_test.rb +53 -0
- data/activerecord/test/cases/calculations_test.rb +894 -0
- data/activerecord/test/cases/callbacks_test.rb +479 -0
- data/activerecord/test/cases/clone_test.rb +42 -0
- data/activerecord/test/cases/coders/json_test.rb +17 -0
- data/activerecord/test/cases/coders/yaml_column_test.rb +66 -0
- data/activerecord/test/cases/collection_cache_key_test.rb +117 -0
- data/activerecord/test/cases/column_alias_test.rb +19 -0
- data/activerecord/test/cases/column_definition_test.rb +34 -0
- data/activerecord/test/cases/comment_test.rb +146 -0
- data/activerecord/test/cases/connection_adapters/adapter_leasing_test.rb +58 -0
- data/activerecord/test/cases/connection_adapters/connection_handler_test.rb +232 -0
- data/activerecord/test/cases/connection_adapters/connection_specification_test.rb +14 -0
- data/activerecord/test/cases/connection_adapters/merge_and_resolve_default_url_config_test.rb +257 -0
- data/activerecord/test/cases/connection_adapters/mysql_type_lookup_test.rb +78 -0
- data/activerecord/test/cases/connection_adapters/schema_cache_test.rb +101 -0
- data/activerecord/test/cases/connection_adapters/type_lookup_test.rb +120 -0
- data/activerecord/test/cases/connection_management_test.rb +114 -0
- data/activerecord/test/cases/connection_pool_test.rb +569 -0
- data/activerecord/test/cases/connection_specification/resolver_test.rb +137 -0
- data/activerecord/test/cases/core_test.rb +114 -0
- data/activerecord/test/cases/counter_cache_test.rb +367 -0
- data/activerecord/test/cases/custom_locking_test.rb +19 -0
- data/activerecord/test/cases/database_statements_test.rb +37 -0
- data/activerecord/test/cases/date_test.rb +46 -0
- data/activerecord/test/cases/date_time_precision_test.rb +89 -0
- data/activerecord/test/cases/date_time_test.rb +76 -0
- data/activerecord/test/cases/defaults_test.rb +209 -0
- data/activerecord/test/cases/dirty_test.rb +871 -0
- data/activerecord/test/cases/disconnected_test.rb +32 -0
- data/activerecord/test/cases/dup_test.rb +161 -0
- data/activerecord/test/cases/enum_test.rb +493 -0
- data/activerecord/test/cases/errors_test.rb +18 -0
- data/activerecord/test/cases/explain_subscriber_test.rb +66 -0
- data/activerecord/test/cases/explain_test.rb +89 -0
- data/activerecord/test/cases/finder_respond_to_test.rb +61 -0
- data/activerecord/test/cases/finder_test.rb +1282 -0
- data/activerecord/test/cases/fixture_set/file_test.rb +158 -0
- data/activerecord/test/cases/fixtures_test.rb +1096 -0
- data/activerecord/test/cases/forbidden_attributes_protection_test.rb +166 -0
- data/activerecord/test/cases/habtm_destroy_order_test.rb +63 -0
- data/activerecord/test/cases/helper.rb +187 -0
- data/activerecord/test/cases/hot_compatibility_test.rb +144 -0
- data/activerecord/test/cases/i18n_test.rb +46 -0
- data/activerecord/test/cases/inheritance_test.rb +613 -0
- data/activerecord/test/cases/integration_test.rb +234 -0
- data/activerecord/test/cases/invalid_connection_test.rb +26 -0
- data/activerecord/test/cases/invertible_migration_test.rb +380 -0
- data/activerecord/test/cases/json_attribute_test.rb +35 -0
- data/activerecord/test/cases/json_serialization_test.rb +311 -0
- data/activerecord/test/cases/json_shared_test_cases.rb +256 -0
- data/activerecord/test/cases/locking_test.rb +651 -0
- data/activerecord/test/cases/log_subscriber_test.rb +219 -0
- data/activerecord/test/cases/migration/change_schema_test.rb +468 -0
- data/activerecord/test/cases/migration/change_table_test.rb +258 -0
- data/activerecord/test/cases/migration/column_attributes_test.rb +188 -0
- data/activerecord/test/cases/migration/column_positioning_test.rb +58 -0
- data/activerecord/test/cases/migration/columns_test.rb +319 -0
- data/activerecord/test/cases/migration/command_recorder_test.rb +347 -0
- data/activerecord/test/cases/migration/compatibility_test.rb +238 -0
- data/activerecord/test/cases/migration/create_join_table_test.rb +168 -0
- data/activerecord/test/cases/migration/foreign_key_test.rb +339 -0
- data/activerecord/test/cases/migration/helper.rb +41 -0
- data/activerecord/test/cases/migration/index_test.rb +218 -0
- data/activerecord/test/cases/migration/logger_test.rb +38 -0
- data/activerecord/test/cases/migration/pending_migrations_test.rb +42 -0
- data/activerecord/test/cases/migration/references_foreign_key_test.rb +257 -0
- data/activerecord/test/cases/migration/references_index_test.rb +103 -0
- data/activerecord/test/cases/migration/references_statements_test.rb +138 -0
- data/activerecord/test/cases/migration/rename_table_test.rb +118 -0
- data/activerecord/test/cases/migration_test.rb +1122 -0
- data/activerecord/test/cases/migrator_test.rb +473 -0
- data/activerecord/test/cases/mixin_test.rb +64 -0
- data/activerecord/test/cases/modules_test.rb +174 -0
- data/activerecord/test/cases/multiparameter_attributes_test.rb +399 -0
- data/activerecord/test/cases/multiple_db_test.rb +119 -0
- data/activerecord/test/cases/nested_attributes_test.rb +1097 -0
- data/activerecord/test/cases/nested_attributes_with_callbacks_test.rb +146 -0
- data/activerecord/test/cases/null_relation_test.rb +84 -0
- data/activerecord/test/cases/numeric_data_test.rb +73 -0
- data/activerecord/test/cases/persistence_test.rb +1063 -0
- data/activerecord/test/cases/pooled_connections_test.rb +83 -0
- data/activerecord/test/cases/primary_keys_test.rb +466 -0
- data/activerecord/test/cases/query_cache_test.rb +577 -0
- data/activerecord/test/cases/quoting_test.rb +275 -0
- data/activerecord/test/cases/readonly_test.rb +120 -0
- data/activerecord/test/cases/reaper_test.rb +87 -0
- data/activerecord/test/cases/reflection_test.rb +533 -0
- data/activerecord/test/cases/relation/delegation_test.rb +57 -0
- data/activerecord/test/cases/relation/merging_test.rb +157 -0
- data/activerecord/test/cases/relation/mutation_test.rb +145 -0
- data/activerecord/test/cases/relation/or_test.rb +130 -0
- data/activerecord/test/cases/relation/predicate_builder_test.rb +18 -0
- data/activerecord/test/cases/relation/record_fetch_warning_test.rb +42 -0
- data/activerecord/test/cases/relation/where_chain_test.rb +107 -0
- data/activerecord/test/cases/relation/where_clause_test.rb +241 -0
- data/activerecord/test/cases/relation/where_test.rb +366 -0
- data/activerecord/test/cases/relation_test.rb +331 -0
- data/activerecord/test/cases/relations_test.rb +1923 -0
- data/activerecord/test/cases/reload_models_test.rb +26 -0
- data/activerecord/test/cases/reserved_word_test.rb +134 -0
- data/activerecord/test/cases/result_test.rb +90 -0
- data/activerecord/test/cases/sanitize_test.rb +182 -0
- data/activerecord/test/cases/schema_dumper_test.rb +507 -0
- data/activerecord/test/cases/schema_loading_test.rb +54 -0
- data/activerecord/test/cases/scoping/default_scoping_test.rb +547 -0
- data/activerecord/test/cases/scoping/named_scoping_test.rb +577 -0
- data/activerecord/test/cases/scoping/relation_scoping_test.rb +402 -0
- data/activerecord/test/cases/secure_token_test.rb +34 -0
- data/activerecord/test/cases/serialization_test.rb +106 -0
- data/activerecord/test/cases/serialized_attribute_test.rb +382 -0
- data/activerecord/test/cases/statement_cache_test.rb +137 -0
- data/activerecord/test/cases/store_test.rb +197 -0
- data/activerecord/test/cases/suppressor_test.rb +77 -0
- data/activerecord/test/cases/tasks/database_tasks_test.rb +491 -0
- data/activerecord/test/cases/tasks/mysql_rake_test.rb +388 -0
- data/activerecord/test/cases/tasks/postgresql_rake_test.rb +374 -0
- data/activerecord/test/cases/tasks/sqlite_rake_test.rb +267 -0
- data/activerecord/test/cases/test_case.rb +138 -0
- data/activerecord/test/cases/test_fixtures_test.rb +20 -0
- data/activerecord/test/cases/time_precision_test.rb +85 -0
- data/activerecord/test/cases/timestamp_test.rb +478 -0
- data/activerecord/test/cases/touch_later_test.rb +123 -0
- data/activerecord/test/cases/transaction_callbacks_test.rb +595 -0
- data/activerecord/test/cases/transaction_isolation_test.rb +108 -0
- data/activerecord/test/cases/transactions_test.rb +1030 -0
- data/activerecord/test/cases/type/adapter_specific_registry_test.rb +135 -0
- data/activerecord/test/cases/type/date_time_test.rb +16 -0
- data/activerecord/test/cases/type/integer_test.rb +29 -0
- data/activerecord/test/cases/type/string_test.rb +24 -0
- data/activerecord/test/cases/type/type_map_test.rb +178 -0
- data/activerecord/test/cases/type/unsigned_integer_test.rb +19 -0
- data/activerecord/test/cases/type_test.rb +41 -0
- data/activerecord/test/cases/types_test.rb +26 -0
- data/activerecord/test/cases/unconnected_test.rb +35 -0
- data/activerecord/test/cases/validations/absence_validation_test.rb +75 -0
- data/activerecord/test/cases/validations/association_validation_test.rb +99 -0
- data/activerecord/test/cases/validations/i18n_generate_message_validation_test.rb +86 -0
- data/activerecord/test/cases/validations/i18n_validation_test.rb +85 -0
- data/activerecord/test/cases/validations/length_validation_test.rb +80 -0
- data/activerecord/test/cases/validations/presence_validation_test.rb +105 -0
- data/activerecord/test/cases/validations/uniqueness_validation_test.rb +557 -0
- data/activerecord/test/cases/validations_repair_helper.rb +21 -0
- data/activerecord/test/cases/validations_test.rb +196 -0
- data/activerecord/test/cases/view_test.rb +224 -0
- data/activerecord/test/cases/yaml_serialization_test.rb +141 -0
- data/activerecord/test/config.example.yml +100 -0
- data/activerecord/test/config.rb +7 -0
- data/activerecord/test/fixtures/.gitignore +1 -0
- data/activerecord/test/fixtures/accounts.yml +29 -0
- data/activerecord/test/fixtures/admin/accounts.yml +2 -0
- data/activerecord/test/fixtures/admin/randomly_named_a9.yml +7 -0
- data/activerecord/test/fixtures/admin/randomly_named_b0.yml +7 -0
- data/activerecord/test/fixtures/admin/users.yml +10 -0
- data/activerecord/test/fixtures/all/admin +1 -0
- data/activerecord/test/fixtures/all/developers.yml +0 -0
- data/activerecord/test/fixtures/all/namespaced/accounts.yml +2 -0
- data/activerecord/test/fixtures/all/people.yml +0 -0
- data/activerecord/test/fixtures/all/tasks.yml +0 -0
- data/activerecord/test/fixtures/author_addresses.yml +11 -0
- data/activerecord/test/fixtures/author_favorites.yml +4 -0
- data/activerecord/test/fixtures/authors.yml +17 -0
- data/activerecord/test/fixtures/bad_posts.yml +9 -0
- data/activerecord/test/fixtures/binaries.yml +137 -0
- data/activerecord/test/fixtures/books.yml +33 -0
- data/activerecord/test/fixtures/bulbs.yml +5 -0
- data/activerecord/test/fixtures/cars.yml +9 -0
- data/activerecord/test/fixtures/categories.yml +19 -0
- data/activerecord/test/fixtures/categories/special_categories.yml +9 -0
- data/activerecord/test/fixtures/categories/subsubdir/arbitrary_filename.yml +4 -0
- data/activerecord/test/fixtures/categories_ordered.yml +7 -0
- data/activerecord/test/fixtures/categories_posts.yml +31 -0
- data/activerecord/test/fixtures/categorizations.yml +23 -0
- data/activerecord/test/fixtures/clubs.yml +8 -0
- data/activerecord/test/fixtures/collections.yml +3 -0
- data/activerecord/test/fixtures/colleges.yml +3 -0
- data/activerecord/test/fixtures/comments.yml +65 -0
- data/activerecord/test/fixtures/companies.yml +67 -0
- data/activerecord/test/fixtures/computers.yml +10 -0
- data/activerecord/test/fixtures/content.yml +3 -0
- data/activerecord/test/fixtures/content_positions.yml +3 -0
- data/activerecord/test/fixtures/courses.yml +8 -0
- data/activerecord/test/fixtures/customers.yml +26 -0
- data/activerecord/test/fixtures/dashboards.yml +6 -0
- data/activerecord/test/fixtures/dead_parrots.yml +5 -0
- data/activerecord/test/fixtures/developers.yml +22 -0
- data/activerecord/test/fixtures/developers_projects.yml +17 -0
- data/activerecord/test/fixtures/dog_lovers.yml +7 -0
- data/activerecord/test/fixtures/dogs.yml +4 -0
- data/activerecord/test/fixtures/doubloons.yml +3 -0
- data/activerecord/test/fixtures/edges.yml +5 -0
- data/activerecord/test/fixtures/entrants.yml +14 -0
- data/activerecord/test/fixtures/essays.yml +6 -0
- data/activerecord/test/fixtures/faces.yml +11 -0
- data/activerecord/test/fixtures/fk_test_has_fk.yml +3 -0
- data/activerecord/test/fixtures/fk_test_has_pk.yml +2 -0
- data/activerecord/test/fixtures/friendships.yml +4 -0
- data/activerecord/test/fixtures/funny_jokes.yml +10 -0
- data/activerecord/test/fixtures/interests.yml +33 -0
- data/activerecord/test/fixtures/items.yml +3 -0
- data/activerecord/test/fixtures/jobs.yml +7 -0
- data/activerecord/test/fixtures/legacy_things.yml +3 -0
- data/activerecord/test/fixtures/live_parrots.yml +4 -0
- data/activerecord/test/fixtures/mateys.yml +4 -0
- data/activerecord/test/fixtures/member_details.yml +8 -0
- data/activerecord/test/fixtures/member_types.yml +6 -0
- data/activerecord/test/fixtures/members.yml +11 -0
- data/activerecord/test/fixtures/memberships.yml +34 -0
- data/activerecord/test/fixtures/men.yml +5 -0
- data/activerecord/test/fixtures/minimalistics.yml +2 -0
- data/activerecord/test/fixtures/minivans.yml +5 -0
- data/activerecord/test/fixtures/mixed_case_monkeys.yml +6 -0
- data/activerecord/test/fixtures/mixins.yml +29 -0
- data/activerecord/test/fixtures/movies.yml +7 -0
- data/activerecord/test/fixtures/naked/yml/accounts.yml +1 -0
- data/activerecord/test/fixtures/naked/yml/companies.yml +1 -0
- data/activerecord/test/fixtures/naked/yml/courses.yml +1 -0
- data/activerecord/test/fixtures/naked/yml/courses_with_invalid_key.yml +3 -0
- data/activerecord/test/fixtures/naked/yml/parrots.yml +3 -0
- data/activerecord/test/fixtures/naked/yml/trees.yml +3 -0
- data/activerecord/test/fixtures/nodes.yml +29 -0
- data/activerecord/test/fixtures/organizations.yml +5 -0
- data/activerecord/test/fixtures/other_comments.yml +6 -0
- data/activerecord/test/fixtures/other_dogs.yml +2 -0
- data/activerecord/test/fixtures/other_posts.yml +7 -0
- data/activerecord/test/fixtures/other_topics.yml +42 -0
- data/activerecord/test/fixtures/owners.yml +9 -0
- data/activerecord/test/fixtures/parrots.yml +27 -0
- data/activerecord/test/fixtures/parrots_pirates.yml +7 -0
- data/activerecord/test/fixtures/people.yml +24 -0
- data/activerecord/test/fixtures/peoples_treasures.yml +3 -0
- data/activerecord/test/fixtures/pets.yml +19 -0
- data/activerecord/test/fixtures/pirates.yml +15 -0
- data/activerecord/test/fixtures/posts.yml +80 -0
- data/activerecord/test/fixtures/price_estimates.yml +16 -0
- data/activerecord/test/fixtures/products.yml +4 -0
- data/activerecord/test/fixtures/projects.yml +7 -0
- data/activerecord/test/fixtures/randomly_named_a9.yml +7 -0
- data/activerecord/test/fixtures/ratings.yml +14 -0
- data/activerecord/test/fixtures/readers.yml +11 -0
- data/activerecord/test/fixtures/references.yml +17 -0
- data/activerecord/test/fixtures/reserved_words/distinct.yml +5 -0
- data/activerecord/test/fixtures/reserved_words/distinct_select.yml +11 -0
- data/activerecord/test/fixtures/reserved_words/group.yml +14 -0
- data/activerecord/test/fixtures/reserved_words/select.yml +8 -0
- data/activerecord/test/fixtures/reserved_words/values.yml +7 -0
- data/activerecord/test/fixtures/ships.yml +6 -0
- data/activerecord/test/fixtures/speedometers.yml +8 -0
- data/activerecord/test/fixtures/sponsors.yml +12 -0
- data/activerecord/test/fixtures/string_key_objects.yml +7 -0
- data/activerecord/test/fixtures/subscribers.yml +11 -0
- data/activerecord/test/fixtures/subscriptions.yml +12 -0
- data/activerecord/test/fixtures/taggings.yml +78 -0
- data/activerecord/test/fixtures/tags.yml +11 -0
- data/activerecord/test/fixtures/tasks.yml +7 -0
- data/activerecord/test/fixtures/teapots.yml +3 -0
- data/activerecord/test/fixtures/to_be_linked/accounts.yml +2 -0
- data/activerecord/test/fixtures/to_be_linked/users.yml +10 -0
- data/activerecord/test/fixtures/topics.yml +49 -0
- data/activerecord/test/fixtures/toys.yml +14 -0
- data/activerecord/test/fixtures/traffic_lights.yml +10 -0
- data/activerecord/test/fixtures/treasures.yml +10 -0
- data/activerecord/test/fixtures/trees.yml +3 -0
- data/activerecord/test/fixtures/uuid_children.yml +3 -0
- data/activerecord/test/fixtures/uuid_parents.yml +2 -0
- data/activerecord/test/fixtures/variants.yml +4 -0
- data/activerecord/test/fixtures/vegetables.yml +20 -0
- data/activerecord/test/fixtures/vertices.yml +4 -0
- data/activerecord/test/fixtures/warehouse-things.yml +3 -0
- data/activerecord/test/fixtures/zines.yml +5 -0
- data/activerecord/test/migrations/10_urban/9_add_expressions.rb +13 -0
- data/activerecord/test/migrations/decimal/1_give_me_big_numbers.rb +17 -0
- data/activerecord/test/migrations/empty/.gitkeep +0 -0
- data/activerecord/test/migrations/magic/1_currencies_have_symbols.rb +13 -0
- data/activerecord/test/migrations/missing/1000_people_have_middle_names.rb +11 -0
- data/activerecord/test/migrations/missing/1_people_have_last_names.rb +11 -0
- data/activerecord/test/migrations/missing/3_we_need_reminders.rb +14 -0
- data/activerecord/test/migrations/missing/4_innocent_jointable.rb +14 -0
- data/activerecord/test/migrations/rename/1_we_need_things.rb +13 -0
- data/activerecord/test/migrations/rename/2_rename_things.rb +11 -0
- data/activerecord/test/migrations/to_copy/1_people_have_hobbies.rb +11 -0
- data/activerecord/test/migrations/to_copy/2_people_have_descriptions.rb +11 -0
- data/activerecord/test/migrations/to_copy2/1_create_articles.rb +9 -0
- data/activerecord/test/migrations/to_copy2/2_create_comments.rb +9 -0
- data/activerecord/test/migrations/to_copy_with_name_collision/1_people_have_hobbies.rb +11 -0
- data/activerecord/test/migrations/to_copy_with_timestamps/20090101010101_people_have_hobbies.rb +11 -0
- data/activerecord/test/migrations/to_copy_with_timestamps/20090101010202_people_have_descriptions.rb +11 -0
- data/activerecord/test/migrations/to_copy_with_timestamps2/20090101010101_create_articles.rb +9 -0
- data/activerecord/test/migrations/to_copy_with_timestamps2/20090101010202_create_comments.rb +9 -0
- data/activerecord/test/migrations/valid/1_valid_people_have_last_names.rb +11 -0
- data/activerecord/test/migrations/valid/2_we_need_reminders.rb +14 -0
- data/activerecord/test/migrations/valid/3_innocent_jointable.rb +14 -0
- data/activerecord/test/migrations/valid_with_subdirectories/1_valid_people_have_last_names.rb +11 -0
- data/activerecord/test/migrations/valid_with_subdirectories/sub/2_we_need_reminders.rb +14 -0
- data/activerecord/test/migrations/valid_with_subdirectories/sub1/3_innocent_jointable.rb +14 -0
- data/activerecord/test/migrations/valid_with_timestamps/20100101010101_valid_with_timestamps_people_have_last_names.rb +11 -0
- data/activerecord/test/migrations/valid_with_timestamps/20100201010101_valid_with_timestamps_we_need_reminders.rb +14 -0
- data/activerecord/test/migrations/valid_with_timestamps/20100301010101_valid_with_timestamps_innocent_jointable.rb +14 -0
- data/activerecord/test/migrations/version_check/20131219224947_migration_version_check.rb +10 -0
- data/activerecord/test/models/account.rb +34 -0
- data/activerecord/test/models/admin.rb +7 -0
- data/activerecord/test/models/admin/account.rb +5 -0
- data/activerecord/test/models/admin/randomly_named_c1.rb +9 -0
- data/activerecord/test/models/admin/user.rb +42 -0
- data/activerecord/test/models/aircraft.rb +7 -0
- data/activerecord/test/models/arunit2_model.rb +5 -0
- data/activerecord/test/models/author.rb +211 -0
- data/activerecord/test/models/auto_id.rb +6 -0
- data/activerecord/test/models/autoloadable/extra_firm.rb +4 -0
- data/activerecord/test/models/binary.rb +4 -0
- data/activerecord/test/models/bird.rb +14 -0
- data/activerecord/test/models/book.rb +26 -0
- data/activerecord/test/models/boolean.rb +7 -0
- data/activerecord/test/models/bulb.rb +54 -0
- data/activerecord/test/models/cake_designer.rb +5 -0
- data/activerecord/test/models/car.rb +31 -0
- data/activerecord/test/models/carrier.rb +4 -0
- data/activerecord/test/models/cat.rb +12 -0
- data/activerecord/test/models/categorization.rb +21 -0
- data/activerecord/test/models/category.rb +46 -0
- data/activerecord/test/models/chef.rb +10 -0
- data/activerecord/test/models/citation.rb +5 -0
- data/activerecord/test/models/club.rb +27 -0
- data/activerecord/test/models/college.rb +12 -0
- data/activerecord/test/models/column.rb +5 -0
- data/activerecord/test/models/column_name.rb +5 -0
- data/activerecord/test/models/comment.rb +88 -0
- data/activerecord/test/models/company.rb +190 -0
- data/activerecord/test/models/company_in_module.rb +100 -0
- data/activerecord/test/models/computer.rb +5 -0
- data/activerecord/test/models/contact.rb +43 -0
- data/activerecord/test/models/content.rb +42 -0
- data/activerecord/test/models/contract.rb +22 -0
- data/activerecord/test/models/country.rb +7 -0
- data/activerecord/test/models/course.rb +8 -0
- data/activerecord/test/models/customer.rb +85 -0
- data/activerecord/test/models/customer_carrier.rb +16 -0
- data/activerecord/test/models/dashboard.rb +5 -0
- data/activerecord/test/models/default.rb +4 -0
- data/activerecord/test/models/department.rb +6 -0
- data/activerecord/test/models/developer.rb +270 -0
- data/activerecord/test/models/dog.rb +7 -0
- data/activerecord/test/models/dog_lover.rb +7 -0
- data/activerecord/test/models/doubloon.rb +14 -0
- data/activerecord/test/models/drink_designer.rb +5 -0
- data/activerecord/test/models/edge.rb +7 -0
- data/activerecord/test/models/electron.rb +7 -0
- data/activerecord/test/models/engine.rb +5 -0
- data/activerecord/test/models/entrant.rb +5 -0
- data/activerecord/test/models/essay.rb +8 -0
- data/activerecord/test/models/event.rb +5 -0
- data/activerecord/test/models/eye.rb +39 -0
- data/activerecord/test/models/face.rb +11 -0
- data/activerecord/test/models/family.rb +6 -0
- data/activerecord/test/models/family_tree.rb +6 -0
- data/activerecord/test/models/friendship.rb +8 -0
- data/activerecord/test/models/guid.rb +4 -0
- data/activerecord/test/models/guitar.rb +6 -0
- data/activerecord/test/models/hotel.rb +13 -0
- data/activerecord/test/models/image.rb +5 -0
- data/activerecord/test/models/interest.rb +7 -0
- data/activerecord/test/models/invoice.rb +6 -0
- data/activerecord/test/models/item.rb +9 -0
- data/activerecord/test/models/job.rb +9 -0
- data/activerecord/test/models/joke.rb +9 -0
- data/activerecord/test/models/keyboard.rb +5 -0
- data/activerecord/test/models/legacy_thing.rb +5 -0
- data/activerecord/test/models/lesson.rb +13 -0
- data/activerecord/test/models/line_item.rb +5 -0
- data/activerecord/test/models/liquid.rb +6 -0
- data/activerecord/test/models/man.rb +13 -0
- data/activerecord/test/models/matey.rb +6 -0
- data/activerecord/test/models/member.rb +44 -0
- data/activerecord/test/models/member_detail.rb +10 -0
- data/activerecord/test/models/member_type.rb +5 -0
- data/activerecord/test/models/membership.rb +38 -0
- data/activerecord/test/models/mentor.rb +5 -0
- data/activerecord/test/models/minimalistic.rb +4 -0
- data/activerecord/test/models/minivan.rb +10 -0
- data/activerecord/test/models/mixed_case_monkey.rb +5 -0
- data/activerecord/test/models/mocktail_designer.rb +4 -0
- data/activerecord/test/models/molecule.rb +8 -0
- data/activerecord/test/models/movie.rb +7 -0
- data/activerecord/test/models/node.rb +7 -0
- data/activerecord/test/models/non_primary_key.rb +4 -0
- data/activerecord/test/models/notification.rb +5 -0
- data/activerecord/test/models/numeric_data.rb +10 -0
- data/activerecord/test/models/order.rb +6 -0
- data/activerecord/test/models/organization.rb +16 -0
- data/activerecord/test/models/other_dog.rb +7 -0
- data/activerecord/test/models/owner.rb +39 -0
- data/activerecord/test/models/parrot.rb +30 -0
- data/activerecord/test/models/person.rb +143 -0
- data/activerecord/test/models/personal_legacy_thing.rb +6 -0
- data/activerecord/test/models/pet.rb +20 -0
- data/activerecord/test/models/pet_treasure.rb +8 -0
- data/activerecord/test/models/pirate.rb +94 -0
- data/activerecord/test/models/possession.rb +5 -0
- data/activerecord/test/models/post.rb +322 -0
- data/activerecord/test/models/price_estimate.rb +6 -0
- data/activerecord/test/models/professor.rb +7 -0
- data/activerecord/test/models/project.rb +42 -0
- data/activerecord/test/models/publisher.rb +4 -0
- data/activerecord/test/models/publisher/article.rb +6 -0
- data/activerecord/test/models/publisher/magazine.rb +5 -0
- data/activerecord/test/models/randomly_named_c1.rb +5 -0
- data/activerecord/test/models/rating.rb +6 -0
- data/activerecord/test/models/reader.rb +25 -0
- data/activerecord/test/models/recipe.rb +5 -0
- data/activerecord/test/models/record.rb +4 -0
- data/activerecord/test/models/reference.rb +24 -0
- data/activerecord/test/models/reply.rb +63 -0
- data/activerecord/test/models/ship.rb +41 -0
- data/activerecord/test/models/ship_part.rb +10 -0
- data/activerecord/test/models/shop.rb +19 -0
- data/activerecord/test/models/shop_account.rb +8 -0
- data/activerecord/test/models/speedometer.rb +8 -0
- data/activerecord/test/models/sponsor.rb +9 -0
- data/activerecord/test/models/string_key_object.rb +5 -0
- data/activerecord/test/models/student.rb +6 -0
- data/activerecord/test/models/subscriber.rb +10 -0
- data/activerecord/test/models/subscription.rb +6 -0
- data/activerecord/test/models/tag.rb +15 -0
- data/activerecord/test/models/tagging.rb +15 -0
- data/activerecord/test/models/task.rb +7 -0
- data/activerecord/test/models/topic.rb +120 -0
- data/activerecord/test/models/toy.rb +8 -0
- data/activerecord/test/models/traffic_light.rb +6 -0
- data/activerecord/test/models/treasure.rb +16 -0
- data/activerecord/test/models/treaty.rb +7 -0
- data/activerecord/test/models/tree.rb +5 -0
- data/activerecord/test/models/tuning_peg.rb +6 -0
- data/activerecord/test/models/tyre.rb +13 -0
- data/activerecord/test/models/user.rb +20 -0
- data/activerecord/test/models/uuid_child.rb +5 -0
- data/activerecord/test/models/uuid_item.rb +8 -0
- data/activerecord/test/models/uuid_parent.rb +5 -0
- data/activerecord/test/models/vegetables.rb +25 -0
- data/activerecord/test/models/vehicle.rb +9 -0
- data/activerecord/test/models/vertex.rb +11 -0
- data/activerecord/test/models/warehouse_thing.rb +7 -0
- data/activerecord/test/models/wheel.rb +5 -0
- data/activerecord/test/models/without_table.rb +5 -0
- data/activerecord/test/models/zine.rb +5 -0
- data/activerecord/test/schema/mysql2_specific_schema.rb +75 -0
- data/activerecord/test/schema/oracle_specific_schema.rb +42 -0
- data/activerecord/test/schema/postgresql_specific_schema.rb +112 -0
- data/activerecord/test/schema/schema.rb +1081 -0
- data/activerecord/test/support/config.rb +46 -0
- data/activerecord/test/support/connection.rb +28 -0
- data/activerecord/test/support/connection_helper.rb +16 -0
- data/activerecord/test/support/ddl_helper.rb +10 -0
- data/activerecord/test/support/schema_dumping_helper.rb +22 -0
- data/activerecord/test/support/yaml_compatibility_fixtures/rails_4_1.yml +22 -0
- data/activerecord/test/support/yaml_compatibility_fixtures/rails_4_2_0.yml +182 -0
- data/activestorage/.babelrc +5 -0
- data/activestorage/.eslintrc +19 -0
- data/activestorage/.gitignore +6 -0
- data/activestorage/CHANGELOG.md +3 -0
- data/activestorage/MIT-LICENSE +20 -0
- data/activestorage/README.md +141 -0
- data/activestorage/Rakefile +14 -0
- data/activestorage/activestorage.gemspec +30 -0
- data/activestorage/app/assets/javascripts/activestorage.js +1 -0
- data/activestorage/app/controllers/active_storage/blobs_controller.rb +25 -0
- data/activestorage/app/controllers/active_storage/direct_uploads_controller.rb +23 -0
- data/activestorage/app/controllers/active_storage/disk_controller.rb +53 -0
- data/activestorage/app/controllers/active_storage/variants_controller.rb +29 -0
- data/activestorage/app/javascript/activestorage/blob_record.js +54 -0
- data/activestorage/app/javascript/activestorage/blob_upload.js +34 -0
- data/activestorage/app/javascript/activestorage/direct_upload.js +42 -0
- data/activestorage/app/javascript/activestorage/direct_upload_controller.js +67 -0
- data/activestorage/app/javascript/activestorage/direct_uploads_controller.js +50 -0
- data/activestorage/app/javascript/activestorage/file_checksum.js +53 -0
- data/activestorage/app/javascript/activestorage/helpers.js +42 -0
- data/activestorage/app/javascript/activestorage/index.js +11 -0
- data/activestorage/app/javascript/activestorage/ujs.js +74 -0
- data/activestorage/app/jobs/active_storage/purge_job.rb +11 -0
- data/activestorage/app/models/active_storage/attachment.rb +28 -0
- data/activestorage/app/models/active_storage/blob.rb +199 -0
- data/activestorage/app/models/active_storage/filename.rb +65 -0
- data/activestorage/app/models/active_storage/filename/parameters.rb +36 -0
- data/activestorage/app/models/active_storage/variant.rb +82 -0
- data/activestorage/app/models/active_storage/variation.rb +55 -0
- data/activestorage/bin/test +5 -0
- data/activestorage/config/routes.rb +30 -0
- data/activestorage/db/migrate/20170806125915_create_active_storage_tables.rb +25 -0
- data/activestorage/lib/active_storage.rb +38 -0
- data/activestorage/lib/active_storage/attached.rb +40 -0
- data/activestorage/lib/active_storage/attached/macros.rb +82 -0
- data/activestorage/lib/active_storage/attached/many.rb +55 -0
- data/activestorage/lib/active_storage/attached/one.rb +76 -0
- data/activestorage/lib/active_storage/engine.rb +65 -0
- data/activestorage/lib/active_storage/gem_version.rb +17 -0
- data/activestorage/lib/active_storage/log_subscriber.rb +52 -0
- data/activestorage/lib/active_storage/service.rb +117 -0
- data/activestorage/lib/active_storage/service/azure_storage_service.rb +124 -0
- data/activestorage/lib/active_storage/service/configurator.rb +32 -0
- data/activestorage/lib/active_storage/service/disk_service.rb +128 -0
- data/activestorage/lib/active_storage/service/gcs_service.rb +83 -0
- data/activestorage/lib/active_storage/service/mirror_service.rb +50 -0
- data/activestorage/lib/active_storage/service/s3_service.rb +100 -0
- data/activestorage/lib/active_storage/version.rb +10 -0
- data/activestorage/lib/tasks/activestorage.rake +8 -0
- data/activestorage/package.json +33 -0
- data/activestorage/test/controllers/blobs_controller_test.rb +17 -0
- data/activestorage/test/controllers/direct_uploads_controller_test.rb +124 -0
- data/activestorage/test/controllers/disk_controller_test.rb +59 -0
- data/activestorage/test/controllers/variants_controller_test.rb +23 -0
- data/activestorage/test/database/create_users_migration.rb +9 -0
- data/activestorage/test/database/setup.rb +7 -0
- data/activestorage/test/dummy/Rakefile +5 -0
- data/activestorage/test/dummy/app/assets/config/manifest.js +5 -0
- data/activestorage/test/dummy/app/assets/images/.keep +0 -0
- data/activestorage/test/dummy/app/assets/javascripts/application.js +13 -0
- data/activestorage/test/dummy/app/assets/stylesheets/application.css +15 -0
- data/activestorage/test/dummy/app/controllers/application_controller.rb +5 -0
- data/activestorage/test/dummy/app/controllers/concerns/.keep +0 -0
- data/activestorage/test/dummy/app/helpers/application_helper.rb +4 -0
- data/activestorage/test/dummy/app/jobs/application_job.rb +4 -0
- data/activestorage/test/dummy/app/models/application_record.rb +5 -0
- data/activestorage/test/dummy/app/models/concerns/.keep +0 -0
- data/activestorage/test/dummy/app/views/layouts/application.html.erb +14 -0
- data/activestorage/test/dummy/bin/bundle +5 -0
- data/activestorage/test/dummy/bin/rails +6 -0
- data/activestorage/test/dummy/bin/rake +6 -0
- data/activestorage/test/dummy/bin/yarn +13 -0
- data/activestorage/test/dummy/config.ru +7 -0
- data/activestorage/test/dummy/config/application.rb +26 -0
- data/activestorage/test/dummy/config/boot.rb +7 -0
- data/activestorage/test/dummy/config/database.yml +25 -0
- data/activestorage/test/dummy/config/environment.rb +7 -0
- data/activestorage/test/dummy/config/environments/development.rb +51 -0
- data/activestorage/test/dummy/config/environments/production.rb +84 -0
- data/activestorage/test/dummy/config/environments/test.rb +35 -0
- data/activestorage/test/dummy/config/initializers/application_controller_renderer.rb +7 -0
- data/activestorage/test/dummy/config/initializers/assets.rb +16 -0
- data/activestorage/test/dummy/config/initializers/backtrace_silencers.rb +8 -0
- data/activestorage/test/dummy/config/initializers/cookies_serializer.rb +7 -0
- data/activestorage/test/dummy/config/initializers/filter_parameter_logging.rb +6 -0
- data/activestorage/test/dummy/config/initializers/inflections.rb +17 -0
- data/activestorage/test/dummy/config/initializers/mime_types.rb +5 -0
- data/activestorage/test/dummy/config/initializers/wrap_parameters.rb +16 -0
- data/activestorage/test/dummy/config/routes.rb +4 -0
- data/activestorage/test/dummy/config/secrets.yml +32 -0
- data/activestorage/test/dummy/config/spring.rb +8 -0
- data/activestorage/test/dummy/config/storage.yml +3 -0
- data/activestorage/test/dummy/lib/assets/.keep +0 -0
- data/activestorage/test/dummy/log/.keep +0 -0
- data/activestorage/test/dummy/package.json +5 -0
- data/activestorage/test/dummy/public/404.html +67 -0
- data/activestorage/test/dummy/public/422.html +67 -0
- data/activestorage/test/dummy/public/500.html +66 -0
- data/activestorage/test/dummy/public/apple-touch-icon-precomposed.png +0 -0
- data/activestorage/test/dummy/public/apple-touch-icon.png +0 -0
- data/activestorage/test/dummy/public/favicon.ico +0 -0
- data/activestorage/test/fixtures/files/racecar.jpg +0 -0
- data/activestorage/test/models/attachments_test.rb +150 -0
- data/activestorage/test/models/blob_test.rb +56 -0
- data/activestorage/test/models/filename/parameters_test.rb +32 -0
- data/activestorage/test/models/filename_test.rb +56 -0
- data/activestorage/test/models/variant_test.rb +29 -0
- data/activestorage/test/service/azure_storage_service_test.rb +22 -0
- data/activestorage/test/service/configurations.yml +30 -0
- data/activestorage/test/service/configurations.yml.enc +0 -0
- data/activestorage/test/service/configurator_test.rb +16 -0
- data/activestorage/test/service/disk_service_test.rb +14 -0
- data/activestorage/test/service/gcs_service_test.rb +46 -0
- data/activestorage/test/service/mirror_service_test.rb +64 -0
- data/activestorage/test/service/s3_service_test.rb +59 -0
- data/activestorage/test/service/shared_service_tests.rb +69 -0
- data/activestorage/test/template/image_tag_test.rb +38 -0
- data/activestorage/test/test_helper.rb +69 -0
- data/activestorage/webpack.config.js +27 -0
- data/activestorage/yarn.lock +3164 -0
- data/activesupport/CHANGELOG.md +190 -0
- data/activesupport/MIT-LICENSE +20 -0
- data/activesupport/README.rdoc +39 -0
- data/activesupport/Rakefile +23 -0
- data/activesupport/activesupport.gemspec +34 -0
- data/activesupport/bin/generate_tables +141 -0
- data/activesupport/bin/test +5 -0
- data/activesupport/lib/active_support.rb +106 -0
- data/activesupport/lib/active_support/all.rb +5 -0
- data/activesupport/lib/active_support/array_inquirer.rb +48 -0
- data/activesupport/lib/active_support/backtrace_cleaner.rb +105 -0
- data/activesupport/lib/active_support/benchmarkable.rb +51 -0
- data/activesupport/lib/active_support/builder.rb +8 -0
- data/activesupport/lib/active_support/cache.rb +759 -0
- data/activesupport/lib/active_support/cache/file_store.rb +197 -0
- data/activesupport/lib/active_support/cache/mem_cache_store.rb +205 -0
- data/activesupport/lib/active_support/cache/memory_store.rb +169 -0
- data/activesupport/lib/active_support/cache/null_store.rb +43 -0
- data/activesupport/lib/active_support/cache/strategy/local_cache.rb +170 -0
- data/activesupport/lib/active_support/cache/strategy/local_cache_middleware.rb +45 -0
- data/activesupport/lib/active_support/callbacks.rb +856 -0
- data/activesupport/lib/active_support/concern.rb +144 -0
- data/activesupport/lib/active_support/concurrency/share_lock.rb +227 -0
- data/activesupport/lib/active_support/configurable.rb +150 -0
- data/activesupport/lib/active_support/core_ext.rb +5 -0
- data/activesupport/lib/active_support/core_ext/array.rb +9 -0
- data/activesupport/lib/active_support/core_ext/array/access.rb +92 -0
- data/activesupport/lib/active_support/core_ext/array/conversions.rb +213 -0
- data/activesupport/lib/active_support/core_ext/array/extract_options.rb +31 -0
- data/activesupport/lib/active_support/core_ext/array/grouping.rb +109 -0
- data/activesupport/lib/active_support/core_ext/array/inquiry.rb +19 -0
- data/activesupport/lib/active_support/core_ext/array/prepend_and_append.rb +9 -0
- data/activesupport/lib/active_support/core_ext/array/wrap.rb +48 -0
- data/activesupport/lib/active_support/core_ext/benchmark.rb +16 -0
- data/activesupport/lib/active_support/core_ext/big_decimal.rb +3 -0
- data/activesupport/lib/active_support/core_ext/big_decimal/conversions.rb +14 -0
- data/activesupport/lib/active_support/core_ext/class.rb +4 -0
- data/activesupport/lib/active_support/core_ext/class/attribute.rb +149 -0
- data/activesupport/lib/active_support/core_ext/class/attribute_accessors.rb +6 -0
- data/activesupport/lib/active_support/core_ext/class/subclasses.rb +57 -0
- data/activesupport/lib/active_support/core_ext/date.rb +7 -0
- data/activesupport/lib/active_support/core_ext/date/acts_like.rb +10 -0
- data/activesupport/lib/active_support/core_ext/date/blank.rb +14 -0
- data/activesupport/lib/active_support/core_ext/date/calculations.rb +145 -0
- data/activesupport/lib/active_support/core_ext/date/conversions.rb +100 -0
- data/activesupport/lib/active_support/core_ext/date/zones.rb +8 -0
- data/activesupport/lib/active_support/core_ext/date_and_time/calculations.rb +358 -0
- data/activesupport/lib/active_support/core_ext/date_and_time/compatibility.rb +16 -0
- data/activesupport/lib/active_support/core_ext/date_and_time/zones.rb +41 -0
- data/activesupport/lib/active_support/core_ext/date_time.rb +7 -0
- data/activesupport/lib/active_support/core_ext/date_time/acts_like.rb +16 -0
- data/activesupport/lib/active_support/core_ext/date_time/blank.rb +14 -0
- data/activesupport/lib/active_support/core_ext/date_time/calculations.rb +211 -0
- data/activesupport/lib/active_support/core_ext/date_time/compatibility.rb +18 -0
- data/activesupport/lib/active_support/core_ext/date_time/conversions.rb +107 -0
- data/activesupport/lib/active_support/core_ext/digest/uuid.rb +53 -0
- data/activesupport/lib/active_support/core_ext/enumerable.rb +159 -0
- data/activesupport/lib/active_support/core_ext/file.rb +3 -0
- data/activesupport/lib/active_support/core_ext/file/atomic.rb +70 -0
- data/activesupport/lib/active_support/core_ext/hash.rb +11 -0
- data/activesupport/lib/active_support/core_ext/hash/compact.rb +29 -0
- data/activesupport/lib/active_support/core_ext/hash/conversions.rb +263 -0
- data/activesupport/lib/active_support/core_ext/hash/deep_merge.rb +34 -0
- data/activesupport/lib/active_support/core_ext/hash/except.rb +24 -0
- data/activesupport/lib/active_support/core_ext/hash/indifferent_access.rb +24 -0
- data/activesupport/lib/active_support/core_ext/hash/keys.rb +172 -0
- data/activesupport/lib/active_support/core_ext/hash/reverse_merge.rb +25 -0
- data/activesupport/lib/active_support/core_ext/hash/slice.rb +50 -0
- data/activesupport/lib/active_support/core_ext/hash/transform_values.rb +32 -0
- data/activesupport/lib/active_support/core_ext/integer.rb +5 -0
- data/activesupport/lib/active_support/core_ext/integer/inflections.rb +31 -0
- data/activesupport/lib/active_support/core_ext/integer/multiple.rb +12 -0
- data/activesupport/lib/active_support/core_ext/integer/time.rb +31 -0
- data/activesupport/lib/active_support/core_ext/kernel.rb +6 -0
- data/activesupport/lib/active_support/core_ext/kernel/agnostics.rb +13 -0
- data/activesupport/lib/active_support/core_ext/kernel/concern.rb +14 -0
- data/activesupport/lib/active_support/core_ext/kernel/reporting.rb +45 -0
- data/activesupport/lib/active_support/core_ext/kernel/singleton_class.rb +8 -0
- data/activesupport/lib/active_support/core_ext/load_error.rb +9 -0
- data/activesupport/lib/active_support/core_ext/marshal.rb +24 -0
- data/activesupport/lib/active_support/core_ext/module.rb +13 -0
- data/activesupport/lib/active_support/core_ext/module/aliasing.rb +31 -0
- data/activesupport/lib/active_support/core_ext/module/anonymous.rb +30 -0
- data/activesupport/lib/active_support/core_ext/module/attr_internal.rb +38 -0
- data/activesupport/lib/active_support/core_ext/module/attribute_accessors.rb +215 -0
- data/activesupport/lib/active_support/core_ext/module/attribute_accessors_per_thread.rb +150 -0
- data/activesupport/lib/active_support/core_ext/module/concerning.rb +137 -0
- data/activesupport/lib/active_support/core_ext/module/delegation.rb +290 -0
- data/activesupport/lib/active_support/core_ext/module/deprecation.rb +25 -0
- data/activesupport/lib/active_support/core_ext/module/introspection.rb +62 -0
- data/activesupport/lib/active_support/core_ext/module/reachable.rb +10 -0
- data/activesupport/lib/active_support/core_ext/module/remove_method.rb +37 -0
- data/activesupport/lib/active_support/core_ext/name_error.rb +33 -0
- data/activesupport/lib/active_support/core_ext/numeric.rb +6 -0
- data/activesupport/lib/active_support/core_ext/numeric/bytes.rb +66 -0
- data/activesupport/lib/active_support/core_ext/numeric/conversions.rb +140 -0
- data/activesupport/lib/active_support/core_ext/numeric/inquiry.rb +28 -0
- data/activesupport/lib/active_support/core_ext/numeric/time.rb +76 -0
- data/activesupport/lib/active_support/core_ext/object.rb +16 -0
- data/activesupport/lib/active_support/core_ext/object/acts_like.rb +12 -0
- data/activesupport/lib/active_support/core_ext/object/blank.rb +147 -0
- data/activesupport/lib/active_support/core_ext/object/conversions.rb +6 -0
- data/activesupport/lib/active_support/core_ext/object/deep_dup.rb +55 -0
- data/activesupport/lib/active_support/core_ext/object/duplicable.rb +156 -0
- data/activesupport/lib/active_support/core_ext/object/inclusion.rb +29 -0
- data/activesupport/lib/active_support/core_ext/object/instance_variables.rb +30 -0
- data/activesupport/lib/active_support/core_ext/object/json.rb +221 -0
- data/activesupport/lib/active_support/core_ext/object/to_param.rb +3 -0
- data/activesupport/lib/active_support/core_ext/object/to_query.rb +86 -0
- data/activesupport/lib/active_support/core_ext/object/try.rb +148 -0
- data/activesupport/lib/active_support/core_ext/object/with_options.rb +82 -0
- data/activesupport/lib/active_support/core_ext/range.rb +6 -0
- data/activesupport/lib/active_support/core_ext/range/conversions.rb +33 -0
- data/activesupport/lib/active_support/core_ext/range/each.rb +23 -0
- data/activesupport/lib/active_support/core_ext/range/include_range.rb +25 -0
- data/activesupport/lib/active_support/core_ext/range/overlaps.rb +10 -0
- data/activesupport/lib/active_support/core_ext/regexp.rb +11 -0
- data/activesupport/lib/active_support/core_ext/securerandom.rb +25 -0
- data/activesupport/lib/active_support/core_ext/string.rb +15 -0
- data/activesupport/lib/active_support/core_ext/string/access.rb +106 -0
- data/activesupport/lib/active_support/core_ext/string/behavior.rb +8 -0
- data/activesupport/lib/active_support/core_ext/string/conversions.rb +59 -0
- data/activesupport/lib/active_support/core_ext/string/exclude.rb +13 -0
- data/activesupport/lib/active_support/core_ext/string/filters.rb +104 -0
- data/activesupport/lib/active_support/core_ext/string/indent.rb +45 -0
- data/activesupport/lib/active_support/core_ext/string/inflections.rb +254 -0
- data/activesupport/lib/active_support/core_ext/string/inquiry.rb +15 -0
- data/activesupport/lib/active_support/core_ext/string/multibyte.rb +55 -0
- data/activesupport/lib/active_support/core_ext/string/output_safety.rb +261 -0
- data/activesupport/lib/active_support/core_ext/string/starts_ends_with.rb +6 -0
- data/activesupport/lib/active_support/core_ext/string/strip.rb +25 -0
- data/activesupport/lib/active_support/core_ext/string/zones.rb +16 -0
- data/activesupport/lib/active_support/core_ext/time.rb +7 -0
- data/activesupport/lib/active_support/core_ext/time/acts_like.rb +10 -0
- data/activesupport/lib/active_support/core_ext/time/calculations.rb +315 -0
- data/activesupport/lib/active_support/core_ext/time/compatibility.rb +16 -0
- data/activesupport/lib/active_support/core_ext/time/conversions.rb +72 -0
- data/activesupport/lib/active_support/core_ext/time/zones.rb +113 -0
- data/activesupport/lib/active_support/core_ext/uri.rb +26 -0
- data/activesupport/lib/active_support/current_attributes.rb +195 -0
- data/activesupport/lib/active_support/dependencies.rb +744 -0
- data/activesupport/lib/active_support/dependencies/autoload.rb +79 -0
- data/activesupport/lib/active_support/dependencies/interlock.rb +57 -0
- data/activesupport/lib/active_support/deprecation.rb +46 -0
- data/activesupport/lib/active_support/deprecation/behaviors.rb +105 -0
- data/activesupport/lib/active_support/deprecation/constant_accessor.rb +52 -0
- data/activesupport/lib/active_support/deprecation/instance_delegator.rb +39 -0
- data/activesupport/lib/active_support/deprecation/method_wrappers.rb +72 -0
- data/activesupport/lib/active_support/deprecation/proxy_wrappers.rb +153 -0
- data/activesupport/lib/active_support/deprecation/reporting.rb +114 -0
- data/activesupport/lib/active_support/descendants_tracker.rb +62 -0
- data/activesupport/lib/active_support/duration.rb +422 -0
- data/activesupport/lib/active_support/duration/iso8601_parser.rb +125 -0
- data/activesupport/lib/active_support/duration/iso8601_serializer.rb +55 -0
- data/activesupport/lib/active_support/evented_file_update_checker.rb +205 -0
- data/activesupport/lib/active_support/execution_wrapper.rb +128 -0
- data/activesupport/lib/active_support/executor.rb +8 -0
- data/activesupport/lib/active_support/file_update_checker.rb +163 -0
- data/activesupport/lib/active_support/gem_version.rb +17 -0
- data/activesupport/lib/active_support/gzip.rb +38 -0
- data/activesupport/lib/active_support/hash_with_indifferent_access.rb +358 -0
- data/activesupport/lib/active_support/i18n.rb +15 -0
- data/activesupport/lib/active_support/i18n_railtie.rb +114 -0
- data/activesupport/lib/active_support/inflections.rb +72 -0
- data/activesupport/lib/active_support/inflector.rb +9 -0
- data/activesupport/lib/active_support/inflector/inflections.rb +246 -0
- data/activesupport/lib/active_support/inflector/methods.rb +408 -0
- data/activesupport/lib/active_support/inflector/transliterate.rb +112 -0
- data/activesupport/lib/active_support/json.rb +4 -0
- data/activesupport/lib/active_support/json/decoding.rb +76 -0
- data/activesupport/lib/active_support/json/encoding.rb +130 -0
- data/activesupport/lib/active_support/key_generator.rb +73 -0
- data/activesupport/lib/active_support/lazy_load_hooks.rb +78 -0
- data/activesupport/lib/active_support/locale/en.yml +135 -0
- data/activesupport/lib/active_support/log_subscriber.rb +112 -0
- data/activesupport/lib/active_support/log_subscriber/test_helper.rb +106 -0
- data/activesupport/lib/active_support/logger.rb +108 -0
- data/activesupport/lib/active_support/logger_silence.rb +29 -0
- data/activesupport/lib/active_support/logger_thread_safe_level.rb +33 -0
- data/activesupport/lib/active_support/message_encryptor.rb +202 -0
- data/activesupport/lib/active_support/message_verifier.rb +178 -0
- data/activesupport/lib/active_support/messages/metadata.rb +71 -0
- data/activesupport/lib/active_support/multibyte.rb +23 -0
- data/activesupport/lib/active_support/multibyte/chars.rb +235 -0
- data/activesupport/lib/active_support/multibyte/unicode.rb +394 -0
- data/activesupport/lib/active_support/notifications.rb +216 -0
- data/activesupport/lib/active_support/notifications/fanout.rb +159 -0
- data/activesupport/lib/active_support/notifications/instrumenter.rb +93 -0
- data/activesupport/lib/active_support/number_helper.rb +371 -0
- data/activesupport/lib/active_support/number_helper/number_converter.rb +184 -0
- data/activesupport/lib/active_support/number_helper/number_to_currency_converter.rb +46 -0
- data/activesupport/lib/active_support/number_helper/number_to_delimited_converter.rb +29 -0
- data/activesupport/lib/active_support/number_helper/number_to_human_converter.rb +68 -0
- data/activesupport/lib/active_support/number_helper/number_to_human_size_converter.rb +59 -0
- data/activesupport/lib/active_support/number_helper/number_to_percentage_converter.rb +14 -0
- data/activesupport/lib/active_support/number_helper/number_to_phone_converter.rb +58 -0
- data/activesupport/lib/active_support/number_helper/number_to_rounded_converter.rb +74 -0
- data/activesupport/lib/active_support/number_helper/rounding_helper.rb +66 -0
- data/activesupport/lib/active_support/option_merger.rb +27 -0
- data/activesupport/lib/active_support/ordered_hash.rb +50 -0
- data/activesupport/lib/active_support/ordered_options.rb +85 -0
- data/activesupport/lib/active_support/per_thread_registry.rb +60 -0
- data/activesupport/lib/active_support/proxy_object.rb +15 -0
- data/activesupport/lib/active_support/rails.rb +35 -0
- data/activesupport/lib/active_support/railtie.rb +59 -0
- data/activesupport/lib/active_support/reloader.rb +128 -0
- data/activesupport/lib/active_support/rescuable.rb +174 -0
- data/activesupport/lib/active_support/security_utils.rb +29 -0
- data/activesupport/lib/active_support/string_inquirer.rb +34 -0
- data/activesupport/lib/active_support/subscriber.rb +126 -0
- data/activesupport/lib/active_support/tagged_logging.rb +79 -0
- data/activesupport/lib/active_support/test_case.rb +73 -0
- data/activesupport/lib/active_support/testing/assertions.rb +199 -0
- data/activesupport/lib/active_support/testing/autorun.rb +7 -0
- data/activesupport/lib/active_support/testing/constant_lookup.rb +51 -0
- data/activesupport/lib/active_support/testing/declarative.rb +28 -0
- data/activesupport/lib/active_support/testing/deprecation.rb +39 -0
- data/activesupport/lib/active_support/testing/file_fixtures.rb +36 -0
- data/activesupport/lib/active_support/testing/isolation.rb +108 -0
- data/activesupport/lib/active_support/testing/method_call_assertions.rb +43 -0
- data/activesupport/lib/active_support/testing/setup_and_teardown.rb +52 -0
- data/activesupport/lib/active_support/testing/stream.rb +44 -0
- data/activesupport/lib/active_support/testing/tagged_logging.rb +27 -0
- data/activesupport/lib/active_support/testing/time_helpers.rb +199 -0
- data/activesupport/lib/active_support/time.rb +20 -0
- data/activesupport/lib/active_support/time_with_zone.rb +551 -0
- data/activesupport/lib/active_support/values/time_zone.rb +555 -0
- data/activesupport/lib/active_support/values/unicode_tables.dat +0 -0
- data/activesupport/lib/active_support/version.rb +10 -0
- data/activesupport/lib/active_support/xml_mini.rb +209 -0
- data/activesupport/lib/active_support/xml_mini/jdom.rb +183 -0
- data/activesupport/lib/active_support/xml_mini/libxml.rb +80 -0
- data/activesupport/lib/active_support/xml_mini/libxmlsax.rb +83 -0
- data/activesupport/lib/active_support/xml_mini/nokogiri.rb +83 -0
- data/activesupport/lib/active_support/xml_mini/nokogirisax.rb +86 -0
- data/activesupport/lib/active_support/xml_mini/rexml.rb +130 -0
- data/activesupport/test/abstract_unit.rb +41 -0
- data/activesupport/test/array_inquirer_test.rb +63 -0
- data/activesupport/test/autoload_test.rb +83 -0
- data/activesupport/test/autoloading_fixtures/a/b.rb +4 -0
- data/activesupport/test/autoloading_fixtures/a/c/d.rb +4 -0
- data/activesupport/test/autoloading_fixtures/a/c/em/f.rb +4 -0
- data/activesupport/test/autoloading_fixtures/application.rb +3 -0
- data/activesupport/test/autoloading_fixtures/circular1.rb +8 -0
- data/activesupport/test/autoloading_fixtures/circular2.rb +6 -0
- data/activesupport/test/autoloading_fixtures/class_folder.rb +5 -0
- data/activesupport/test/autoloading_fixtures/class_folder/class_folder_subclass.rb +5 -0
- data/activesupport/test/autoloading_fixtures/class_folder/inline_class.rb +4 -0
- data/activesupport/test/autoloading_fixtures/class_folder/nested_class.rb +9 -0
- data/activesupport/test/autoloading_fixtures/conflict.rb +3 -0
- data/activesupport/test/autoloading_fixtures/counting_loader.rb +7 -0
- data/activesupport/test/autoloading_fixtures/cross_site_dependency.rb +4 -0
- data/activesupport/test/autoloading_fixtures/d.rb +4 -0
- data/activesupport/test/autoloading_fixtures/em.rb +4 -0
- data/activesupport/test/autoloading_fixtures/html/some_class.rb +6 -0
- data/activesupport/test/autoloading_fixtures/load_path/loaded_constant.rb +4 -0
- data/activesupport/test/autoloading_fixtures/loads_constant.rb +7 -0
- data/activesupport/test/autoloading_fixtures/module_folder/inline_class.rb +4 -0
- data/activesupport/test/autoloading_fixtures/module_folder/nested_class.rb +6 -0
- data/activesupport/test/autoloading_fixtures/module_folder/nested_sibling.rb +4 -0
- data/activesupport/test/autoloading_fixtures/module_with_custom_const_missing/a/b.rb +3 -0
- data/activesupport/test/autoloading_fixtures/multiple_constant_file.rb +4 -0
- data/activesupport/test/autoloading_fixtures/prepend.rb +10 -0
- data/activesupport/test/autoloading_fixtures/prepend/sub_class_conflict.rb +4 -0
- data/activesupport/test/autoloading_fixtures/raises_arbitrary_exception.rb +6 -0
- data/activesupport/test/autoloading_fixtures/raises_name_error.rb +5 -0
- data/activesupport/test/autoloading_fixtures/raises_no_method_error.rb +5 -0
- data/activesupport/test/autoloading_fixtures/requires_constant.rb +6 -0
- data/activesupport/test/autoloading_fixtures/should_not_be_required.rb +3 -0
- data/activesupport/test/autoloading_fixtures/throws.rb +6 -0
- data/activesupport/test/autoloading_fixtures/typo.rb +3 -0
- data/activesupport/test/benchmarkable_test.rb +78 -0
- data/activesupport/test/broadcast_logger_test.rb +172 -0
- data/activesupport/test/cache/behaviors.rb +9 -0
- data/activesupport/test/cache/behaviors/autoloading_cache_behavior.rb +43 -0
- data/activesupport/test/cache/behaviors/cache_delete_matched_behavior.rb +15 -0
- data/activesupport/test/cache/behaviors/cache_increment_decrement_behavior.rb +23 -0
- data/activesupport/test/cache/behaviors/cache_store_behavior.rb +331 -0
- data/activesupport/test/cache/behaviors/cache_store_version_behavior.rb +88 -0
- data/activesupport/test/cache/behaviors/encoded_key_cache_behavior.rb +36 -0
- data/activesupport/test/cache/behaviors/local_cache_behavior.rb +128 -0
- data/activesupport/test/cache/cache_entry_test.rb +30 -0
- data/activesupport/test/cache/cache_key_test.rb +90 -0
- data/activesupport/test/cache/cache_store_logger_test.rb +36 -0
- data/activesupport/test/cache/cache_store_namespace_test.rb +40 -0
- data/activesupport/test/cache/cache_store_setting_test.rb +68 -0
- data/activesupport/test/cache/cache_store_write_multi_test.rb +62 -0
- data/activesupport/test/cache/local_cache_middleware_test.rb +63 -0
- data/activesupport/test/cache/stores/file_store_test.rb +130 -0
- data/activesupport/test/cache/stores/mem_cache_store_test.rb +76 -0
- data/activesupport/test/cache/stores/memory_store_test.rb +109 -0
- data/activesupport/test/cache/stores/null_store_test.rb +59 -0
- data/activesupport/test/callback_inheritance_test.rb +178 -0
- data/activesupport/test/callbacks_test.rb +1205 -0
- data/activesupport/test/class_cache_test.rb +80 -0
- data/activesupport/test/clean_backtrace_test.rb +76 -0
- data/activesupport/test/clean_logger_test.rb +31 -0
- data/activesupport/test/concern_test.rb +131 -0
- data/activesupport/test/configurable_test.rb +133 -0
- data/activesupport/test/constantize_test_cases.rb +127 -0
- data/activesupport/test/core_ext/array/access_test.rb +38 -0
- data/activesupport/test/core_ext/array/conversions_test.rb +205 -0
- data/activesupport/test/core_ext/array/extract_options_test.rb +47 -0
- data/activesupport/test/core_ext/array/grouping_test.rb +137 -0
- data/activesupport/test/core_ext/array/prepend_append_test.rb +14 -0
- data/activesupport/test/core_ext/array/wrap_test.rb +79 -0
- data/activesupport/test/core_ext/bigdecimal_test.rb +13 -0
- data/activesupport/test/core_ext/class/attribute_test.rb +101 -0
- data/activesupport/test/core_ext/class_test.rb +40 -0
- data/activesupport/test/core_ext/date_and_time_behavior.rb +325 -0
- data/activesupport/test/core_ext/date_and_time_compatibility_test.rb +275 -0
- data/activesupport/test/core_ext/date_ext_test.rb +415 -0
- data/activesupport/test/core_ext/date_time_ext_test.rb +463 -0
- data/activesupport/test/core_ext/digest/uuid_test.rb +26 -0
- data/activesupport/test/core_ext/duration_test.rb +651 -0
- data/activesupport/test/core_ext/enumerable_test.rb +223 -0
- data/activesupport/test/core_ext/file_test.rb +80 -0
- data/activesupport/test/core_ext/hash/transform_keys_test.rb +64 -0
- data/activesupport/test/core_ext/hash/transform_values_test.rb +77 -0
- data/activesupport/test/core_ext/hash_ext_test.rb +1131 -0
- data/activesupport/test/core_ext/integer_ext_test.rb +32 -0
- data/activesupport/test/core_ext/kernel/concern_test.rb +15 -0
- data/activesupport/test/core_ext/kernel_test.rb +53 -0
- data/activesupport/test/core_ext/load_error_test.rb +19 -0
- data/activesupport/test/core_ext/marshal_test.rb +165 -0
- data/activesupport/test/core_ext/module/anonymous_test.rb +16 -0
- data/activesupport/test/core_ext/module/attr_internal_test.rb +55 -0
- data/activesupport/test/core_ext/module/attribute_accessor_per_thread_test.rb +133 -0
- data/activesupport/test/core_ext/module/attribute_accessor_test.rb +137 -0
- data/activesupport/test/core_ext/module/attribute_aliasing_test.rb +61 -0
- data/activesupport/test/core_ext/module/concerning_test.rb +67 -0
- data/activesupport/test/core_ext/module/introspection_test.rb +39 -0
- data/activesupport/test/core_ext/module/reachable_test.rb +43 -0
- data/activesupport/test/core_ext/module/remove_method_test.rb +59 -0
- data/activesupport/test/core_ext/module_test.rb +443 -0
- data/activesupport/test/core_ext/name_error_test.rb +23 -0
- data/activesupport/test/core_ext/numeric_ext_test.rb +491 -0
- data/activesupport/test/core_ext/object/acts_like_test.rb +35 -0
- data/activesupport/test/core_ext/object/blank_test.rb +36 -0
- data/activesupport/test/core_ext/object/deep_dup_test.rb +59 -0
- data/activesupport/test/core_ext/object/duplicable_test.rb +37 -0
- data/activesupport/test/core_ext/object/inclusion_test.rb +61 -0
- data/activesupport/test/core_ext/object/instance_variables_test.rb +33 -0
- data/activesupport/test/core_ext/object/json_cherry_pick_test.rb +44 -0
- data/activesupport/test/core_ext/object/json_gem_encoding_test.rb +68 -0
- data/activesupport/test/core_ext/object/to_param_test.rb +39 -0
- data/activesupport/test/core_ext/object/to_query_test.rb +84 -0
- data/activesupport/test/core_ext/object/try_test.rb +165 -0
- data/activesupport/test/core_ext/range_ext_test.rb +133 -0
- data/activesupport/test/core_ext/regexp_ext_test.rb +36 -0
- data/activesupport/test/core_ext/secure_random_test.rb +22 -0
- data/activesupport/test/core_ext/string_ext_test.rb +932 -0
- data/activesupport/test/core_ext/time_ext_test.rb +999 -0
- data/activesupport/test/core_ext/time_with_zone_test.rb +1304 -0
- data/activesupport/test/core_ext/uri_ext_test.rb +14 -0
- data/activesupport/test/current_attributes_test.rb +105 -0
- data/activesupport/test/dependencies/check_warnings.rb +4 -0
- data/activesupport/test/dependencies/conflict.rb +3 -0
- data/activesupport/test/dependencies/cross_site_depender.rb +5 -0
- data/activesupport/test/dependencies/mutual_one.rb +6 -0
- data/activesupport/test/dependencies/mutual_two.rb +6 -0
- data/activesupport/test/dependencies/raises_exception.rb +5 -0
- data/activesupport/test/dependencies/raises_exception_without_blame_file.rb +7 -0
- data/activesupport/test/dependencies/requires_nonexistent0.rb +3 -0
- data/activesupport/test/dependencies/requires_nonexistent1.rb +3 -0
- data/activesupport/test/dependencies/service_one.rb +7 -0
- data/activesupport/test/dependencies/service_two.rb +4 -0
- data/activesupport/test/dependencies_test.rb +1077 -0
- data/activesupport/test/dependencies_test_helpers.rb +30 -0
- data/activesupport/test/deprecation/method_wrappers_test.rb +36 -0
- data/activesupport/test/deprecation/proxy_wrappers_test.rb +24 -0
- data/activesupport/test/deprecation_test.rb +430 -0
- data/activesupport/test/descendants_tracker_test_cases.rb +67 -0
- data/activesupport/test/descendants_tracker_with_autoloading_test.rb +36 -0
- data/activesupport/test/descendants_tracker_without_autoloading_test.rb +19 -0
- data/activesupport/test/evented_file_update_checker_test.rb +197 -0
- data/activesupport/test/executor_test.rb +242 -0
- data/activesupport/test/file_fixtures/sample.txt +1 -0
- data/activesupport/test/file_update_checker_shared_tests.rb +284 -0
- data/activesupport/test/file_update_checker_test.rb +21 -0
- data/activesupport/test/fixtures/autoload/another_class.rb +4 -0
- data/activesupport/test/fixtures/autoload/some_class.rb +4 -0
- data/activesupport/test/fixtures/xml/jdom_doctype.dtd +1 -0
- data/activesupport/test/fixtures/xml/jdom_entities.txt +1 -0
- data/activesupport/test/fixtures/xml/jdom_include.txt +1 -0
- data/activesupport/test/gzip_test.rb +45 -0
- data/activesupport/test/hash_with_indifferent_access_test.rb +773 -0
- data/activesupport/test/i18n_test.rb +106 -0
- data/activesupport/test/inflector_test.rb +548 -0
- data/activesupport/test/inflector_test_cases.rb +375 -0
- data/activesupport/test/json/decoding_test.rb +124 -0
- data/activesupport/test/json/encoding_test.rb +477 -0
- data/activesupport/test/json/encoding_test_cases.rb +98 -0
- data/activesupport/test/key_generator_test.rb +79 -0
- data/activesupport/test/lazy_load_hooks_test.rb +140 -0
- data/activesupport/test/log_subscriber_test.rb +126 -0
- data/activesupport/test/logger_test.rb +270 -0
- data/activesupport/test/message_encryptor_test.rb +176 -0
- data/activesupport/test/message_verifier_test.rb +158 -0
- data/activesupport/test/metadata/shared_metadata_tests.rb +93 -0
- data/activesupport/test/multibyte_chars_test.rb +752 -0
- data/activesupport/test/multibyte_conformance_test.rb +110 -0
- data/activesupport/test/multibyte_grapheme_break_conformance_test.rb +62 -0
- data/activesupport/test/multibyte_normalization_conformance_test.rb +112 -0
- data/activesupport/test/multibyte_proxy_test.rb +34 -0
- data/activesupport/test/multibyte_test_helpers.rb +41 -0
- data/activesupport/test/multibyte_unicode_database_test.rb +26 -0
- data/activesupport/test/notifications/evented_notification_test.rb +89 -0
- data/activesupport/test/notifications/instrumenter_test.rb +60 -0
- data/activesupport/test/notifications_test.rb +283 -0
- data/activesupport/test/number_helper_i18n_test.rb +151 -0
- data/activesupport/test/number_helper_test.rb +411 -0
- data/activesupport/test/option_merger_test.rb +97 -0
- data/activesupport/test/ordered_hash_test.rb +324 -0
- data/activesupport/test/ordered_options_test.rb +105 -0
- data/activesupport/test/reloader_test.rb +99 -0
- data/activesupport/test/rescuable_test.rb +176 -0
- data/activesupport/test/safe_buffer_test.rb +182 -0
- data/activesupport/test/security_utils_test.rb +16 -0
- data/activesupport/test/share_lock_test.rb +580 -0
- data/activesupport/test/string_inquirer_test.rb +46 -0
- data/activesupport/test/subscriber_test.rb +56 -0
- data/activesupport/test/tagged_logging_test.rb +117 -0
- data/activesupport/test/test_case_test.rb +339 -0
- data/activesupport/test/testing/constant_lookup_test.rb +78 -0
- data/activesupport/test/testing/file_fixtures_test.rb +32 -0
- data/activesupport/test/testing/method_call_assertions_test.rb +125 -0
- data/activesupport/test/time_travel_test.rb +189 -0
- data/activesupport/test/time_zone_test.rb +738 -0
- data/activesupport/test/time_zone_test_helpers.rb +26 -0
- data/activesupport/test/transliterate_test.rb +54 -0
- data/activesupport/test/xml_mini/jdom_engine_test.rb +53 -0
- data/activesupport/test/xml_mini/libxml_engine_test.rb +21 -0
- data/activesupport/test/xml_mini/libxmlsax_engine_test.rb +16 -0
- data/activesupport/test/xml_mini/nokogiri_engine_test.rb +16 -0
- data/activesupport/test/xml_mini/nokogirisax_engine_test.rb +16 -0
- data/activesupport/test/xml_mini/rexml_engine_test.rb +27 -0
- data/activesupport/test/xml_mini/xml_mini_engine_test.rb +264 -0
- data/activesupport/test/xml_mini_test.rb +355 -0
- data/ci/phantomjs.js +149 -0
- data/ci/travis.rb +187 -0
- data/guides/.document +0 -0
- data/guides/CHANGELOG.md +1 -0
- data/guides/Rakefile +91 -0
- data/guides/assets/images/akshaysurve.jpg +0 -0
- data/guides/assets/images/belongs_to.png +0 -0
- data/guides/assets/images/book_icon.gif +0 -0
- data/guides/assets/images/bullet.gif +0 -0
- data/guides/assets/images/chapters_icon.gif +0 -0
- data/guides/assets/images/check_bullet.gif +0 -0
- data/guides/assets/images/credits_pic_blank.gif +0 -0
- data/guides/assets/images/csrf.png +0 -0
- data/guides/assets/images/edge_badge.png +0 -0
- data/guides/assets/images/favicon.ico +0 -0
- data/guides/assets/images/feature_tile.gif +0 -0
- data/guides/assets/images/footer_tile.gif +0 -0
- data/guides/assets/images/fxn.png +0 -0
- data/guides/assets/images/getting_started/article_with_comments.png +0 -0
- data/guides/assets/images/getting_started/challenge.png +0 -0
- data/guides/assets/images/getting_started/confirm_dialog.png +0 -0
- data/guides/assets/images/getting_started/forbidden_attributes_for_new_article.png +0 -0
- data/guides/assets/images/getting_started/form_with_errors.png +0 -0
- data/guides/assets/images/getting_started/index_action_with_edit_link.png +0 -0
- data/guides/assets/images/getting_started/new_article.png +0 -0
- data/guides/assets/images/getting_started/rails_welcome.png +0 -0
- data/guides/assets/images/getting_started/routing_error_no_controller.png +0 -0
- data/guides/assets/images/getting_started/routing_error_no_route_matches.png +0 -0
- data/guides/assets/images/getting_started/show_action_for_articles.png +0 -0
- data/guides/assets/images/getting_started/template_is_missing_articles_new.png +0 -0
- data/guides/assets/images/getting_started/unknown_action_create_for_articles.png +0 -0
- data/guides/assets/images/getting_started/unknown_action_new_for_articles.png +0 -0
- data/guides/assets/images/grey_bullet.gif +0 -0
- data/guides/assets/images/habtm.png +0 -0
- data/guides/assets/images/has_many.png +0 -0
- data/guides/assets/images/has_many_through.png +0 -0
- data/guides/assets/images/has_one.png +0 -0
- data/guides/assets/images/has_one_through.png +0 -0
- data/guides/assets/images/header_backdrop.png +0 -0
- data/guides/assets/images/header_tile.gif +0 -0
- data/guides/assets/images/i18n/demo_html_safe.png +0 -0
- data/guides/assets/images/i18n/demo_localized_pirate.png +0 -0
- data/guides/assets/images/i18n/demo_translated_en.png +0 -0
- data/guides/assets/images/i18n/demo_translated_pirate.png +0 -0
- data/guides/assets/images/i18n/demo_translation_missing.png +0 -0
- data/guides/assets/images/i18n/demo_untranslated.png +0 -0
- data/guides/assets/images/icons/README +5 -0
- data/guides/assets/images/icons/callouts/1.png +0 -0
- data/guides/assets/images/icons/callouts/10.png +0 -0
- data/guides/assets/images/icons/callouts/11.png +0 -0
- data/guides/assets/images/icons/callouts/12.png +0 -0
- data/guides/assets/images/icons/callouts/13.png +0 -0
- data/guides/assets/images/icons/callouts/14.png +0 -0
- data/guides/assets/images/icons/callouts/15.png +0 -0
- data/guides/assets/images/icons/callouts/2.png +0 -0
- data/guides/assets/images/icons/callouts/3.png +0 -0
- data/guides/assets/images/icons/callouts/4.png +0 -0
- data/guides/assets/images/icons/callouts/5.png +0 -0
- data/guides/assets/images/icons/callouts/6.png +0 -0
- data/guides/assets/images/icons/callouts/7.png +0 -0
- data/guides/assets/images/icons/callouts/8.png +0 -0
- data/guides/assets/images/icons/callouts/9.png +0 -0
- data/guides/assets/images/icons/caution.png +0 -0
- data/guides/assets/images/icons/example.png +0 -0
- data/guides/assets/images/icons/home.png +0 -0
- data/guides/assets/images/icons/important.png +0 -0
- data/guides/assets/images/icons/next.png +0 -0
- data/guides/assets/images/icons/note.png +0 -0
- data/guides/assets/images/icons/prev.png +0 -0
- data/guides/assets/images/icons/tip.png +0 -0
- data/guides/assets/images/icons/up.png +0 -0
- data/guides/assets/images/icons/warning.png +0 -0
- data/guides/assets/images/nav_arrow.gif +0 -0
- data/guides/assets/images/oscardelben.jpg +0 -0
- data/guides/assets/images/polymorphic.png +0 -0
- data/guides/assets/images/radar.png +0 -0
- data/guides/assets/images/rails4_features.png +0 -0
- data/guides/assets/images/rails_guides_kindle_cover.jpg +0 -0
- data/guides/assets/images/rails_guides_logo.gif +0 -0
- data/guides/assets/images/rails_logo_remix.gif +0 -0
- data/guides/assets/images/session_fixation.png +0 -0
- data/guides/assets/images/tab_grey.gif +0 -0
- data/guides/assets/images/tab_info.gif +0 -0
- data/guides/assets/images/tab_note.gif +0 -0
- data/guides/assets/images/tab_red.gif +0 -0
- data/guides/assets/images/tab_yellow.gif +0 -0
- data/guides/assets/images/tab_yellow.png +0 -0
- data/guides/assets/images/vijaydev.jpg +0 -0
- data/guides/assets/javascripts/guides.js +53 -0
- data/guides/assets/javascripts/jquery.min.js +4 -0
- data/guides/assets/javascripts/responsive-tables.js +43 -0
- data/guides/assets/javascripts/syntaxhighlighter.js +20 -0
- data/guides/assets/stylesheets/fixes.css +16 -0
- data/guides/assets/stylesheets/kindle.css +11 -0
- data/guides/assets/stylesheets/main.css +718 -0
- data/guides/assets/stylesheets/print.css +52 -0
- data/guides/assets/stylesheets/reset.css +43 -0
- data/guides/assets/stylesheets/responsive-tables.css +50 -0
- data/guides/assets/stylesheets/style.css +13 -0
- data/guides/assets/stylesheets/syntaxhighlighter/shCore.css +226 -0
- data/guides/assets/stylesheets/syntaxhighlighter/shThemeRailsGuides.css +116 -0
- data/guides/bug_report_templates/action_controller_gem.rb +58 -0
- data/guides/bug_report_templates/action_controller_master.rb +54 -0
- data/guides/bug_report_templates/active_job_gem.rb +34 -0
- data/guides/bug_report_templates/active_job_master.rb +34 -0
- data/guides/bug_report_templates/active_record_gem.rb +54 -0
- data/guides/bug_report_templates/active_record_master.rb +51 -0
- data/guides/bug_report_templates/active_record_migrations_gem.rb +65 -0
- data/guides/bug_report_templates/active_record_migrations_master.rb +65 -0
- data/guides/bug_report_templates/benchmark.rb +52 -0
- data/guides/bug_report_templates/generic_gem.rb +27 -0
- data/guides/bug_report_templates/generic_master.rb +25 -0
- data/guides/rails_guides.rb +29 -0
- data/guides/rails_guides/generator.rb +208 -0
- data/guides/rails_guides/helpers.rb +55 -0
- data/guides/rails_guides/indexer.rb +70 -0
- data/guides/rails_guides/kindle.rb +116 -0
- data/guides/rails_guides/levenshtein.rb +44 -0
- data/guides/rails_guides/markdown.rb +173 -0
- data/guides/rails_guides/markdown/renderer.rb +123 -0
- data/guides/source/2_2_release_notes.md +436 -0
- data/guides/source/2_3_release_notes.md +623 -0
- data/guides/source/3_0_release_notes.md +612 -0
- data/guides/source/3_1_release_notes.md +561 -0
- data/guides/source/3_2_release_notes.md +570 -0
- data/guides/source/4_0_release_notes.md +284 -0
- data/guides/source/4_1_release_notes.md +732 -0
- data/guides/source/4_2_release_notes.md +890 -0
- data/guides/source/5_0_release_notes.md +1096 -0
- data/guides/source/5_1_release_notes.md +652 -0
- data/guides/source/_license.html.erb +2 -0
- data/guides/source/_welcome.html.erb +25 -0
- data/guides/source/action_cable_overview.md +691 -0
- data/guides/source/action_controller_overview.md +1218 -0
- data/guides/source/action_mailer_basics.md +826 -0
- data/guides/source/action_view_overview.md +1511 -0
- data/guides/source/active_job_basics.md +403 -0
- data/guides/source/active_model_basics.md +505 -0
- data/guides/source/active_record_basics.md +377 -0
- data/guides/source/active_record_callbacks.md +459 -0
- data/guides/source/active_record_migrations.md +1055 -0
- data/guides/source/active_record_postgresql.md +517 -0
- data/guides/source/active_record_querying.md +2048 -0
- data/guides/source/active_record_validations.md +1296 -0
- data/guides/source/active_support_core_extensions.md +3748 -0
- data/guides/source/active_support_instrumentation.md +552 -0
- data/guides/source/api_app.md +426 -0
- data/guides/source/api_documentation_guidelines.md +366 -0
- data/guides/source/asset_pipeline.md +1299 -0
- data/guides/source/association_basics.md +2467 -0
- data/guides/source/autoloading_and_reloading_constants.md +1323 -0
- data/guides/source/caching_with_rails.md +615 -0
- data/guides/source/command_line.md +664 -0
- data/guides/source/configuring.md +1341 -0
- data/guides/source/contributing_to_ruby_on_rails.md +667 -0
- data/guides/source/credits.html.erb +80 -0
- data/guides/source/debugging_rails_applications.md +954 -0
- data/guides/source/development_dependencies_install.md +378 -0
- data/guides/source/documents.yaml +230 -0
- data/guides/source/engines.md +1527 -0
- data/guides/source/form_helpers.md +1023 -0
- data/guides/source/generators.md +716 -0
- data/guides/source/getting_started.md +2100 -0
- data/guides/source/i18n.md +1208 -0
- data/guides/source/index.html.erb +28 -0
- data/guides/source/initialization.md +712 -0
- data/guides/source/kindle/copyright.html.erb +1 -0
- data/guides/source/kindle/layout.html.erb +27 -0
- data/guides/source/kindle/rails_guides.opf.erb +52 -0
- data/guides/source/kindle/toc.html.erb +24 -0
- data/guides/source/kindle/toc.ncx.erb +64 -0
- data/guides/source/kindle/welcome.html.erb +7 -0
- data/guides/source/layout.html.erb +138 -0
- data/guides/source/layouts_and_rendering.md +1330 -0
- data/guides/source/maintenance_policy.md +80 -0
- data/guides/source/plugins.md +484 -0
- data/guides/source/rails_application_templates.md +282 -0
- data/guides/source/rails_on_rack.md +310 -0
- data/guides/source/routing.md +1182 -0
- data/guides/source/ruby_on_rails_guides_guidelines.md +173 -0
- data/guides/source/security.md +1066 -0
- data/guides/source/testing.md +1566 -0
- data/guides/source/upgrading_ruby_on_rails.md +1552 -0
- data/guides/source/working_with_javascript_in_rails.md +550 -0
- data/guides/w3c_validator.rb +98 -0
- data/rails.gemspec +36 -0
- data/railties/.gitignore +1 -0
- data/railties/CHANGELOG.md +129 -0
- data/railties/MIT-LICENSE +20 -0
- data/railties/RDOC_MAIN.rdoc +73 -0
- data/railties/README.rdoc +40 -0
- data/railties/Rakefile +37 -0
- data/railties/bin/test +5 -0
- data/railties/exe/rails +10 -0
- data/railties/lib/minitest/rails_plugin.rb +54 -0
- data/railties/lib/rails.rb +114 -0
- data/railties/lib/rails/all.rb +20 -0
- data/railties/lib/rails/api/generator.rb +37 -0
- data/railties/lib/rails/api/task.rb +185 -0
- data/railties/lib/rails/app_loader.rb +77 -0
- data/railties/lib/rails/app_updater.rb +33 -0
- data/railties/lib/rails/application.rb +531 -0
- data/railties/lib/rails/application/bootstrap.rb +89 -0
- data/railties/lib/rails/application/configuration.rb +252 -0
- data/railties/lib/rails/application/default_middleware_stack.rb +101 -0
- data/railties/lib/rails/application/finisher.rb +196 -0
- data/railties/lib/rails/application/routes_reloader.rb +71 -0
- data/railties/lib/rails/application_controller.rb +18 -0
- data/railties/lib/rails/backtrace_cleaner.rb +34 -0
- data/railties/lib/rails/cli.rb +19 -0
- data/railties/lib/rails/code_statistics.rb +115 -0
- data/railties/lib/rails/code_statistics_calculator.rb +88 -0
- data/railties/lib/rails/command.rb +113 -0
- data/railties/lib/rails/command/actions.rb +44 -0
- data/railties/lib/rails/command/base.rb +157 -0
- data/railties/lib/rails/command/behavior.rb +125 -0
- data/railties/lib/rails/command/environment_argument.rb +47 -0
- data/railties/lib/rails/commands.rb +18 -0
- data/railties/lib/rails/commands/application/application_command.rb +31 -0
- data/railties/lib/rails/commands/console/console_command.rb +100 -0
- data/railties/lib/rails/commands/dbconsole/dbconsole_command.rb +170 -0
- data/railties/lib/rails/commands/destroy/destroy_command.rb +28 -0
- data/railties/lib/rails/commands/generate/generate_command.rb +30 -0
- data/railties/lib/rails/commands/help/USAGE +16 -0
- data/railties/lib/rails/commands/help/help_command.rb +15 -0
- data/railties/lib/rails/commands/new/new_command.rb +19 -0
- data/railties/lib/rails/commands/plugin/plugin_command.rb +45 -0
- data/railties/lib/rails/commands/rake/rake_command.rb +51 -0
- data/railties/lib/rails/commands/runner/USAGE +20 -0
- data/railties/lib/rails/commands/runner/runner_command.rb +53 -0
- data/railties/lib/rails/commands/secrets/USAGE +60 -0
- data/railties/lib/rails/commands/secrets/secrets_command.rb +66 -0
- data/railties/lib/rails/commands/server/server_command.rb +243 -0
- data/railties/lib/rails/commands/test/test_command.rb +37 -0
- data/railties/lib/rails/commands/version/version_command.rb +11 -0
- data/railties/lib/rails/configuration.rb +137 -0
- data/railties/lib/rails/console/app.rb +38 -0
- data/railties/lib/rails/console/helpers.rb +19 -0
- data/railties/lib/rails/dev_caching.rb +44 -0
- data/railties/lib/rails/engine.rb +705 -0
- data/railties/lib/rails/engine/commands.rb +9 -0
- data/railties/lib/rails/engine/configuration.rb +88 -0
- data/railties/lib/rails/engine/railties.rb +23 -0
- data/railties/lib/rails/engine/updater.rb +21 -0
- data/railties/lib/rails/gem_version.rb +17 -0
- data/railties/lib/rails/generators.rb +319 -0
- data/railties/lib/rails/generators/actions.rb +326 -0
- data/railties/lib/rails/generators/actions/create_migration.rb +71 -0
- data/railties/lib/rails/generators/active_model.rb +80 -0
- data/railties/lib/rails/generators/app_base.rb +447 -0
- data/railties/lib/rails/generators/base.rb +417 -0
- data/railties/lib/rails/generators/css/assets/assets_generator.rb +15 -0
- data/railties/lib/rails/generators/css/assets/templates/stylesheet.css +4 -0
- data/railties/lib/rails/generators/css/scaffold/scaffold_generator.rb +18 -0
- data/railties/lib/rails/generators/erb.rb +27 -0
- data/railties/lib/rails/generators/erb/controller/controller_generator.rb +24 -0
- data/railties/lib/rails/generators/erb/controller/templates/view.html.erb +2 -0
- data/railties/lib/rails/generators/erb/mailer/mailer_generator.rb +42 -0
- data/railties/lib/rails/generators/erb/mailer/templates/layout.html.erb.tt +13 -0
- data/railties/lib/rails/generators/erb/mailer/templates/layout.text.erb.tt +1 -0
- data/railties/lib/rails/generators/erb/mailer/templates/view.html.erb +5 -0
- data/railties/lib/rails/generators/erb/mailer/templates/view.text.erb +3 -0
- data/railties/lib/rails/generators/erb/scaffold/scaffold_generator.rb +33 -0
- data/railties/lib/rails/generators/erb/scaffold/templates/_form.html.erb +34 -0
- data/railties/lib/rails/generators/erb/scaffold/templates/edit.html.erb +6 -0
- data/railties/lib/rails/generators/erb/scaffold/templates/index.html.erb +31 -0
- data/railties/lib/rails/generators/erb/scaffold/templates/new.html.erb +5 -0
- data/railties/lib/rails/generators/erb/scaffold/templates/show.html.erb +11 -0
- data/railties/lib/rails/generators/generated_attribute.rb +177 -0
- data/railties/lib/rails/generators/js/assets/assets_generator.rb +15 -0
- data/railties/lib/rails/generators/js/assets/templates/javascript.js +2 -0
- data/railties/lib/rails/generators/migration.rb +71 -0
- data/railties/lib/rails/generators/model_helpers.rb +30 -0
- data/railties/lib/rails/generators/named_base.rb +207 -0
- data/railties/lib/rails/generators/rails/app/USAGE +14 -0
- data/railties/lib/rails/generators/rails/app/app_generator.rb +579 -0
- data/railties/lib/rails/generators/rails/app/templates/Gemfile +69 -0
- data/railties/lib/rails/generators/rails/app/templates/README.md +24 -0
- data/railties/lib/rails/generators/rails/app/templates/Rakefile +6 -0
- data/railties/lib/rails/generators/rails/app/templates/app/assets/config/manifest.js.tt +5 -0
- data/railties/lib/rails/generators/rails/app/templates/app/assets/javascripts/application.js.tt +20 -0
- data/railties/lib/rails/generators/rails/app/templates/app/assets/javascripts/cable.js +13 -0
- data/railties/lib/rails/generators/rails/app/templates/app/assets/stylesheets/application.css +15 -0
- data/railties/lib/rails/generators/rails/app/templates/app/channels/application_cable/channel.rb +4 -0
- data/railties/lib/rails/generators/rails/app/templates/app/channels/application_cable/connection.rb +4 -0
- data/railties/lib/rails/generators/rails/app/templates/app/controllers/application_controller.rb.tt +2 -0
- data/railties/lib/rails/generators/rails/app/templates/app/helpers/application_helper.rb +2 -0
- data/railties/lib/rails/generators/rails/app/templates/app/jobs/application_job.rb +2 -0
- data/railties/lib/rails/generators/rails/app/templates/app/mailers/application_mailer.rb +4 -0
- data/railties/lib/rails/generators/rails/app/templates/app/models/application_record.rb +3 -0
- data/railties/lib/rails/generators/rails/app/templates/app/views/layouts/application.html.erb.tt +23 -0
- data/railties/lib/rails/generators/rails/app/templates/app/views/layouts/mailer.html.erb.tt +13 -0
- data/railties/lib/rails/generators/rails/app/templates/app/views/layouts/mailer.text.erb.tt +1 -0
- data/railties/lib/rails/generators/rails/app/templates/bin/bundle +2 -0
- data/railties/lib/rails/generators/rails/app/templates/bin/rails +3 -0
- data/railties/lib/rails/generators/rails/app/templates/bin/rake +3 -0
- data/railties/lib/rails/generators/rails/app/templates/bin/setup.tt +39 -0
- data/railties/lib/rails/generators/rails/app/templates/bin/update.tt +29 -0
- data/railties/lib/rails/generators/rails/app/templates/bin/yarn +10 -0
- data/railties/lib/rails/generators/rails/app/templates/config.ru +5 -0
- data/railties/lib/rails/generators/rails/app/templates/config/application.rb +44 -0
- data/railties/lib/rails/generators/rails/app/templates/config/boot.rb +4 -0
- data/railties/lib/rails/generators/rails/app/templates/config/cable.yml +10 -0
- data/railties/lib/rails/generators/rails/app/templates/config/databases/frontbase.yml +50 -0
- data/railties/lib/rails/generators/rails/app/templates/config/databases/ibm_db.yml +86 -0
- data/railties/lib/rails/generators/rails/app/templates/config/databases/jdbc.yml +69 -0
- data/railties/lib/rails/generators/rails/app/templates/config/databases/jdbcmysql.yml +53 -0
- data/railties/lib/rails/generators/rails/app/templates/config/databases/jdbcpostgresql.yml +69 -0
- data/railties/lib/rails/generators/rails/app/templates/config/databases/jdbcsqlite3.yml +24 -0
- data/railties/lib/rails/generators/rails/app/templates/config/databases/mysql.yml +58 -0
- data/railties/lib/rails/generators/rails/app/templates/config/databases/oracle.yml +61 -0
- data/railties/lib/rails/generators/rails/app/templates/config/databases/postgresql.yml +85 -0
- data/railties/lib/rails/generators/rails/app/templates/config/databases/sqlite3.yml +25 -0
- data/railties/lib/rails/generators/rails/app/templates/config/databases/sqlserver.yml +52 -0
- data/railties/lib/rails/generators/rails/app/templates/config/environment.rb +5 -0
- data/railties/lib/rails/generators/rails/app/templates/config/environments/development.rb.tt +64 -0
- data/railties/lib/rails/generators/rails/app/templates/config/environments/production.rb.tt +107 -0
- data/railties/lib/rails/generators/rails/app/templates/config/environments/test.rb.tt +47 -0
- data/railties/lib/rails/generators/rails/app/templates/config/initializers/application_controller_renderer.rb +8 -0
- data/railties/lib/rails/generators/rails/app/templates/config/initializers/assets.rb.tt +16 -0
- data/railties/lib/rails/generators/rails/app/templates/config/initializers/backtrace_silencers.rb +7 -0
- data/railties/lib/rails/generators/rails/app/templates/config/initializers/cookies_serializer.rb +5 -0
- data/railties/lib/rails/generators/rails/app/templates/config/initializers/cors.rb +16 -0
- data/railties/lib/rails/generators/rails/app/templates/config/initializers/filter_parameter_logging.rb +4 -0
- data/railties/lib/rails/generators/rails/app/templates/config/initializers/inflections.rb +16 -0
- data/railties/lib/rails/generators/rails/app/templates/config/initializers/mime_types.rb +4 -0
- data/railties/lib/rails/generators/rails/app/templates/config/initializers/new_framework_defaults_5_2.rb.tt +27 -0
- data/railties/lib/rails/generators/rails/app/templates/config/initializers/wrap_parameters.rb.tt +16 -0
- data/railties/lib/rails/generators/rails/app/templates/config/locales/en.yml +33 -0
- data/railties/lib/rails/generators/rails/app/templates/config/puma.rb +56 -0
- data/railties/lib/rails/generators/rails/app/templates/config/routes.rb +3 -0
- data/railties/lib/rails/generators/rails/app/templates/config/secrets.yml +32 -0
- data/railties/lib/rails/generators/rails/app/templates/config/spring.rb +6 -0
- data/railties/lib/rails/generators/rails/app/templates/config/storage.yml +35 -0
- data/railties/lib/rails/generators/rails/app/templates/db/seeds.rb.tt +7 -0
- data/railties/lib/rails/generators/rails/app/templates/gitignore +35 -0
- data/railties/lib/rails/generators/rails/app/templates/package.json +5 -0
- data/railties/lib/rails/generators/rails/app/templates/public/404.html +67 -0
- data/railties/lib/rails/generators/rails/app/templates/public/422.html +67 -0
- data/railties/lib/rails/generators/rails/app/templates/public/500.html +66 -0
- data/railties/lib/rails/generators/rails/app/templates/public/apple-touch-icon-precomposed.png +0 -0
- data/railties/lib/rails/generators/rails/app/templates/public/apple-touch-icon.png +0 -0
- data/railties/lib/rails/generators/rails/app/templates/public/favicon.ico +0 -0
- data/railties/lib/rails/generators/rails/app/templates/public/robots.txt +1 -0
- data/railties/lib/rails/generators/rails/app/templates/ruby-version +1 -0
- data/railties/lib/rails/generators/rails/app/templates/test/application_system_test_case.rb +5 -0
- data/railties/lib/rails/generators/rails/app/templates/test/test_helper.rb +11 -0
- data/railties/lib/rails/generators/rails/application_record/application_record_generator.rb +9 -0
- data/railties/lib/rails/generators/rails/assets/USAGE +20 -0
- data/railties/lib/rails/generators/rails/assets/assets_generator.rb +27 -0
- data/railties/lib/rails/generators/rails/assets/templates/javascript.js +2 -0
- data/railties/lib/rails/generators/rails/assets/templates/stylesheet.css +4 -0
- data/railties/lib/rails/generators/rails/controller/USAGE +18 -0
- data/railties/lib/rails/generators/rails/controller/controller_generator.rb +66 -0
- data/railties/lib/rails/generators/rails/controller/templates/controller.rb +13 -0
- data/railties/lib/rails/generators/rails/encrypted_secrets/encrypted_secrets_generator.rb +72 -0
- data/railties/lib/rails/generators/rails/generator/USAGE +13 -0
- data/railties/lib/rails/generators/rails/generator/generator_generator.rb +28 -0
- data/railties/lib/rails/generators/rails/generator/templates/%file_name%_generator.rb.tt +3 -0
- data/railties/lib/rails/generators/rails/generator/templates/USAGE.tt +8 -0
- data/railties/lib/rails/generators/rails/generator/templates/templates/.empty_directory +0 -0
- data/railties/lib/rails/generators/rails/helper/USAGE +13 -0
- data/railties/lib/rails/generators/rails/helper/helper_generator.rb +15 -0
- data/railties/lib/rails/generators/rails/helper/templates/helper.rb +4 -0
- data/railties/lib/rails/generators/rails/integration_test/USAGE +10 -0
- data/railties/lib/rails/generators/rails/integration_test/integration_test_generator.rb +9 -0
- data/railties/lib/rails/generators/rails/migration/USAGE +35 -0
- data/railties/lib/rails/generators/rails/migration/migration_generator.rb +10 -0
- data/railties/lib/rails/generators/rails/model/USAGE +114 -0
- data/railties/lib/rails/generators/rails/model/model_generator.rb +14 -0
- data/railties/lib/rails/generators/rails/plugin/USAGE +10 -0
- data/railties/lib/rails/generators/rails/plugin/plugin_generator.rb +450 -0
- data/railties/lib/rails/generators/rails/plugin/templates/%name%.gemspec +24 -0
- data/railties/lib/rails/generators/rails/plugin/templates/Gemfile +48 -0
- data/railties/lib/rails/generators/rails/plugin/templates/MIT-LICENSE +20 -0
- data/railties/lib/rails/generators/rails/plugin/templates/README.md +28 -0
- data/railties/lib/rails/generators/rails/plugin/templates/Rakefile +28 -0
- data/railties/lib/rails/generators/rails/plugin/templates/app/controllers/%namespaced_name%/application_controller.rb.tt +6 -0
- data/railties/lib/rails/generators/rails/plugin/templates/app/helpers/%namespaced_name%/application_helper.rb.tt +5 -0
- data/railties/lib/rails/generators/rails/plugin/templates/app/jobs/%namespaced_name%/application_job.rb.tt +5 -0
- data/railties/lib/rails/generators/rails/plugin/templates/app/mailers/%namespaced_name%/application_mailer.rb.tt +7 -0
- data/railties/lib/rails/generators/rails/plugin/templates/app/models/%namespaced_name%/application_record.rb.tt +6 -0
- data/railties/lib/rails/generators/rails/plugin/templates/app/views/layouts/%namespaced_name%/application.html.erb.tt +14 -0
- data/railties/lib/rails/generators/rails/plugin/templates/bin/rails.tt +30 -0
- data/railties/lib/rails/generators/rails/plugin/templates/bin/test.tt +4 -0
- data/railties/lib/rails/generators/rails/plugin/templates/config/routes.rb +6 -0
- data/railties/lib/rails/generators/rails/plugin/templates/gitignore +15 -0
- data/railties/lib/rails/generators/rails/plugin/templates/lib/%namespaced_name%.rb +7 -0
- data/railties/lib/rails/generators/rails/plugin/templates/lib/%namespaced_name%/engine.rb +7 -0
- data/railties/lib/rails/generators/rails/plugin/templates/lib/%namespaced_name%/railtie.rb +5 -0
- data/railties/lib/rails/generators/rails/plugin/templates/lib/%namespaced_name%/version.rb +1 -0
- data/railties/lib/rails/generators/rails/plugin/templates/lib/tasks/%namespaced_name%_tasks.rake +4 -0
- data/railties/lib/rails/generators/rails/plugin/templates/rails/application.rb +23 -0
- data/railties/lib/rails/generators/rails/plugin/templates/rails/boot.rb +5 -0
- data/railties/lib/rails/generators/rails/plugin/templates/rails/dummy_manifest.js +10 -0
- data/railties/lib/rails/generators/rails/plugin/templates/rails/engine_manifest.js +6 -0
- data/railties/lib/rails/generators/rails/plugin/templates/rails/javascripts.js +13 -0
- data/railties/lib/rails/generators/rails/plugin/templates/rails/routes.rb +3 -0
- data/railties/lib/rails/generators/rails/plugin/templates/rails/stylesheets.css +15 -0
- data/railties/lib/rails/generators/rails/plugin/templates/test/%namespaced_name%_test.rb +7 -0
- data/railties/lib/rails/generators/rails/plugin/templates/test/application_system_test_case.rb +5 -0
- data/railties/lib/rails/generators/rails/plugin/templates/test/integration/navigation_test.rb +7 -0
- data/railties/lib/rails/generators/rails/plugin/templates/test/test_helper.rb +26 -0
- data/railties/lib/rails/generators/rails/resource/USAGE +23 -0
- data/railties/lib/rails/generators/rails/resource/resource_generator.rb +21 -0
- data/railties/lib/rails/generators/rails/resource_route/resource_route_generator.rb +48 -0
- data/railties/lib/rails/generators/rails/scaffold/USAGE +41 -0
- data/railties/lib/rails/generators/rails/scaffold/scaffold_generator.rb +36 -0
- data/railties/lib/rails/generators/rails/scaffold/templates/scaffold.css +80 -0
- data/railties/lib/rails/generators/rails/scaffold_controller/USAGE +19 -0
- data/railties/lib/rails/generators/rails/scaffold_controller/scaffold_controller_generator.rb +37 -0
- data/railties/lib/rails/generators/rails/scaffold_controller/templates/api_controller.rb +61 -0
- data/railties/lib/rails/generators/rails/scaffold_controller/templates/controller.rb +68 -0
- data/railties/lib/rails/generators/rails/system_test/USAGE +10 -0
- data/railties/lib/rails/generators/rails/system_test/system_test_generator.rb +9 -0
- data/railties/lib/rails/generators/rails/task/USAGE +9 -0
- data/railties/lib/rails/generators/rails/task/task_generator.rb +13 -0
- data/railties/lib/rails/generators/rails/task/templates/task.rb +8 -0
- data/railties/lib/rails/generators/resource_helpers.rb +87 -0
- data/railties/lib/rails/generators/test_case.rb +37 -0
- data/railties/lib/rails/generators/test_unit.rb +10 -0
- data/railties/lib/rails/generators/test_unit/controller/controller_generator.rb +17 -0
- data/railties/lib/rails/generators/test_unit/controller/templates/functional_test.rb +25 -0
- data/railties/lib/rails/generators/test_unit/generator/generator_generator.rb +28 -0
- data/railties/lib/rails/generators/test_unit/generator/templates/generator_test.rb +18 -0
- data/railties/lib/rails/generators/test_unit/helper/helper_generator.rb +11 -0
- data/railties/lib/rails/generators/test_unit/integration/integration_generator.rb +15 -0
- data/railties/lib/rails/generators/test_unit/integration/templates/integration_test.rb +11 -0
- data/railties/lib/rails/generators/test_unit/job/job_generator.rb +15 -0
- data/railties/lib/rails/generators/test_unit/job/templates/unit_test.rb.erb +9 -0
- data/railties/lib/rails/generators/test_unit/mailer/mailer_generator.rb +28 -0
- data/railties/lib/rails/generators/test_unit/mailer/templates/functional_test.rb +23 -0
- data/railties/lib/rails/generators/test_unit/mailer/templates/preview.rb +15 -0
- data/railties/lib/rails/generators/test_unit/model/model_generator.rb +37 -0
- data/railties/lib/rails/generators/test_unit/model/templates/fixtures.yml +29 -0
- data/railties/lib/rails/generators/test_unit/model/templates/unit_test.rb +11 -0
- data/railties/lib/rails/generators/test_unit/plugin/plugin_generator.rb +15 -0
- data/railties/lib/rails/generators/test_unit/plugin/templates/%file_name%_test.rb.tt +7 -0
- data/railties/lib/rails/generators/test_unit/plugin/templates/test_helper.rb +4 -0
- data/railties/lib/rails/generators/test_unit/scaffold/scaffold_generator.rb +59 -0
- data/railties/lib/rails/generators/test_unit/scaffold/templates/api_functional_test.rb +46 -0
- data/railties/lib/rails/generators/test_unit/scaffold/templates/functional_test.rb +56 -0
- data/railties/lib/rails/generators/test_unit/scaffold/templates/system_test.rb +51 -0
- data/railties/lib/rails/generators/test_unit/system/system_generator.rb +19 -0
- data/railties/lib/rails/generators/test_unit/system/templates/application_system_test_case.rb +7 -0
- data/railties/lib/rails/generators/test_unit/system/templates/system_test.rb +11 -0
- data/railties/lib/rails/generators/testing/assertions.rb +127 -0
- data/railties/lib/rails/generators/testing/behaviour.rb +111 -0
- data/railties/lib/rails/generators/testing/setup_and_teardown.rb +20 -0
- data/railties/lib/rails/info.rb +105 -0
- data/railties/lib/rails/info_controller.rb +46 -0
- data/railties/lib/rails/initializable.rb +95 -0
- data/railties/lib/rails/mailers_controller.rb +87 -0
- data/railties/lib/rails/paths.rb +227 -0
- data/railties/lib/rails/plugin/test.rb +9 -0
- data/railties/lib/rails/rack.rb +7 -0
- data/railties/lib/rails/rack/logger.rb +80 -0
- data/railties/lib/rails/railtie.rb +260 -0
- data/railties/lib/rails/railtie/configurable.rb +37 -0
- data/railties/lib/rails/railtie/configuration.rb +102 -0
- data/railties/lib/rails/ruby_version_check.rb +15 -0
- data/railties/lib/rails/secrets.rb +123 -0
- data/railties/lib/rails/source_annotation_extractor.rb +141 -0
- data/railties/lib/rails/tasks.rb +22 -0
- data/railties/lib/rails/tasks/annotations.rake +22 -0
- data/railties/lib/rails/tasks/dev.rake +10 -0
- data/railties/lib/rails/tasks/engine.rake +85 -0
- data/railties/lib/rails/tasks/framework.rake +58 -0
- data/railties/lib/rails/tasks/initializers.rake +8 -0
- data/railties/lib/rails/tasks/log.rake +42 -0
- data/railties/lib/rails/tasks/middleware.rake +9 -0
- data/railties/lib/rails/tasks/misc.rake +79 -0
- data/railties/lib/rails/tasks/restart.rake +9 -0
- data/railties/lib/rails/tasks/routes.rake +31 -0
- data/railties/lib/rails/tasks/statistics.rake +31 -0
- data/railties/lib/rails/tasks/tmp.rake +44 -0
- data/railties/lib/rails/tasks/yarn.rake +13 -0
- data/railties/lib/rails/templates/layouts/application.html.erb +36 -0
- data/railties/lib/rails/templates/rails/info/properties.html.erb +1 -0
- data/railties/lib/rails/templates/rails/info/routes.html.erb +9 -0
- data/railties/lib/rails/templates/rails/mailers/email.html.erb +133 -0
- data/railties/lib/rails/templates/rails/mailers/index.html.erb +8 -0
- data/railties/lib/rails/templates/rails/mailers/mailer.html.erb +6 -0
- data/railties/lib/rails/templates/rails/welcome/index.html.erb +74 -0
- data/railties/lib/rails/test_help.rb +52 -0
- data/railties/lib/rails/test_unit/line_filtering.rb +13 -0
- data/railties/lib/rails/test_unit/railtie.rb +29 -0
- data/railties/lib/rails/test_unit/reporter.rb +104 -0
- data/railties/lib/rails/test_unit/runner.rb +143 -0
- data/railties/lib/rails/test_unit/testing.rake +58 -0
- data/railties/lib/rails/version.rb +10 -0
- data/railties/lib/rails/welcome_controller.rb +10 -0
- data/railties/railties.gemspec +41 -0
- data/railties/test/abstract_unit.rb +33 -0
- data/railties/test/app_loader_test.rb +91 -0
- data/railties/test/application/asset_debugging_test.rb +171 -0
- data/railties/test/application/assets_test.rb +524 -0
- data/railties/test/application/bin_setup_test.rb +62 -0
- data/railties/test/application/configuration/custom_test.rb +47 -0
- data/railties/test/application/configuration_test.rb +1816 -0
- data/railties/test/application/console_test.rb +158 -0
- data/railties/test/application/current_attributes_integration_test.rb +86 -0
- data/railties/test/application/dbconsole_test.rb +78 -0
- data/railties/test/application/generators_test.rb +200 -0
- data/railties/test/application/help_test.rb +25 -0
- data/railties/test/application/initializers/frameworks_test.rb +276 -0
- data/railties/test/application/initializers/hooks_test.rb +91 -0
- data/railties/test/application/initializers/i18n_test.rb +296 -0
- data/railties/test/application/initializers/load_path_test.rb +111 -0
- data/railties/test/application/initializers/notifications_test.rb +57 -0
- data/railties/test/application/integration_test_case_test.rb +75 -0
- data/railties/test/application/loading_test.rb +373 -0
- data/railties/test/application/mailer_previews_test.rb +787 -0
- data/railties/test/application/middleware/cache_test.rb +181 -0
- data/railties/test/application/middleware/cookies_test.rb +48 -0
- data/railties/test/application/middleware/exceptions_test.rb +140 -0
- data/railties/test/application/middleware/remote_ip_test.rb +80 -0
- data/railties/test/application/middleware/sendfile_test.rb +75 -0
- data/railties/test/application/middleware/session_test.rb +459 -0
- data/railties/test/application/middleware/static_test.rb +70 -0
- data/railties/test/application/middleware_test.rb +312 -0
- data/railties/test/application/multiple_applications_test.rb +177 -0
- data/railties/test/application/paths_test.rb +84 -0
- data/railties/test/application/per_request_digest_cache_test.rb +72 -0
- data/railties/test/application/rack/logger_test.rb +58 -0
- data/railties/test/application/rackup_test.rb +44 -0
- data/railties/test/application/rake/dbs_test.rb +320 -0
- data/railties/test/application/rake/dev_test.rb +49 -0
- data/railties/test/application/rake/framework_test.rb +48 -0
- data/railties/test/application/rake/log_test.rb +35 -0
- data/railties/test/application/rake/migrations_test.rb +306 -0
- data/railties/test/application/rake/notes_test.rb +171 -0
- data/railties/test/application/rake/restart_test.rb +40 -0
- data/railties/test/application/rake/tmp_test.rb +45 -0
- data/railties/test/application/rake_test.rb +425 -0
- data/railties/test/application/rendering_test.rb +46 -0
- data/railties/test/application/routing_test.rb +682 -0
- data/railties/test/application/runner_test.rb +135 -0
- data/railties/test/application/server_test.rb +61 -0
- data/railties/test/application/test_runner_test.rb +771 -0
- data/railties/test/application/test_test.rb +340 -0
- data/railties/test/application/url_generation_test.rb +59 -0
- data/railties/test/application/version_test.rb +26 -0
- data/railties/test/backtrace_cleaner_test.rb +34 -0
- data/railties/test/code_statistics_calculator_test.rb +332 -0
- data/railties/test/code_statistics_test.rb +34 -0
- data/railties/test/command/base_test.rb +13 -0
- data/railties/test/commands/console_test.rb +192 -0
- data/railties/test/commands/dbconsole_test.rb +355 -0
- data/railties/test/commands/secrets_test.rb +49 -0
- data/railties/test/commands/server_test.rb +204 -0
- data/railties/test/configuration/middleware_stack_proxy_test.rb +63 -0
- data/railties/test/console_helpers.rb +25 -0
- data/railties/test/engine/commands_test.rb +80 -0
- data/railties/test/engine_test.rb +27 -0
- data/railties/test/env_helpers.rb +32 -0
- data/railties/test/fixtures/about_yml_plugins/bad_about_yml/about.yml +1 -0
- data/railties/test/fixtures/about_yml_plugins/bad_about_yml/init.rb +3 -0
- data/railties/test/fixtures/about_yml_plugins/plugin_without_about_yml/init.rb +3 -0
- data/railties/test/fixtures/lib/create_test_dummy_template.rb +3 -0
- data/railties/test/fixtures/lib/generators/active_record/fixjour_generator.rb +10 -0
- data/railties/test/fixtures/lib/generators/fixjour_generator.rb +4 -0
- data/railties/test/fixtures/lib/generators/model_generator.rb +3 -0
- data/railties/test/fixtures/lib/generators/usage_template/USAGE +1 -0
- data/railties/test/fixtures/lib/generators/usage_template/usage_template_generator.rb +7 -0
- data/railties/test/fixtures/lib/rails/generators/foobar/foobar_generator.rb +6 -0
- data/railties/test/fixtures/lib/template.rb +3 -0
- data/railties/test/generators/actions_test.rb +442 -0
- data/railties/test/generators/api_app_generator_test.rb +164 -0
- data/railties/test/generators/app_generator_test.rb +823 -0
- data/railties/test/generators/application_record_generator_test.rb +16 -0
- data/railties/test/generators/argv_scrubber_test.rb +138 -0
- data/railties/test/generators/assets_generator_test.rb +21 -0
- data/railties/test/generators/channel_generator_test.rb +79 -0
- data/railties/test/generators/controller_generator_test.rb +112 -0
- data/railties/test/generators/create_migration_test.rb +136 -0
- data/railties/test/generators/encrypted_secrets_generator_test.rb +44 -0
- data/railties/test/generators/generated_attribute_test.rb +154 -0
- data/railties/test/generators/generator_generator_test.rb +73 -0
- data/railties/test/generators/generator_test.rb +102 -0
- data/railties/test/generators/generators_test_helper.rb +51 -0
- data/railties/test/generators/helper_generator_test.rb +41 -0
- data/railties/test/generators/integration_test_generator_test.rb +18 -0
- data/railties/test/generators/job_generator_test.rb +38 -0
- data/railties/test/generators/mailer_generator_test.rb +179 -0
- data/railties/test/generators/migration_generator_test.rb +356 -0
- data/railties/test/generators/model_generator_test.rb +469 -0
- data/railties/test/generators/named_base_test.rb +141 -0
- data/railties/test/generators/namespaced_generators_test.rb +436 -0
- data/railties/test/generators/orm_test.rb +40 -0
- data/railties/test/generators/plugin_generator_test.rb +756 -0
- data/railties/test/generators/plugin_test_helper.rb +26 -0
- data/railties/test/generators/plugin_test_runner_test.rb +116 -0
- data/railties/test/generators/resource_generator_test.rb +90 -0
- data/railties/test/generators/scaffold_controller_generator_test.rb +254 -0
- data/railties/test/generators/scaffold_generator_test.rb +652 -0
- data/railties/test/generators/shared_generator_tests.rb +270 -0
- data/railties/test/generators/system_test_generator_test.rb +19 -0
- data/railties/test/generators/task_generator_test.rb +26 -0
- data/railties/test/generators/test_runner_in_engine_test.rb +34 -0
- data/railties/test/generators_test.rb +248 -0
- data/railties/test/initializable_test.rb +236 -0
- data/railties/test/isolation/abstract_unit.rb +332 -0
- data/railties/test/json_params_parsing_test.rb +51 -0
- data/railties/test/path_generation_test.rb +85 -0
- data/railties/test/paths_test.rb +298 -0
- data/railties/test/rack_logger_test.rb +77 -0
- data/railties/test/rails_info_controller_test.rb +89 -0
- data/railties/test/rails_info_test.rb +73 -0
- data/railties/test/railties/engine_test.rb +1476 -0
- data/railties/test/railties/generators_test.rb +132 -0
- data/railties/test/railties/mounted_engine_test.rb +281 -0
- data/railties/test/railties/railtie_test.rb +216 -0
- data/railties/test/secrets_test.rb +178 -0
- data/railties/test/test_unit/reporter_test.rb +198 -0
- data/railties/test/version_test.rb +14 -0
- data/tasks/release.rb +253 -0
- data/tasks/release_announcement_draft.erb +38 -0
- data/tools/README.md +10 -0
- data/tools/console +11 -0
- data/tools/line_statistics +42 -0
- data/tools/profile +138 -0
- data/tools/test.rb +26 -0
- data/version.rb +17 -0
- metadata +3544 -0
@@ -0,0 +1,331 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "cases/helper"
|
4
|
+
require "models/post"
|
5
|
+
require "models/comment"
|
6
|
+
require "models/author"
|
7
|
+
require "models/rating"
|
8
|
+
|
9
|
+
module ActiveRecord
|
10
|
+
class RelationTest < ActiveRecord::TestCase
|
11
|
+
fixtures :posts, :comments, :authors, :author_addresses, :ratings
|
12
|
+
|
13
|
+
def test_construction
|
14
|
+
relation = Relation.new(FakeKlass, :b, nil)
|
15
|
+
assert_equal FakeKlass, relation.klass
|
16
|
+
assert_equal :b, relation.table
|
17
|
+
assert !relation.loaded, "relation is not loaded"
|
18
|
+
end
|
19
|
+
|
20
|
+
def test_responds_to_model_and_returns_klass
|
21
|
+
relation = Relation.new(FakeKlass, :b, nil)
|
22
|
+
assert_equal FakeKlass, relation.model
|
23
|
+
end
|
24
|
+
|
25
|
+
def test_initialize_single_values
|
26
|
+
relation = Relation.new(FakeKlass, :b, nil)
|
27
|
+
(Relation::SINGLE_VALUE_METHODS - [:create_with, :readonly]).each do |method|
|
28
|
+
assert_nil relation.send("#{method}_value"), method.to_s
|
29
|
+
end
|
30
|
+
assert_equal false, relation.readonly_value
|
31
|
+
value = relation.create_with_value
|
32
|
+
assert_equal({}, value)
|
33
|
+
assert_predicate value, :frozen?
|
34
|
+
end
|
35
|
+
|
36
|
+
def test_multi_value_initialize
|
37
|
+
relation = Relation.new(FakeKlass, :b, nil)
|
38
|
+
Relation::MULTI_VALUE_METHODS.each do |method|
|
39
|
+
values = relation.send("#{method}_values")
|
40
|
+
assert_equal [], values, method.to_s
|
41
|
+
assert_predicate values, :frozen?, method.to_s
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
45
|
+
def test_extensions
|
46
|
+
relation = Relation.new(FakeKlass, :b, nil)
|
47
|
+
assert_equal [], relation.extensions
|
48
|
+
end
|
49
|
+
|
50
|
+
def test_empty_where_values_hash
|
51
|
+
relation = Relation.new(FakeKlass, :b, nil)
|
52
|
+
assert_equal({}, relation.where_values_hash)
|
53
|
+
end
|
54
|
+
|
55
|
+
def test_has_values
|
56
|
+
relation = Relation.new(Post, Post.arel_table, Post.predicate_builder)
|
57
|
+
relation.where!(id: 10)
|
58
|
+
assert_equal({ "id" => 10 }, relation.where_values_hash)
|
59
|
+
end
|
60
|
+
|
61
|
+
def test_values_wrong_table
|
62
|
+
relation = Relation.new(Post, Post.arel_table, Post.predicate_builder)
|
63
|
+
relation.where! Comment.arel_table[:id].eq(10)
|
64
|
+
assert_equal({}, relation.where_values_hash)
|
65
|
+
end
|
66
|
+
|
67
|
+
def test_tree_is_not_traversed
|
68
|
+
relation = Relation.new(Post, Post.arel_table, Post.predicate_builder)
|
69
|
+
left = relation.table[:id].eq(10)
|
70
|
+
right = relation.table[:id].eq(10)
|
71
|
+
combine = left.and right
|
72
|
+
relation.where! combine
|
73
|
+
assert_equal({}, relation.where_values_hash)
|
74
|
+
end
|
75
|
+
|
76
|
+
def test_table_name_delegates_to_klass
|
77
|
+
relation = Relation.new(FakeKlass, :b, Post.predicate_builder)
|
78
|
+
assert_equal "posts", relation.table_name
|
79
|
+
end
|
80
|
+
|
81
|
+
def test_scope_for_create
|
82
|
+
relation = Relation.new(FakeKlass, :b, nil)
|
83
|
+
assert_equal({}, relation.scope_for_create)
|
84
|
+
end
|
85
|
+
|
86
|
+
def test_create_with_value
|
87
|
+
relation = Relation.new(Post, Post.arel_table, Post.predicate_builder)
|
88
|
+
relation.create_with_value = { hello: "world" }
|
89
|
+
assert_equal({ "hello" => "world" }, relation.scope_for_create)
|
90
|
+
end
|
91
|
+
|
92
|
+
def test_create_with_value_with_wheres
|
93
|
+
relation = Relation.new(Post, Post.arel_table, Post.predicate_builder)
|
94
|
+
assert_equal({}, relation.scope_for_create)
|
95
|
+
|
96
|
+
relation.where!(id: 10)
|
97
|
+
assert_equal({ "id" => 10 }, relation.scope_for_create)
|
98
|
+
|
99
|
+
relation.create_with_value = { hello: "world" }
|
100
|
+
assert_equal({ "hello" => "world", "id" => 10 }, relation.scope_for_create)
|
101
|
+
end
|
102
|
+
|
103
|
+
def test_empty_scope
|
104
|
+
relation = Relation.new(Post, Post.arel_table, Post.predicate_builder)
|
105
|
+
assert relation.empty_scope?
|
106
|
+
|
107
|
+
relation.merge!(relation)
|
108
|
+
assert relation.empty_scope?
|
109
|
+
end
|
110
|
+
|
111
|
+
def test_bad_constants_raise_errors
|
112
|
+
assert_raises(NameError) do
|
113
|
+
ActiveRecord::Relation::HelloWorld
|
114
|
+
end
|
115
|
+
end
|
116
|
+
|
117
|
+
def test_empty_eager_loading?
|
118
|
+
relation = Relation.new(FakeKlass, :b, nil)
|
119
|
+
assert !relation.eager_loading?
|
120
|
+
end
|
121
|
+
|
122
|
+
def test_eager_load_values
|
123
|
+
relation = Relation.new(FakeKlass, :b, nil)
|
124
|
+
relation.eager_load! :b
|
125
|
+
assert relation.eager_loading?
|
126
|
+
end
|
127
|
+
|
128
|
+
def test_references_values
|
129
|
+
relation = Relation.new(FakeKlass, :b, nil)
|
130
|
+
assert_equal [], relation.references_values
|
131
|
+
relation = relation.references(:foo).references(:omg, :lol)
|
132
|
+
assert_equal ["foo", "omg", "lol"], relation.references_values
|
133
|
+
end
|
134
|
+
|
135
|
+
def test_references_values_dont_duplicate
|
136
|
+
relation = Relation.new(FakeKlass, :b, nil)
|
137
|
+
relation = relation.references(:foo).references(:foo)
|
138
|
+
assert_equal ["foo"], relation.references_values
|
139
|
+
end
|
140
|
+
|
141
|
+
test "merging a hash into a relation" do
|
142
|
+
relation = Relation.new(Post, Post.arel_table, Post.predicate_builder)
|
143
|
+
relation = relation.merge where: { name: :lol }, readonly: true
|
144
|
+
|
145
|
+
assert_equal({ "name" => :lol }, relation.where_clause.to_h)
|
146
|
+
assert_equal true, relation.readonly_value
|
147
|
+
end
|
148
|
+
|
149
|
+
test "merging an empty hash into a relation" do
|
150
|
+
assert_equal Relation::WhereClause.empty, Relation.new(FakeKlass, :b, nil).merge({}).where_clause
|
151
|
+
end
|
152
|
+
|
153
|
+
test "merging a hash with unknown keys raises" do
|
154
|
+
assert_raises(ArgumentError) { Relation::HashMerger.new(nil, omg: "lol") }
|
155
|
+
end
|
156
|
+
|
157
|
+
test "merging nil or false raises" do
|
158
|
+
relation = Relation.new(FakeKlass, :b, nil)
|
159
|
+
|
160
|
+
e = assert_raises(ArgumentError) do
|
161
|
+
relation = relation.merge nil
|
162
|
+
end
|
163
|
+
|
164
|
+
assert_equal "invalid argument: nil.", e.message
|
165
|
+
|
166
|
+
e = assert_raises(ArgumentError) do
|
167
|
+
relation = relation.merge false
|
168
|
+
end
|
169
|
+
|
170
|
+
assert_equal "invalid argument: false.", e.message
|
171
|
+
end
|
172
|
+
|
173
|
+
test "#values returns a dup of the values" do
|
174
|
+
relation = Relation.new(Post, Post.arel_table, Post.predicate_builder).where!(name: :foo)
|
175
|
+
values = relation.values
|
176
|
+
|
177
|
+
values[:where] = nil
|
178
|
+
assert_not_nil relation.where_clause
|
179
|
+
end
|
180
|
+
|
181
|
+
test "relations can be created with a values hash" do
|
182
|
+
relation = Relation.new(FakeKlass, :b, nil, select: [:foo])
|
183
|
+
assert_equal [:foo], relation.select_values
|
184
|
+
end
|
185
|
+
|
186
|
+
test "merging a hash interpolates conditions" do
|
187
|
+
klass = Class.new(FakeKlass) do
|
188
|
+
def self.sanitize_sql(args)
|
189
|
+
raise unless args == ["foo = ?", "bar"]
|
190
|
+
"foo = bar"
|
191
|
+
end
|
192
|
+
end
|
193
|
+
|
194
|
+
relation = Relation.new(klass, :b, nil)
|
195
|
+
relation.merge!(where: ["foo = ?", "bar"])
|
196
|
+
assert_equal Relation::WhereClause.new(["foo = bar"]), relation.where_clause
|
197
|
+
end
|
198
|
+
|
199
|
+
def test_merging_readonly_false
|
200
|
+
relation = Relation.new(FakeKlass, :b, nil)
|
201
|
+
readonly_false_relation = relation.readonly(false)
|
202
|
+
# test merging in both directions
|
203
|
+
assert_equal false, relation.merge(readonly_false_relation).readonly_value
|
204
|
+
assert_equal false, readonly_false_relation.merge(relation).readonly_value
|
205
|
+
end
|
206
|
+
|
207
|
+
def test_relation_merging_with_merged_joins_as_symbols
|
208
|
+
special_comments_with_ratings = SpecialComment.joins(:ratings)
|
209
|
+
posts_with_special_comments_with_ratings = Post.group("posts.id").joins(:special_comments).merge(special_comments_with_ratings)
|
210
|
+
assert_equal({ 4 => 2 }, authors(:david).posts.merge(posts_with_special_comments_with_ratings).count)
|
211
|
+
end
|
212
|
+
|
213
|
+
def test_relation_merging_with_merged_symbol_joins_keeps_inner_joins
|
214
|
+
queries = capture_sql { Author.joins(:posts).merge(Post.joins(:comments)).to_a }
|
215
|
+
|
216
|
+
nb_inner_join = queries.sum { |sql| sql.scan(/INNER\s+JOIN/i).size }
|
217
|
+
assert_equal 2, nb_inner_join, "Wrong amount of INNER JOIN in query"
|
218
|
+
assert queries.none? { |sql| /LEFT\s+(OUTER)?\s+JOIN/i.match?(sql) }, "Shouldn't have any LEFT JOIN in query"
|
219
|
+
end
|
220
|
+
|
221
|
+
def test_relation_merging_with_merged_symbol_joins_has_correct_size_and_count
|
222
|
+
# Has one entry per comment
|
223
|
+
merged_authors_with_commented_posts_relation = Author.joins(:posts).merge(Post.joins(:comments))
|
224
|
+
|
225
|
+
post_ids_with_author = Post.joins(:author).pluck(:id)
|
226
|
+
manual_comments_on_post_that_have_author = Comment.where(post_id: post_ids_with_author).pluck(:id)
|
227
|
+
|
228
|
+
assert_equal manual_comments_on_post_that_have_author.size, merged_authors_with_commented_posts_relation.count
|
229
|
+
assert_equal manual_comments_on_post_that_have_author.size, merged_authors_with_commented_posts_relation.to_a.size
|
230
|
+
end
|
231
|
+
|
232
|
+
def test_relation_merging_with_joins_as_join_dependency_pick_proper_parent
|
233
|
+
post = Post.create!(title: "haha", body: "huhu")
|
234
|
+
comment = post.comments.create!(body: "hu")
|
235
|
+
3.times { comment.ratings.create! }
|
236
|
+
|
237
|
+
relation = Post.joins(:comments).merge Comment.joins(:ratings)
|
238
|
+
|
239
|
+
assert_equal 3, relation.where(id: post.id).pluck(:id).size
|
240
|
+
end
|
241
|
+
|
242
|
+
def test_merge_raises_with_invalid_argument
|
243
|
+
assert_raises ArgumentError do
|
244
|
+
relation = Relation.new(FakeKlass, :b, nil)
|
245
|
+
relation.merge(true)
|
246
|
+
end
|
247
|
+
end
|
248
|
+
|
249
|
+
def test_respond_to_for_non_selected_element
|
250
|
+
post = Post.select(:title).first
|
251
|
+
assert_equal false, post.respond_to?(:body), "post should not respond_to?(:body) since invoking it raises exception"
|
252
|
+
|
253
|
+
silence_warnings { post = Post.select("'title' as post_title").first }
|
254
|
+
assert_equal false, post.respond_to?(:title), "post should not respond_to?(:body) since invoking it raises exception"
|
255
|
+
end
|
256
|
+
|
257
|
+
def test_select_quotes_when_using_from_clause
|
258
|
+
skip_if_sqlite3_version_includes_quoting_bug
|
259
|
+
quoted_join = ActiveRecord::Base.connection.quote_table_name("join")
|
260
|
+
selected = Post.select(:join).from(Post.select("id as #{quoted_join}")).map(&:join)
|
261
|
+
assert_equal Post.pluck(:id), selected
|
262
|
+
end
|
263
|
+
|
264
|
+
def test_selecting_aliased_attribute_quotes_column_name_when_from_is_used
|
265
|
+
skip_if_sqlite3_version_includes_quoting_bug
|
266
|
+
klass = Class.new(ActiveRecord::Base) do
|
267
|
+
self.table_name = :test_with_keyword_column_name
|
268
|
+
alias_attribute :description, :desc
|
269
|
+
end
|
270
|
+
klass.create!(description: "foo")
|
271
|
+
|
272
|
+
assert_equal ["foo"], klass.select(:description).from(klass.all).map(&:desc)
|
273
|
+
end
|
274
|
+
|
275
|
+
def test_relation_merging_with_merged_joins_as_strings
|
276
|
+
join_string = "LEFT OUTER JOIN #{Rating.quoted_table_name} ON #{SpecialComment.quoted_table_name}.id = #{Rating.quoted_table_name}.comment_id"
|
277
|
+
special_comments_with_ratings = SpecialComment.joins join_string
|
278
|
+
posts_with_special_comments_with_ratings = Post.group("posts.id").joins(:special_comments).merge(special_comments_with_ratings)
|
279
|
+
assert_equal({ 2 => 1, 4 => 3, 5 => 1 }, authors(:david).posts.merge(posts_with_special_comments_with_ratings).count)
|
280
|
+
end
|
281
|
+
|
282
|
+
class EnsureRoundTripTypeCasting < ActiveRecord::Type::Value
|
283
|
+
def type
|
284
|
+
:string
|
285
|
+
end
|
286
|
+
|
287
|
+
def deserialize(value)
|
288
|
+
raise value unless value == "type cast for database"
|
289
|
+
"type cast from database"
|
290
|
+
end
|
291
|
+
|
292
|
+
def serialize(value)
|
293
|
+
raise value unless value == "value from user"
|
294
|
+
"type cast for database"
|
295
|
+
end
|
296
|
+
end
|
297
|
+
|
298
|
+
class UpdateAllTestModel < ActiveRecord::Base
|
299
|
+
self.table_name = "posts"
|
300
|
+
|
301
|
+
attribute :body, EnsureRoundTripTypeCasting.new
|
302
|
+
end
|
303
|
+
|
304
|
+
def test_update_all_goes_through_normal_type_casting
|
305
|
+
UpdateAllTestModel.update_all(body: "value from user", type: nil) # No STI
|
306
|
+
|
307
|
+
assert_equal "type cast from database", UpdateAllTestModel.first.body
|
308
|
+
end
|
309
|
+
|
310
|
+
private
|
311
|
+
|
312
|
+
def skip_if_sqlite3_version_includes_quoting_bug
|
313
|
+
if sqlite3_version_includes_quoting_bug?
|
314
|
+
skip <<-ERROR.squish
|
315
|
+
You are using an outdated version of SQLite3 which has a bug in
|
316
|
+
quoted column names. Please update SQLite3 and rebuild the sqlite3
|
317
|
+
ruby gem
|
318
|
+
ERROR
|
319
|
+
end
|
320
|
+
end
|
321
|
+
|
322
|
+
def sqlite3_version_includes_quoting_bug?
|
323
|
+
if current_adapter?(:SQLite3Adapter)
|
324
|
+
selected_quoted_column_names = ActiveRecord::Base.connection.exec_query(
|
325
|
+
'SELECT "join" FROM (SELECT id AS "join" FROM posts) subquery'
|
326
|
+
).columns
|
327
|
+
["join"] != selected_quoted_column_names
|
328
|
+
end
|
329
|
+
end
|
330
|
+
end
|
331
|
+
end
|
@@ -0,0 +1,1923 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "cases/helper"
|
4
|
+
require "models/tag"
|
5
|
+
require "models/tagging"
|
6
|
+
require "models/post"
|
7
|
+
require "models/topic"
|
8
|
+
require "models/comment"
|
9
|
+
require "models/author"
|
10
|
+
require "models/entrant"
|
11
|
+
require "models/developer"
|
12
|
+
require "models/computer"
|
13
|
+
require "models/reply"
|
14
|
+
require "models/company"
|
15
|
+
require "models/bird"
|
16
|
+
require "models/car"
|
17
|
+
require "models/engine"
|
18
|
+
require "models/tyre"
|
19
|
+
require "models/minivan"
|
20
|
+
require "models/possession"
|
21
|
+
require "models/reader"
|
22
|
+
require "models/categorization"
|
23
|
+
require "models/edge"
|
24
|
+
|
25
|
+
class RelationTest < ActiveRecord::TestCase
|
26
|
+
fixtures :authors, :author_addresses, :topics, :entrants, :developers, :companies, :developers_projects, :accounts, :categories, :categorizations, :posts, :comments,
|
27
|
+
:tags, :taggings, :cars, :minivans
|
28
|
+
|
29
|
+
class TopicWithCallbacks < ActiveRecord::Base
|
30
|
+
self.table_name = :topics
|
31
|
+
before_update { |topic| topic.author_name = "David" if topic.author_name.blank? }
|
32
|
+
end
|
33
|
+
|
34
|
+
def test_do_not_double_quote_string_id
|
35
|
+
van = Minivan.last
|
36
|
+
assert van
|
37
|
+
assert_equal van.id, Minivan.where(minivan_id: van).to_a.first.minivan_id
|
38
|
+
end
|
39
|
+
|
40
|
+
def test_do_not_double_quote_string_id_with_array
|
41
|
+
van = Minivan.last
|
42
|
+
assert van
|
43
|
+
assert_equal van, Minivan.where(minivan_id: [van]).to_a.first
|
44
|
+
end
|
45
|
+
|
46
|
+
def test_two_scopes_with_includes_should_not_drop_any_include
|
47
|
+
# heat habtm cache
|
48
|
+
car = Car.incl_engines.incl_tyres.first
|
49
|
+
car.tyres.length
|
50
|
+
car.engines.length
|
51
|
+
|
52
|
+
car = Car.incl_engines.incl_tyres.first
|
53
|
+
assert_no_queries { car.tyres.length }
|
54
|
+
assert_no_queries { car.engines.length }
|
55
|
+
end
|
56
|
+
|
57
|
+
def test_dynamic_finder
|
58
|
+
x = Post.where("author_id = ?", 1)
|
59
|
+
assert x.klass.respond_to?(:find_by_id), "@klass should handle dynamic finders"
|
60
|
+
end
|
61
|
+
|
62
|
+
def test_multivalue_where
|
63
|
+
posts = Post.where("author_id = ? AND id = ?", 1, 1)
|
64
|
+
assert_equal 1, posts.to_a.size
|
65
|
+
end
|
66
|
+
|
67
|
+
def test_scoped
|
68
|
+
topics = Topic.all
|
69
|
+
assert_kind_of ActiveRecord::Relation, topics
|
70
|
+
assert_equal 5, topics.size
|
71
|
+
end
|
72
|
+
|
73
|
+
def test_to_json
|
74
|
+
assert_nothing_raised { Bird.all.to_json }
|
75
|
+
assert_nothing_raised { Bird.all.to_a.to_json }
|
76
|
+
end
|
77
|
+
|
78
|
+
def test_to_yaml
|
79
|
+
assert_nothing_raised { Bird.all.to_yaml }
|
80
|
+
assert_nothing_raised { Bird.all.to_a.to_yaml }
|
81
|
+
end
|
82
|
+
|
83
|
+
def test_to_xml
|
84
|
+
assert_nothing_raised { Bird.all.to_xml }
|
85
|
+
assert_nothing_raised { Bird.all.to_a.to_xml }
|
86
|
+
end
|
87
|
+
|
88
|
+
def test_scoped_all
|
89
|
+
topics = Topic.all.to_a
|
90
|
+
assert_kind_of Array, topics
|
91
|
+
assert_no_queries { assert_equal 5, topics.size }
|
92
|
+
end
|
93
|
+
|
94
|
+
def test_loaded_all
|
95
|
+
topics = Topic.all
|
96
|
+
|
97
|
+
assert_queries(1) do
|
98
|
+
2.times { assert_equal 5, topics.to_a.size }
|
99
|
+
end
|
100
|
+
|
101
|
+
assert topics.loaded?
|
102
|
+
end
|
103
|
+
|
104
|
+
def test_scoped_first
|
105
|
+
topics = Topic.all.order("id ASC")
|
106
|
+
|
107
|
+
assert_queries(1) do
|
108
|
+
2.times { assert_equal "The First Topic", topics.first.title }
|
109
|
+
end
|
110
|
+
|
111
|
+
assert ! topics.loaded?
|
112
|
+
end
|
113
|
+
|
114
|
+
def test_loaded_first
|
115
|
+
topics = Topic.all.order("id ASC")
|
116
|
+
topics.load # force load
|
117
|
+
|
118
|
+
assert_no_queries do
|
119
|
+
assert_equal "The First Topic", topics.first.title
|
120
|
+
end
|
121
|
+
|
122
|
+
assert topics.loaded?
|
123
|
+
end
|
124
|
+
|
125
|
+
def test_loaded_first_with_limit
|
126
|
+
topics = Topic.all.order("id ASC")
|
127
|
+
topics.load # force load
|
128
|
+
|
129
|
+
assert_no_queries do
|
130
|
+
assert_equal ["The First Topic",
|
131
|
+
"The Second Topic of the day"], topics.first(2).map(&:title)
|
132
|
+
end
|
133
|
+
|
134
|
+
assert topics.loaded?
|
135
|
+
end
|
136
|
+
|
137
|
+
def test_first_get_more_than_available
|
138
|
+
topics = Topic.all.order("id ASC")
|
139
|
+
unloaded_first = topics.first(10)
|
140
|
+
topics.load # force load
|
141
|
+
|
142
|
+
assert_no_queries do
|
143
|
+
loaded_first = topics.first(10)
|
144
|
+
assert_equal unloaded_first, loaded_first
|
145
|
+
end
|
146
|
+
end
|
147
|
+
|
148
|
+
def test_reload
|
149
|
+
topics = Topic.all
|
150
|
+
|
151
|
+
assert_queries(1) do
|
152
|
+
2.times { topics.to_a }
|
153
|
+
end
|
154
|
+
|
155
|
+
assert topics.loaded?
|
156
|
+
|
157
|
+
original_size = topics.to_a.size
|
158
|
+
Topic.create! title: "fake"
|
159
|
+
|
160
|
+
assert_queries(1) { topics.reload }
|
161
|
+
assert_equal original_size + 1, topics.size
|
162
|
+
assert topics.loaded?
|
163
|
+
end
|
164
|
+
|
165
|
+
def test_finding_with_subquery
|
166
|
+
relation = Topic.where(approved: true)
|
167
|
+
assert_equal relation.to_a, Topic.select("*").from(relation).to_a
|
168
|
+
assert_equal relation.to_a, Topic.select("subquery.*").from(relation).to_a
|
169
|
+
assert_equal relation.to_a, Topic.select("a.*").from(relation, :a).to_a
|
170
|
+
end
|
171
|
+
|
172
|
+
def test_finding_with_subquery_with_binds
|
173
|
+
relation = Post.first.comments
|
174
|
+
assert_equal relation.to_a, Comment.select("*").from(relation).to_a
|
175
|
+
assert_equal relation.to_a, Comment.select("subquery.*").from(relation).to_a
|
176
|
+
assert_equal relation.to_a, Comment.select("a.*").from(relation, :a).to_a
|
177
|
+
end
|
178
|
+
|
179
|
+
def test_finding_with_subquery_without_select_does_not_change_the_select
|
180
|
+
relation = Topic.where(approved: true)
|
181
|
+
assert_raises(ActiveRecord::StatementInvalid) do
|
182
|
+
Topic.from(relation).to_a
|
183
|
+
end
|
184
|
+
end
|
185
|
+
|
186
|
+
def test_select_with_subquery_in_from_does_not_use_original_table_name
|
187
|
+
relation = Comment.group(:type).select("COUNT(post_id) AS post_count, type")
|
188
|
+
subquery = Comment.from(relation).select("type", "post_count")
|
189
|
+
assert_equal(relation.map(&:post_count).sort, subquery.map(&:post_count).sort)
|
190
|
+
end
|
191
|
+
|
192
|
+
def test_group_with_subquery_in_from_does_not_use_original_table_name
|
193
|
+
relation = Comment.group(:type).select("COUNT(post_id) AS post_count,type")
|
194
|
+
subquery = Comment.from(relation).group("type").average("post_count")
|
195
|
+
assert_equal(relation.map(&:post_count).sort, subquery.values.sort)
|
196
|
+
end
|
197
|
+
|
198
|
+
def test_finding_with_conditions
|
199
|
+
assert_equal ["David"], Author.where(name: "David").map(&:name)
|
200
|
+
assert_equal ["Mary"], Author.where(["name = ?", "Mary"]).map(&:name)
|
201
|
+
assert_equal ["Mary"], Author.where("name = ?", "Mary").map(&:name)
|
202
|
+
end
|
203
|
+
|
204
|
+
def test_finding_with_order
|
205
|
+
topics = Topic.order("id")
|
206
|
+
assert_equal 5, topics.to_a.size
|
207
|
+
assert_equal topics(:first).title, topics.first.title
|
208
|
+
end
|
209
|
+
|
210
|
+
def test_finding_with_arel_order
|
211
|
+
topics = Topic.order(Topic.arel_table[:id].asc)
|
212
|
+
assert_equal 5, topics.to_a.size
|
213
|
+
assert_equal topics(:first).title, topics.first.title
|
214
|
+
end
|
215
|
+
|
216
|
+
def test_finding_with_assoc_order
|
217
|
+
topics = Topic.order(id: :desc)
|
218
|
+
assert_equal 5, topics.to_a.size
|
219
|
+
assert_equal topics(:fifth).title, topics.first.title
|
220
|
+
end
|
221
|
+
|
222
|
+
def test_finding_with_arel_assoc_order
|
223
|
+
topics = Topic.order(Arel.sql("id") => :desc)
|
224
|
+
assert_equal 5, topics.to_a.size
|
225
|
+
assert_equal topics(:fifth).title, topics.first.title
|
226
|
+
end
|
227
|
+
|
228
|
+
def test_finding_with_reversed_assoc_order
|
229
|
+
topics = Topic.order(id: :asc).reverse_order
|
230
|
+
assert_equal 5, topics.to_a.size
|
231
|
+
assert_equal topics(:fifth).title, topics.first.title
|
232
|
+
end
|
233
|
+
|
234
|
+
def test_finding_with_reversed_arel_assoc_order
|
235
|
+
topics = Topic.order(Arel.sql("id") => :asc).reverse_order
|
236
|
+
assert_equal 5, topics.to_a.size
|
237
|
+
assert_equal topics(:fifth).title, topics.first.title
|
238
|
+
end
|
239
|
+
|
240
|
+
def test_reverse_order_with_function
|
241
|
+
topics = Topic.order("length(title)").reverse_order
|
242
|
+
assert_equal topics(:second).title, topics.first.title
|
243
|
+
end
|
244
|
+
|
245
|
+
def test_reverse_arel_assoc_order_with_function
|
246
|
+
topics = Topic.order(Arel.sql("length(title)") => :asc).reverse_order
|
247
|
+
assert_equal topics(:second).title, topics.first.title
|
248
|
+
end
|
249
|
+
|
250
|
+
def test_reverse_order_with_function_other_predicates
|
251
|
+
topics = Topic.order("author_name, length(title), id").reverse_order
|
252
|
+
assert_equal topics(:second).title, topics.first.title
|
253
|
+
topics = Topic.order("length(author_name), id, length(title)").reverse_order
|
254
|
+
assert_equal topics(:fifth).title, topics.first.title
|
255
|
+
end
|
256
|
+
|
257
|
+
def test_reverse_order_with_multiargument_function
|
258
|
+
assert_raises(ActiveRecord::IrreversibleOrderError) do
|
259
|
+
Topic.order("concat(author_name, title)").reverse_order
|
260
|
+
end
|
261
|
+
assert_raises(ActiveRecord::IrreversibleOrderError) do
|
262
|
+
Topic.order("concat(lower(author_name), title)").reverse_order
|
263
|
+
end
|
264
|
+
assert_raises(ActiveRecord::IrreversibleOrderError) do
|
265
|
+
Topic.order("concat(author_name, lower(title))").reverse_order
|
266
|
+
end
|
267
|
+
assert_raises(ActiveRecord::IrreversibleOrderError) do
|
268
|
+
Topic.order("concat(lower(author_name), title, length(title)").reverse_order
|
269
|
+
end
|
270
|
+
end
|
271
|
+
|
272
|
+
def test_reverse_arel_assoc_order_with_multiargument_function
|
273
|
+
assert_nothing_raised do
|
274
|
+
Topic.order(Arel.sql("REPLACE(title, '', '')") => :asc).reverse_order
|
275
|
+
end
|
276
|
+
end
|
277
|
+
|
278
|
+
def test_reverse_order_with_nulls_first_or_last
|
279
|
+
assert_raises(ActiveRecord::IrreversibleOrderError) do
|
280
|
+
Topic.order("title NULLS FIRST").reverse_order
|
281
|
+
end
|
282
|
+
assert_raises(ActiveRecord::IrreversibleOrderError) do
|
283
|
+
Topic.order("title nulls last").reverse_order
|
284
|
+
end
|
285
|
+
end
|
286
|
+
|
287
|
+
def test_default_reverse_order_on_table_without_primary_key
|
288
|
+
assert_raises(ActiveRecord::IrreversibleOrderError) do
|
289
|
+
Edge.all.reverse_order
|
290
|
+
end
|
291
|
+
end
|
292
|
+
|
293
|
+
def test_order_with_hash_and_symbol_generates_the_same_sql
|
294
|
+
assert_equal Topic.order(:id).to_sql, Topic.order(id: :asc).to_sql
|
295
|
+
end
|
296
|
+
|
297
|
+
def test_finding_with_desc_order_with_string
|
298
|
+
topics = Topic.order(id: "desc")
|
299
|
+
assert_equal 5, topics.to_a.size
|
300
|
+
assert_equal [topics(:fifth), topics(:fourth), topics(:third), topics(:second), topics(:first)], topics.to_a
|
301
|
+
end
|
302
|
+
|
303
|
+
def test_finding_with_asc_order_with_string
|
304
|
+
topics = Topic.order(id: "asc")
|
305
|
+
assert_equal 5, topics.to_a.size
|
306
|
+
assert_equal [topics(:first), topics(:second), topics(:third), topics(:fourth), topics(:fifth)], topics.to_a
|
307
|
+
end
|
308
|
+
|
309
|
+
def test_support_upper_and_lower_case_directions
|
310
|
+
assert_includes Topic.order(id: "ASC").to_sql, "ASC"
|
311
|
+
assert_includes Topic.order(id: "asc").to_sql, "ASC"
|
312
|
+
assert_includes Topic.order(id: :ASC).to_sql, "ASC"
|
313
|
+
assert_includes Topic.order(id: :asc).to_sql, "ASC"
|
314
|
+
|
315
|
+
assert_includes Topic.order(id: "DESC").to_sql, "DESC"
|
316
|
+
assert_includes Topic.order(id: "desc").to_sql, "DESC"
|
317
|
+
assert_includes Topic.order(id: :DESC).to_sql, "DESC"
|
318
|
+
assert_includes Topic.order(id: :desc).to_sql, "DESC"
|
319
|
+
end
|
320
|
+
|
321
|
+
def test_raising_exception_on_invalid_hash_params
|
322
|
+
e = assert_raise(ArgumentError) { Topic.order(:name, "id DESC", id: :asfsdf) }
|
323
|
+
assert_equal 'Direction "asfsdf" is invalid. Valid directions are: [:asc, :desc, :ASC, :DESC, "asc", "desc", "ASC", "DESC"]', e.message
|
324
|
+
end
|
325
|
+
|
326
|
+
def test_finding_last_with_arel_order
|
327
|
+
topics = Topic.order(Topic.arel_table[:id].asc)
|
328
|
+
assert_equal topics(:fifth).title, topics.last.title
|
329
|
+
end
|
330
|
+
|
331
|
+
def test_finding_with_order_concatenated
|
332
|
+
topics = Topic.order("author_name").order("title")
|
333
|
+
assert_equal 5, topics.to_a.size
|
334
|
+
assert_equal topics(:fourth).title, topics.first.title
|
335
|
+
end
|
336
|
+
|
337
|
+
def test_finding_with_order_by_aliased_attributes
|
338
|
+
topics = Topic.order(:heading)
|
339
|
+
assert_equal 5, topics.to_a.size
|
340
|
+
assert_equal topics(:fifth).title, topics.first.title
|
341
|
+
end
|
342
|
+
|
343
|
+
def test_finding_with_assoc_order_by_aliased_attributes
|
344
|
+
topics = Topic.order(heading: :desc)
|
345
|
+
assert_equal 5, topics.to_a.size
|
346
|
+
assert_equal topics(:third).title, topics.first.title
|
347
|
+
end
|
348
|
+
|
349
|
+
def test_finding_with_reorder
|
350
|
+
topics = Topic.order("author_name").order("title").reorder("id").to_a
|
351
|
+
topics_titles = topics.map(&:title)
|
352
|
+
assert_equal ["The First Topic", "The Second Topic of the day", "The Third Topic of the day", "The Fourth Topic of the day", "The Fifth Topic of the day"], topics_titles
|
353
|
+
end
|
354
|
+
|
355
|
+
def test_finding_with_reorder_by_aliased_attributes
|
356
|
+
topics = Topic.order("author_name").reorder(:heading)
|
357
|
+
assert_equal 5, topics.to_a.size
|
358
|
+
assert_equal topics(:fifth).title, topics.first.title
|
359
|
+
end
|
360
|
+
|
361
|
+
def test_finding_with_assoc_reorder_by_aliased_attributes
|
362
|
+
topics = Topic.order("author_name").reorder(heading: :desc)
|
363
|
+
assert_equal 5, topics.to_a.size
|
364
|
+
assert_equal topics(:third).title, topics.first.title
|
365
|
+
end
|
366
|
+
|
367
|
+
def test_finding_with_order_and_take
|
368
|
+
entrants = Entrant.order("id ASC").limit(2).to_a
|
369
|
+
|
370
|
+
assert_equal 2, entrants.size
|
371
|
+
assert_equal entrants(:first).name, entrants.first.name
|
372
|
+
end
|
373
|
+
|
374
|
+
def test_finding_with_cross_table_order_and_limit
|
375
|
+
tags = Tag.includes(:taggings).
|
376
|
+
order("tags.name asc", "taggings.taggable_id asc", "REPLACE('abc', taggings.taggable_type, taggings.taggable_type)").
|
377
|
+
limit(1).to_a
|
378
|
+
assert_equal 1, tags.length
|
379
|
+
end
|
380
|
+
|
381
|
+
def test_finding_with_complex_order_and_limit
|
382
|
+
tags = Tag.includes(:taggings).references(:taggings).order("REPLACE('abc', taggings.taggable_type, taggings.taggable_type)").limit(1).to_a
|
383
|
+
assert_equal 1, tags.length
|
384
|
+
end
|
385
|
+
|
386
|
+
def test_finding_with_complex_order
|
387
|
+
tags = Tag.includes(:taggings).references(:taggings).order("REPLACE('abc', taggings.taggable_type, taggings.taggable_type)").to_a
|
388
|
+
assert_equal 3, tags.length
|
389
|
+
end
|
390
|
+
|
391
|
+
def test_finding_with_sanitized_order
|
392
|
+
query = Tag.order(["field(id, ?)", [1, 3, 2]]).to_sql
|
393
|
+
assert_match(/field\(id, 1,3,2\)/, query)
|
394
|
+
|
395
|
+
query = Tag.order(["field(id, ?)", []]).to_sql
|
396
|
+
assert_match(/field\(id, NULL\)/, query)
|
397
|
+
|
398
|
+
query = Tag.order(["field(id, ?)", nil]).to_sql
|
399
|
+
assert_match(/field\(id, NULL\)/, query)
|
400
|
+
end
|
401
|
+
|
402
|
+
def test_finding_with_order_limit_and_offset
|
403
|
+
entrants = Entrant.order("id ASC").limit(2).offset(1)
|
404
|
+
|
405
|
+
assert_equal 2, entrants.to_a.size
|
406
|
+
assert_equal entrants(:second).name, entrants.first.name
|
407
|
+
|
408
|
+
entrants = Entrant.order("id ASC").limit(2).offset(2)
|
409
|
+
assert_equal 1, entrants.to_a.size
|
410
|
+
assert_equal entrants(:third).name, entrants.first.name
|
411
|
+
end
|
412
|
+
|
413
|
+
def test_finding_with_group
|
414
|
+
developers = Developer.group("salary").select("salary").to_a
|
415
|
+
assert_equal 4, developers.size
|
416
|
+
assert_equal 4, developers.map(&:salary).uniq.size
|
417
|
+
end
|
418
|
+
|
419
|
+
def test_select_with_block
|
420
|
+
even_ids = Developer.all.select { |d| d.id % 2 == 0 }.map(&:id)
|
421
|
+
assert_equal [2, 4, 6, 8, 10], even_ids.sort
|
422
|
+
end
|
423
|
+
|
424
|
+
def test_joins_with_nil_argument
|
425
|
+
assert_nothing_raised { DependentFirm.joins(nil).first }
|
426
|
+
end
|
427
|
+
|
428
|
+
def test_finding_with_hash_conditions_on_joined_table
|
429
|
+
firms = DependentFirm.joins(:account).where(name: "QuailsCore", accounts: { credit_limit: 55..60 }).to_a
|
430
|
+
assert_equal 1, firms.size
|
431
|
+
assert_equal companies(:quails_core), firms.first
|
432
|
+
end
|
433
|
+
|
434
|
+
def test_find_all_with_join
|
435
|
+
developers_on_project_one = Developer.joins("LEFT JOIN developers_projects ON developers.id = developers_projects.developer_id").
|
436
|
+
where("project_id=1").to_a
|
437
|
+
|
438
|
+
assert_equal 3, developers_on_project_one.length
|
439
|
+
developer_names = developers_on_project_one.map(&:name)
|
440
|
+
assert_includes developer_names, "David"
|
441
|
+
assert_includes developer_names, "Jamis"
|
442
|
+
end
|
443
|
+
|
444
|
+
def test_find_on_hash_conditions
|
445
|
+
assert_equal Topic.all.merge!(where: { approved: false }).to_a, Topic.where(approved: false).to_a
|
446
|
+
end
|
447
|
+
|
448
|
+
def test_joins_with_string_array
|
449
|
+
person_with_reader_and_post = Post.joins([
|
450
|
+
"INNER JOIN categorizations ON categorizations.post_id = posts.id",
|
451
|
+
"INNER JOIN categories ON categories.id = categorizations.category_id AND categories.type = 'SpecialCategory'"
|
452
|
+
]
|
453
|
+
).to_a
|
454
|
+
assert_equal 1, person_with_reader_and_post.size
|
455
|
+
end
|
456
|
+
|
457
|
+
def test_no_arguments_to_query_methods_raise_errors
|
458
|
+
assert_raises(ArgumentError) { Topic.references() }
|
459
|
+
assert_raises(ArgumentError) { Topic.includes() }
|
460
|
+
assert_raises(ArgumentError) { Topic.preload() }
|
461
|
+
assert_raises(ArgumentError) { Topic.group() }
|
462
|
+
assert_raises(ArgumentError) { Topic.reorder() }
|
463
|
+
end
|
464
|
+
|
465
|
+
def test_blank_like_arguments_to_query_methods_dont_raise_errors
|
466
|
+
assert_nothing_raised { Topic.references([]) }
|
467
|
+
assert_nothing_raised { Topic.includes([]) }
|
468
|
+
assert_nothing_raised { Topic.preload([]) }
|
469
|
+
assert_nothing_raised { Topic.group([]) }
|
470
|
+
assert_nothing_raised { Topic.reorder([]) }
|
471
|
+
end
|
472
|
+
|
473
|
+
def test_respond_to_delegates_to_arel
|
474
|
+
relation = Topic.all
|
475
|
+
fake_arel = Struct.new(:responds) {
|
476
|
+
def respond_to?(method, access = false)
|
477
|
+
responds << [method, access]
|
478
|
+
end
|
479
|
+
}.new []
|
480
|
+
|
481
|
+
relation.extend(Module.new { attr_accessor :arel })
|
482
|
+
relation.arel = fake_arel
|
483
|
+
|
484
|
+
relation.respond_to?(:matching_attributes)
|
485
|
+
assert_equal [:matching_attributes, false], fake_arel.responds.first
|
486
|
+
end
|
487
|
+
|
488
|
+
def test_respond_to_dynamic_finders
|
489
|
+
relation = Topic.all
|
490
|
+
|
491
|
+
["find_by_title", "find_by_title_and_author_name"].each do |method|
|
492
|
+
assert_respond_to relation, method, "Topic.all should respond to #{method.inspect}"
|
493
|
+
end
|
494
|
+
end
|
495
|
+
|
496
|
+
def test_respond_to_class_methods_and_scopes
|
497
|
+
assert Topic.all.respond_to?(:by_lifo)
|
498
|
+
end
|
499
|
+
|
500
|
+
def test_find_with_readonly_option
|
501
|
+
Developer.all.each { |d| assert !d.readonly? }
|
502
|
+
Developer.all.readonly.each { |d| assert d.readonly? }
|
503
|
+
end
|
504
|
+
|
505
|
+
def test_eager_association_loading_of_stis_with_multiple_references
|
506
|
+
authors = Author.eager_load(posts: { special_comments: { post: [ :special_comments, :very_special_comment ] } }).
|
507
|
+
order("comments.body, very_special_comments_posts.body").where("posts.id = 4").to_a
|
508
|
+
|
509
|
+
assert_equal [authors(:david)], authors
|
510
|
+
assert_no_queries do
|
511
|
+
authors.first.posts.first.special_comments.first.post.special_comments
|
512
|
+
authors.first.posts.first.special_comments.first.post.very_special_comment
|
513
|
+
end
|
514
|
+
end
|
515
|
+
|
516
|
+
def test_find_with_preloaded_associations
|
517
|
+
assert_queries(2) do
|
518
|
+
posts = Post.preload(:comments).order("posts.id")
|
519
|
+
assert posts.first.comments.first
|
520
|
+
end
|
521
|
+
|
522
|
+
assert_queries(2) do
|
523
|
+
posts = Post.preload(:comments).order("posts.id")
|
524
|
+
assert posts.first.comments.first
|
525
|
+
end
|
526
|
+
|
527
|
+
assert_queries(2) do
|
528
|
+
posts = Post.preload(:author).order("posts.id")
|
529
|
+
assert posts.first.author
|
530
|
+
end
|
531
|
+
|
532
|
+
assert_queries(2) do
|
533
|
+
posts = Post.preload(:author).order("posts.id")
|
534
|
+
assert posts.first.author
|
535
|
+
end
|
536
|
+
|
537
|
+
assert_queries(3) do
|
538
|
+
posts = Post.preload(:author, :comments).order("posts.id")
|
539
|
+
assert posts.first.author
|
540
|
+
assert posts.first.comments.first
|
541
|
+
end
|
542
|
+
end
|
543
|
+
|
544
|
+
def test_preload_applies_to_all_chained_preloaded_scopes
|
545
|
+
assert_queries(3) do
|
546
|
+
post = Post.with_comments.with_tags.first
|
547
|
+
assert post
|
548
|
+
end
|
549
|
+
end
|
550
|
+
|
551
|
+
def test_find_with_included_associations
|
552
|
+
assert_queries(2) do
|
553
|
+
posts = Post.includes(:comments).order("posts.id")
|
554
|
+
assert posts.first.comments.first
|
555
|
+
end
|
556
|
+
|
557
|
+
assert_queries(2) do
|
558
|
+
posts = Post.all.includes(:comments).order("posts.id")
|
559
|
+
assert posts.first.comments.first
|
560
|
+
end
|
561
|
+
|
562
|
+
assert_queries(2) do
|
563
|
+
posts = Post.includes(:author).order("posts.id")
|
564
|
+
assert posts.first.author
|
565
|
+
end
|
566
|
+
|
567
|
+
assert_queries(3) do
|
568
|
+
posts = Post.includes(:author, :comments).order("posts.id")
|
569
|
+
assert posts.first.author
|
570
|
+
assert posts.first.comments.first
|
571
|
+
end
|
572
|
+
end
|
573
|
+
|
574
|
+
def test_default_scoping_finder_methods
|
575
|
+
developers = DeveloperCalledDavid.order("id").map(&:id).sort
|
576
|
+
assert_equal Developer.where(name: "David").map(&:id).sort, developers
|
577
|
+
end
|
578
|
+
|
579
|
+
def test_includes_with_select
|
580
|
+
query = Post.select("comments_count AS ranking").order("ranking").includes(:comments)
|
581
|
+
.where(comments: { id: 1 })
|
582
|
+
|
583
|
+
assert_equal ["comments_count AS ranking"], query.select_values
|
584
|
+
assert_equal 1, query.to_a.size
|
585
|
+
end
|
586
|
+
|
587
|
+
def test_preloading_with_associations_and_merges
|
588
|
+
post = Post.create! title: "Uhuu", body: "body"
|
589
|
+
reader = Reader.create! post_id: post.id, person_id: 1
|
590
|
+
comment = Comment.create! post_id: post.id, body: "body"
|
591
|
+
|
592
|
+
assert !comment.respond_to?(:readers)
|
593
|
+
|
594
|
+
post_rel = Post.preload(:readers).joins(:readers).where(title: "Uhuu")
|
595
|
+
result_comment = Comment.joins(:post).merge(post_rel).to_a.first
|
596
|
+
assert_equal comment, result_comment
|
597
|
+
|
598
|
+
assert_no_queries do
|
599
|
+
assert_equal post, result_comment.post
|
600
|
+
assert_equal [reader], result_comment.post.readers.to_a
|
601
|
+
end
|
602
|
+
|
603
|
+
post_rel = Post.includes(:readers).where(title: "Uhuu")
|
604
|
+
result_comment = Comment.joins(:post).merge(post_rel).first
|
605
|
+
assert_equal comment, result_comment
|
606
|
+
|
607
|
+
assert_no_queries do
|
608
|
+
assert_equal post, result_comment.post
|
609
|
+
assert_equal [reader], result_comment.post.readers.to_a
|
610
|
+
end
|
611
|
+
end
|
612
|
+
|
613
|
+
def test_preloading_with_associations_default_scopes_and_merges
|
614
|
+
post = Post.create! title: "Uhuu", body: "body"
|
615
|
+
reader = Reader.create! post_id: post.id, person_id: 1
|
616
|
+
|
617
|
+
post_rel = PostWithPreloadDefaultScope.preload(:readers).joins(:readers).where(title: "Uhuu")
|
618
|
+
result_post = PostWithPreloadDefaultScope.all.merge(post_rel).to_a.first
|
619
|
+
|
620
|
+
assert_no_queries do
|
621
|
+
assert_equal [reader], result_post.readers.to_a
|
622
|
+
end
|
623
|
+
|
624
|
+
post_rel = PostWithIncludesDefaultScope.includes(:readers).where(title: "Uhuu")
|
625
|
+
result_post = PostWithIncludesDefaultScope.all.merge(post_rel).to_a.first
|
626
|
+
|
627
|
+
assert_no_queries do
|
628
|
+
assert_equal [reader], result_post.readers.to_a
|
629
|
+
end
|
630
|
+
end
|
631
|
+
|
632
|
+
def test_loading_with_one_association
|
633
|
+
posts = Post.preload(:comments)
|
634
|
+
post = posts.find { |p| p.id == 1 }
|
635
|
+
assert_equal 2, post.comments.size
|
636
|
+
assert_includes post.comments, comments(:greetings)
|
637
|
+
|
638
|
+
post = Post.where("posts.title = 'Welcome to the weblog'").preload(:comments).first
|
639
|
+
assert_equal 2, post.comments.size
|
640
|
+
assert_includes post.comments, comments(:greetings)
|
641
|
+
|
642
|
+
posts = Post.preload(:last_comment)
|
643
|
+
post = posts.find { |p| p.id == 1 }
|
644
|
+
assert_equal Post.find(1).last_comment, post.last_comment
|
645
|
+
end
|
646
|
+
|
647
|
+
def test_to_sql_on_eager_join
|
648
|
+
expected = assert_sql {
|
649
|
+
Post.eager_load(:last_comment).order("comments.id DESC").to_a
|
650
|
+
}.first
|
651
|
+
actual = Post.eager_load(:last_comment).order("comments.id DESC").to_sql
|
652
|
+
assert_equal expected, actual
|
653
|
+
end
|
654
|
+
|
655
|
+
def test_to_sql_on_scoped_proxy
|
656
|
+
auth = Author.first
|
657
|
+
Post.where("1=1").written_by(auth)
|
658
|
+
assert_not auth.posts.to_sql.include?("1=1")
|
659
|
+
end
|
660
|
+
|
661
|
+
def test_loading_with_one_association_with_non_preload
|
662
|
+
posts = Post.eager_load(:last_comment).order("comments.id DESC")
|
663
|
+
post = posts.find { |p| p.id == 1 }
|
664
|
+
assert_equal Post.find(1).last_comment, post.last_comment
|
665
|
+
end
|
666
|
+
|
667
|
+
def test_dynamic_find_by_attributes
|
668
|
+
david = authors(:david)
|
669
|
+
author = Author.preload(:taggings).find_by_id(david.id)
|
670
|
+
expected_taggings = taggings(:welcome_general, :thinking_general)
|
671
|
+
|
672
|
+
assert_no_queries do
|
673
|
+
assert_equal expected_taggings, author.taggings.uniq.sort_by(&:id)
|
674
|
+
end
|
675
|
+
|
676
|
+
authors = Author.all
|
677
|
+
assert_equal david, authors.find_by_id_and_name(david.id, david.name)
|
678
|
+
assert_equal david, authors.find_by_id_and_name!(david.id, david.name)
|
679
|
+
end
|
680
|
+
|
681
|
+
def test_dynamic_find_by_attributes_bang
|
682
|
+
author = Author.all.find_by_id!(authors(:david).id)
|
683
|
+
assert_equal "David", author.name
|
684
|
+
|
685
|
+
assert_raises(ActiveRecord::RecordNotFound) { Author.all.find_by_id_and_name!(20, "invalid") }
|
686
|
+
end
|
687
|
+
|
688
|
+
def test_find_id
|
689
|
+
authors = Author.all
|
690
|
+
|
691
|
+
david = authors.find(authors(:david).id)
|
692
|
+
assert_equal "David", david.name
|
693
|
+
|
694
|
+
assert_raises(ActiveRecord::RecordNotFound) { authors.where(name: "lifo").find("42") }
|
695
|
+
end
|
696
|
+
|
697
|
+
def test_find_ids
|
698
|
+
authors = Author.order("id ASC")
|
699
|
+
|
700
|
+
results = authors.find(authors(:david).id, authors(:mary).id)
|
701
|
+
assert_kind_of Array, results
|
702
|
+
assert_equal 2, results.size
|
703
|
+
assert_equal "David", results[0].name
|
704
|
+
assert_equal "Mary", results[1].name
|
705
|
+
assert_equal results, authors.find([authors(:david).id, authors(:mary).id])
|
706
|
+
|
707
|
+
assert_raises(ActiveRecord::RecordNotFound) { authors.where(name: "lifo").find(authors(:david).id, "42") }
|
708
|
+
assert_raises(ActiveRecord::RecordNotFound) { authors.find(["42", 43]) }
|
709
|
+
end
|
710
|
+
|
711
|
+
def test_find_in_empty_array
|
712
|
+
authors = Author.all.where(id: [])
|
713
|
+
assert authors.to_a.blank?
|
714
|
+
end
|
715
|
+
|
716
|
+
def test_where_with_ar_object
|
717
|
+
author = Author.first
|
718
|
+
authors = Author.all.where(id: author)
|
719
|
+
assert_equal 1, authors.to_a.length
|
720
|
+
end
|
721
|
+
|
722
|
+
def test_find_with_list_of_ar
|
723
|
+
author = Author.first
|
724
|
+
authors = Author.find([author.id])
|
725
|
+
assert_equal author, authors.first
|
726
|
+
end
|
727
|
+
|
728
|
+
def test_find_by_id_with_list_of_ar
|
729
|
+
author = Author.first
|
730
|
+
authors = Author.find_by_id([author])
|
731
|
+
assert_equal author, authors
|
732
|
+
end
|
733
|
+
|
734
|
+
def test_find_all_using_where_twice_should_or_the_relation
|
735
|
+
david = authors(:david)
|
736
|
+
relation = Author.unscoped
|
737
|
+
relation = relation.where(name: david.name)
|
738
|
+
relation = relation.where(name: "Santiago")
|
739
|
+
relation = relation.where(id: david.id)
|
740
|
+
assert_equal [], relation.to_a
|
741
|
+
end
|
742
|
+
|
743
|
+
def test_multi_where_ands_queries
|
744
|
+
relation = Author.unscoped
|
745
|
+
david = authors(:david)
|
746
|
+
sql = relation.where(name: david.name).where(name: "Santiago").to_sql
|
747
|
+
assert_match("AND", sql)
|
748
|
+
end
|
749
|
+
|
750
|
+
def test_find_all_with_multiple_should_use_and
|
751
|
+
david = authors(:david)
|
752
|
+
relation = [
|
753
|
+
{ name: david.name },
|
754
|
+
{ name: "Santiago" },
|
755
|
+
{ name: "tenderlove" },
|
756
|
+
].inject(Author.unscoped) do |memo, param|
|
757
|
+
memo.where(param)
|
758
|
+
end
|
759
|
+
assert_equal [], relation.to_a
|
760
|
+
end
|
761
|
+
|
762
|
+
def test_typecasting_where_with_array
|
763
|
+
ids = Author.pluck(:id)
|
764
|
+
slugs = ids.map { |id| "#{id}-as-a-slug" }
|
765
|
+
|
766
|
+
assert_equal Author.all.to_a, Author.where(id: slugs).to_a
|
767
|
+
end
|
768
|
+
|
769
|
+
def test_find_all_using_where_with_relation
|
770
|
+
david = authors(:david)
|
771
|
+
# switching the lines below would succeed in current quails
|
772
|
+
# assert_queries(2) {
|
773
|
+
assert_queries(1) {
|
774
|
+
relation = Author.where(id: Author.where(id: david.id))
|
775
|
+
assert_equal [david], relation.to_a
|
776
|
+
}
|
777
|
+
|
778
|
+
assert_queries(1) {
|
779
|
+
relation = Author.where("id in (?)", Author.where(id: david).select(:id))
|
780
|
+
assert_equal [david], relation.to_a
|
781
|
+
}
|
782
|
+
|
783
|
+
assert_queries(1) do
|
784
|
+
relation = Author.where("id in (:author_ids)", author_ids: Author.where(id: david).select(:id))
|
785
|
+
assert_equal [david], relation.to_a
|
786
|
+
end
|
787
|
+
end
|
788
|
+
|
789
|
+
def test_find_all_using_where_with_relation_with_bound_values
|
790
|
+
david = authors(:david)
|
791
|
+
davids_posts = david.posts.order(:id).to_a
|
792
|
+
|
793
|
+
assert_queries(1) do
|
794
|
+
relation = Post.where(id: david.posts.select(:id))
|
795
|
+
assert_equal davids_posts, relation.order(:id).to_a
|
796
|
+
end
|
797
|
+
|
798
|
+
assert_queries(1) do
|
799
|
+
relation = Post.where("id in (?)", david.posts.select(:id))
|
800
|
+
assert_equal davids_posts, relation.order(:id).to_a, "should process Relation as bind variables"
|
801
|
+
end
|
802
|
+
|
803
|
+
assert_queries(1) do
|
804
|
+
relation = Post.where("id in (:post_ids)", post_ids: david.posts.select(:id))
|
805
|
+
assert_equal davids_posts, relation.order(:id).to_a, "should process Relation as named bind variables"
|
806
|
+
end
|
807
|
+
end
|
808
|
+
|
809
|
+
def test_find_all_using_where_with_relation_and_alternate_primary_key
|
810
|
+
cool_first = minivans(:cool_first)
|
811
|
+
# switching the lines below would succeed in current quails
|
812
|
+
# assert_queries(2) {
|
813
|
+
assert_queries(1) {
|
814
|
+
relation = Minivan.where(minivan_id: Minivan.where(name: cool_first.name))
|
815
|
+
assert_equal [cool_first], relation.to_a
|
816
|
+
}
|
817
|
+
end
|
818
|
+
|
819
|
+
def test_find_all_using_where_with_relation_does_not_alter_select_values
|
820
|
+
david = authors(:david)
|
821
|
+
|
822
|
+
subquery = Author.where(id: david.id)
|
823
|
+
|
824
|
+
assert_queries(1) {
|
825
|
+
relation = Author.where(id: subquery)
|
826
|
+
assert_equal [david], relation.to_a
|
827
|
+
}
|
828
|
+
|
829
|
+
assert_equal 0, subquery.select_values.size
|
830
|
+
end
|
831
|
+
|
832
|
+
def test_find_all_using_where_with_relation_with_joins
|
833
|
+
david = authors(:david)
|
834
|
+
assert_queries(1) {
|
835
|
+
relation = Author.where(id: Author.joins(:posts).where(id: david.id))
|
836
|
+
assert_equal [david], relation.to_a
|
837
|
+
}
|
838
|
+
end
|
839
|
+
|
840
|
+
def test_find_all_using_where_with_relation_with_select_to_build_subquery
|
841
|
+
david = authors(:david)
|
842
|
+
assert_queries(1) {
|
843
|
+
relation = Author.where(name: Author.where(id: david.id).select(:name))
|
844
|
+
assert_equal [david], relation.to_a
|
845
|
+
}
|
846
|
+
end
|
847
|
+
|
848
|
+
def test_exists
|
849
|
+
davids = Author.where(name: "David")
|
850
|
+
assert davids.exists?
|
851
|
+
assert davids.exists?(authors(:david).id)
|
852
|
+
assert ! davids.exists?(authors(:mary).id)
|
853
|
+
assert ! davids.exists?("42")
|
854
|
+
assert ! davids.exists?(42)
|
855
|
+
assert ! davids.exists?(davids.new.id)
|
856
|
+
|
857
|
+
fake = Author.where(name: "fake author")
|
858
|
+
assert ! fake.exists?
|
859
|
+
assert ! fake.exists?(authors(:david).id)
|
860
|
+
end
|
861
|
+
|
862
|
+
def test_exists_uses_existing_scope
|
863
|
+
post = authors(:david).posts.first
|
864
|
+
authors = Author.includes(:posts).where(name: "David", posts: { id: post.id })
|
865
|
+
assert authors.exists?(authors(:david).id)
|
866
|
+
end
|
867
|
+
|
868
|
+
def test_any_with_scope_on_hash_includes
|
869
|
+
post = authors(:david).posts.first
|
870
|
+
categories = Categorization.includes(author: :posts).where(posts: { id: post.id })
|
871
|
+
assert categories.exists?
|
872
|
+
end
|
873
|
+
|
874
|
+
def test_last
|
875
|
+
authors = Author.all
|
876
|
+
assert_equal authors(:bob), authors.last
|
877
|
+
end
|
878
|
+
|
879
|
+
def test_destroy_all
|
880
|
+
davids = Author.where(name: "David")
|
881
|
+
|
882
|
+
# Force load
|
883
|
+
assert_equal [authors(:david)], davids.to_a
|
884
|
+
assert davids.loaded?
|
885
|
+
|
886
|
+
assert_difference("Author.count", -1) { davids.destroy_all }
|
887
|
+
|
888
|
+
assert_equal [], davids.to_a
|
889
|
+
assert davids.loaded?
|
890
|
+
end
|
891
|
+
|
892
|
+
def test_delete_all
|
893
|
+
davids = Author.where(name: "David")
|
894
|
+
|
895
|
+
assert_difference("Author.count", -1) { davids.delete_all }
|
896
|
+
assert ! davids.loaded?
|
897
|
+
end
|
898
|
+
|
899
|
+
def test_delete_all_loaded
|
900
|
+
davids = Author.where(name: "David")
|
901
|
+
|
902
|
+
# Force load
|
903
|
+
assert_equal [authors(:david)], davids.to_a
|
904
|
+
assert davids.loaded?
|
905
|
+
|
906
|
+
assert_difference("Author.count", -1) { davids.delete_all }
|
907
|
+
|
908
|
+
assert_equal [], davids.to_a
|
909
|
+
assert davids.loaded?
|
910
|
+
end
|
911
|
+
|
912
|
+
def test_delete_all_with_unpermitted_relation_raises_error
|
913
|
+
assert_raises(ActiveRecord::ActiveRecordError) { Author.limit(10).delete_all }
|
914
|
+
assert_raises(ActiveRecord::ActiveRecordError) { Author.distinct.delete_all }
|
915
|
+
assert_raises(ActiveRecord::ActiveRecordError) { Author.group(:name).delete_all }
|
916
|
+
assert_raises(ActiveRecord::ActiveRecordError) { Author.having("SUM(id) < 3").delete_all }
|
917
|
+
assert_raises(ActiveRecord::ActiveRecordError) { Author.offset(10).delete_all }
|
918
|
+
end
|
919
|
+
|
920
|
+
def test_select_with_aggregates
|
921
|
+
posts = Post.select(:title, :body)
|
922
|
+
|
923
|
+
assert_equal 11, posts.count(:all)
|
924
|
+
assert_equal 11, posts.size
|
925
|
+
assert posts.any?
|
926
|
+
assert posts.many?
|
927
|
+
assert_not posts.empty?
|
928
|
+
end
|
929
|
+
|
930
|
+
def test_select_takes_a_variable_list_of_args
|
931
|
+
david = developers(:david)
|
932
|
+
|
933
|
+
developer = Developer.where(id: david.id).select(:name, :salary).first
|
934
|
+
assert_equal david.name, developer.name
|
935
|
+
assert_equal david.salary, developer.salary
|
936
|
+
end
|
937
|
+
|
938
|
+
def test_select_takes_an_aliased_attribute
|
939
|
+
first = topics(:first)
|
940
|
+
|
941
|
+
topic = Topic.where(id: first.id).select(:heading).first
|
942
|
+
assert_equal first.heading, topic.heading
|
943
|
+
end
|
944
|
+
|
945
|
+
def test_select_argument_error
|
946
|
+
assert_raises(ArgumentError) { Developer.select }
|
947
|
+
end
|
948
|
+
|
949
|
+
def test_count
|
950
|
+
posts = Post.all
|
951
|
+
|
952
|
+
assert_equal 11, posts.count
|
953
|
+
assert_equal 11, posts.count(:all)
|
954
|
+
assert_equal 11, posts.count(:id)
|
955
|
+
|
956
|
+
assert_equal 1, posts.where("comments_count > 1").count
|
957
|
+
assert_equal 9, posts.where(comments_count: 0).count
|
958
|
+
end
|
959
|
+
|
960
|
+
def test_count_with_block
|
961
|
+
posts = Post.all
|
962
|
+
assert_equal 10, posts.count { |p| p.comments_count.even? }
|
963
|
+
end
|
964
|
+
|
965
|
+
def test_count_on_association_relation
|
966
|
+
author = Author.last
|
967
|
+
another_author = Author.first
|
968
|
+
posts = Post.where(author_id: author.id)
|
969
|
+
|
970
|
+
assert_equal author.posts.where(author_id: author.id).size, posts.count
|
971
|
+
|
972
|
+
assert_equal 0, author.posts.where(author_id: another_author.id).size
|
973
|
+
assert author.posts.where(author_id: another_author.id).empty?
|
974
|
+
end
|
975
|
+
|
976
|
+
def test_count_with_distinct
|
977
|
+
posts = Post.all
|
978
|
+
|
979
|
+
assert_equal 3, posts.distinct(true).count(:comments_count)
|
980
|
+
assert_equal 11, posts.distinct(false).count(:comments_count)
|
981
|
+
|
982
|
+
assert_equal 3, posts.distinct(true).select(:comments_count).count
|
983
|
+
assert_equal 11, posts.distinct(false).select(:comments_count).count
|
984
|
+
end
|
985
|
+
|
986
|
+
def test_update_all_with_scope
|
987
|
+
tag = Tag.first
|
988
|
+
Post.tagged_with(tag.id).update_all title: "rofl"
|
989
|
+
list = Post.tagged_with(tag.id).all.to_a
|
990
|
+
assert_operator list.length, :>, 0
|
991
|
+
list.each { |post| assert_equal "rofl", post.title }
|
992
|
+
end
|
993
|
+
|
994
|
+
def test_count_explicit_columns
|
995
|
+
Post.update_all(comments_count: nil)
|
996
|
+
posts = Post.all
|
997
|
+
|
998
|
+
assert_equal [0], posts.select("comments_count").where("id is not null").group("id").order("id").count.values.uniq
|
999
|
+
assert_equal 0, posts.where("id is not null").select("comments_count").count
|
1000
|
+
|
1001
|
+
assert_equal 11, posts.select("comments_count").count("id")
|
1002
|
+
assert_equal 0, posts.select("comments_count").count
|
1003
|
+
assert_equal 0, posts.count(:comments_count)
|
1004
|
+
assert_equal 0, posts.count("comments_count")
|
1005
|
+
end
|
1006
|
+
|
1007
|
+
def test_multiple_selects
|
1008
|
+
post = Post.all.select("comments_count").select("title").order("id ASC").first
|
1009
|
+
assert_equal "Welcome to the weblog", post.title
|
1010
|
+
assert_equal 2, post.comments_count
|
1011
|
+
end
|
1012
|
+
|
1013
|
+
def test_size
|
1014
|
+
posts = Post.all
|
1015
|
+
|
1016
|
+
assert_queries(1) { assert_equal 11, posts.size }
|
1017
|
+
assert ! posts.loaded?
|
1018
|
+
|
1019
|
+
best_posts = posts.where(comments_count: 0)
|
1020
|
+
best_posts.load # force load
|
1021
|
+
assert_no_queries { assert_equal 9, best_posts.size }
|
1022
|
+
end
|
1023
|
+
|
1024
|
+
def test_size_with_limit
|
1025
|
+
posts = Post.limit(10)
|
1026
|
+
|
1027
|
+
assert_queries(1) { assert_equal 10, posts.size }
|
1028
|
+
assert ! posts.loaded?
|
1029
|
+
|
1030
|
+
best_posts = posts.where(comments_count: 0)
|
1031
|
+
best_posts.load # force load
|
1032
|
+
assert_no_queries { assert_equal 9, best_posts.size }
|
1033
|
+
end
|
1034
|
+
|
1035
|
+
def test_size_with_zero_limit
|
1036
|
+
posts = Post.limit(0)
|
1037
|
+
|
1038
|
+
assert_no_queries { assert_equal 0, posts.size }
|
1039
|
+
assert ! posts.loaded?
|
1040
|
+
|
1041
|
+
posts.load # force load
|
1042
|
+
assert_no_queries { assert_equal 0, posts.size }
|
1043
|
+
end
|
1044
|
+
|
1045
|
+
def test_empty_with_zero_limit
|
1046
|
+
posts = Post.limit(0)
|
1047
|
+
|
1048
|
+
assert_no_queries { assert_equal true, posts.empty? }
|
1049
|
+
assert ! posts.loaded?
|
1050
|
+
end
|
1051
|
+
|
1052
|
+
def test_count_complex_chained_relations
|
1053
|
+
posts = Post.select("comments_count").where("id is not null").group("author_id").where("comments_count > 0")
|
1054
|
+
|
1055
|
+
expected = { 1 => 2 }
|
1056
|
+
assert_equal expected, posts.count
|
1057
|
+
end
|
1058
|
+
|
1059
|
+
def test_empty
|
1060
|
+
posts = Post.all
|
1061
|
+
|
1062
|
+
assert_queries(1) { assert_equal false, posts.empty? }
|
1063
|
+
assert ! posts.loaded?
|
1064
|
+
|
1065
|
+
no_posts = posts.where(title: "")
|
1066
|
+
assert_queries(1) { assert_equal true, no_posts.empty? }
|
1067
|
+
assert ! no_posts.loaded?
|
1068
|
+
|
1069
|
+
best_posts = posts.where(comments_count: 0)
|
1070
|
+
best_posts.load # force load
|
1071
|
+
assert_no_queries { assert_equal false, best_posts.empty? }
|
1072
|
+
end
|
1073
|
+
|
1074
|
+
def test_empty_complex_chained_relations
|
1075
|
+
posts = Post.select("comments_count").where("id is not null").group("author_id").where("comments_count > 0")
|
1076
|
+
|
1077
|
+
assert_queries(1) { assert_equal false, posts.empty? }
|
1078
|
+
assert ! posts.loaded?
|
1079
|
+
|
1080
|
+
no_posts = posts.where(title: "")
|
1081
|
+
assert_queries(1) { assert_equal true, no_posts.empty? }
|
1082
|
+
assert ! no_posts.loaded?
|
1083
|
+
end
|
1084
|
+
|
1085
|
+
def test_any
|
1086
|
+
posts = Post.all
|
1087
|
+
|
1088
|
+
# This test was failing when run on its own (as opposed to running the entire suite).
|
1089
|
+
# The second line in the assert_queries block was causing visit_Arel_Attributes_Attribute
|
1090
|
+
# in Arel::Visitors::ToSql to trigger a SHOW TABLES query. Running that line here causes
|
1091
|
+
# the SHOW TABLES result to be cached so we don't have to do it again in the block.
|
1092
|
+
#
|
1093
|
+
# This is obviously a rubbish fix but it's the best I can come up with for now...
|
1094
|
+
posts.where(id: nil).any?
|
1095
|
+
|
1096
|
+
assert_queries(3) do
|
1097
|
+
assert posts.any? # Uses COUNT()
|
1098
|
+
assert ! posts.where(id: nil).any?
|
1099
|
+
|
1100
|
+
assert posts.any? { |p| p.id > 0 }
|
1101
|
+
assert ! posts.any? { |p| p.id <= 0 }
|
1102
|
+
end
|
1103
|
+
|
1104
|
+
assert posts.loaded?
|
1105
|
+
end
|
1106
|
+
|
1107
|
+
def test_many
|
1108
|
+
posts = Post.all
|
1109
|
+
|
1110
|
+
assert_queries(2) do
|
1111
|
+
assert posts.many? # Uses COUNT()
|
1112
|
+
assert posts.many? { |p| p.id > 0 }
|
1113
|
+
assert ! posts.many? { |p| p.id < 2 }
|
1114
|
+
end
|
1115
|
+
|
1116
|
+
assert posts.loaded?
|
1117
|
+
end
|
1118
|
+
|
1119
|
+
def test_many_with_limits
|
1120
|
+
posts = Post.all
|
1121
|
+
|
1122
|
+
assert posts.many?
|
1123
|
+
assert ! posts.limit(1).many?
|
1124
|
+
end
|
1125
|
+
|
1126
|
+
def test_none?
|
1127
|
+
posts = Post.all
|
1128
|
+
assert_queries(1) do
|
1129
|
+
assert ! posts.none? # Uses COUNT()
|
1130
|
+
end
|
1131
|
+
|
1132
|
+
assert ! posts.loaded?
|
1133
|
+
|
1134
|
+
assert_queries(1) do
|
1135
|
+
assert posts.none? { |p| p.id < 0 }
|
1136
|
+
assert ! posts.none? { |p| p.id == 1 }
|
1137
|
+
end
|
1138
|
+
|
1139
|
+
assert posts.loaded?
|
1140
|
+
end
|
1141
|
+
|
1142
|
+
def test_one
|
1143
|
+
posts = Post.all
|
1144
|
+
assert_queries(1) do
|
1145
|
+
assert ! posts.one? # Uses COUNT()
|
1146
|
+
end
|
1147
|
+
|
1148
|
+
assert ! posts.loaded?
|
1149
|
+
|
1150
|
+
assert_queries(1) do
|
1151
|
+
assert ! posts.one? { |p| p.id < 3 }
|
1152
|
+
assert posts.one? { |p| p.id == 1 }
|
1153
|
+
end
|
1154
|
+
|
1155
|
+
assert posts.loaded?
|
1156
|
+
end
|
1157
|
+
|
1158
|
+
def test_to_a_should_dup_target
|
1159
|
+
posts = Post.all
|
1160
|
+
|
1161
|
+
original_size = posts.size
|
1162
|
+
removed = posts.to_a.pop
|
1163
|
+
|
1164
|
+
assert_equal original_size, posts.size
|
1165
|
+
assert_includes posts.to_a, removed
|
1166
|
+
end
|
1167
|
+
|
1168
|
+
def test_build
|
1169
|
+
posts = Post.all
|
1170
|
+
|
1171
|
+
post = posts.new
|
1172
|
+
assert_kind_of Post, post
|
1173
|
+
end
|
1174
|
+
|
1175
|
+
def test_scoped_build
|
1176
|
+
posts = Post.where(title: "You told a lie")
|
1177
|
+
|
1178
|
+
post = posts.new
|
1179
|
+
assert_kind_of Post, post
|
1180
|
+
assert_equal "You told a lie", post.title
|
1181
|
+
end
|
1182
|
+
|
1183
|
+
def test_create
|
1184
|
+
birds = Bird.all
|
1185
|
+
|
1186
|
+
sparrow = birds.create
|
1187
|
+
assert_kind_of Bird, sparrow
|
1188
|
+
assert !sparrow.persisted?
|
1189
|
+
|
1190
|
+
hen = birds.where(name: "hen").create
|
1191
|
+
assert hen.persisted?
|
1192
|
+
assert_equal "hen", hen.name
|
1193
|
+
end
|
1194
|
+
|
1195
|
+
def test_create_bang
|
1196
|
+
birds = Bird.all
|
1197
|
+
|
1198
|
+
assert_raises(ActiveRecord::RecordInvalid) { birds.create! }
|
1199
|
+
|
1200
|
+
hen = birds.where(name: "hen").create!
|
1201
|
+
assert_kind_of Bird, hen
|
1202
|
+
assert hen.persisted?
|
1203
|
+
assert_equal "hen", hen.name
|
1204
|
+
end
|
1205
|
+
|
1206
|
+
def test_first_or_create
|
1207
|
+
parrot = Bird.where(color: "green").first_or_create(name: "parrot")
|
1208
|
+
assert_kind_of Bird, parrot
|
1209
|
+
assert parrot.persisted?
|
1210
|
+
assert_equal "parrot", parrot.name
|
1211
|
+
assert_equal "green", parrot.color
|
1212
|
+
|
1213
|
+
same_parrot = Bird.where(color: "green").first_or_create(name: "parakeet")
|
1214
|
+
assert_kind_of Bird, same_parrot
|
1215
|
+
assert same_parrot.persisted?
|
1216
|
+
assert_equal parrot, same_parrot
|
1217
|
+
end
|
1218
|
+
|
1219
|
+
def test_first_or_create_with_no_parameters
|
1220
|
+
parrot = Bird.where(color: "green").first_or_create
|
1221
|
+
assert_kind_of Bird, parrot
|
1222
|
+
assert !parrot.persisted?
|
1223
|
+
assert_equal "green", parrot.color
|
1224
|
+
end
|
1225
|
+
|
1226
|
+
def test_first_or_create_with_block
|
1227
|
+
parrot = Bird.where(color: "green").first_or_create { |bird| bird.name = "parrot" }
|
1228
|
+
assert_kind_of Bird, parrot
|
1229
|
+
assert parrot.persisted?
|
1230
|
+
assert_equal "green", parrot.color
|
1231
|
+
assert_equal "parrot", parrot.name
|
1232
|
+
|
1233
|
+
same_parrot = Bird.where(color: "green").first_or_create { |bird| bird.name = "parakeet" }
|
1234
|
+
assert_equal parrot, same_parrot
|
1235
|
+
end
|
1236
|
+
|
1237
|
+
def test_first_or_create_with_array
|
1238
|
+
several_green_birds = Bird.where(color: "green").first_or_create([{ name: "parrot" }, { name: "parakeet" }])
|
1239
|
+
assert_kind_of Array, several_green_birds
|
1240
|
+
several_green_birds.each { |bird| assert bird.persisted? }
|
1241
|
+
|
1242
|
+
same_parrot = Bird.where(color: "green").first_or_create([{ name: "hummingbird" }, { name: "macaw" }])
|
1243
|
+
assert_kind_of Bird, same_parrot
|
1244
|
+
assert_equal several_green_birds.first, same_parrot
|
1245
|
+
end
|
1246
|
+
|
1247
|
+
def test_first_or_create_bang_with_valid_options
|
1248
|
+
parrot = Bird.where(color: "green").first_or_create!(name: "parrot")
|
1249
|
+
assert_kind_of Bird, parrot
|
1250
|
+
assert parrot.persisted?
|
1251
|
+
assert_equal "parrot", parrot.name
|
1252
|
+
assert_equal "green", parrot.color
|
1253
|
+
|
1254
|
+
same_parrot = Bird.where(color: "green").first_or_create!(name: "parakeet")
|
1255
|
+
assert_kind_of Bird, same_parrot
|
1256
|
+
assert same_parrot.persisted?
|
1257
|
+
assert_equal parrot, same_parrot
|
1258
|
+
end
|
1259
|
+
|
1260
|
+
def test_first_or_create_bang_with_invalid_options
|
1261
|
+
assert_raises(ActiveRecord::RecordInvalid) { Bird.where(color: "green").first_or_create!(pirate_id: 1) }
|
1262
|
+
end
|
1263
|
+
|
1264
|
+
def test_first_or_create_bang_with_no_parameters
|
1265
|
+
assert_raises(ActiveRecord::RecordInvalid) { Bird.where(color: "green").first_or_create! }
|
1266
|
+
end
|
1267
|
+
|
1268
|
+
def test_first_or_create_bang_with_valid_block
|
1269
|
+
parrot = Bird.where(color: "green").first_or_create! { |bird| bird.name = "parrot" }
|
1270
|
+
assert_kind_of Bird, parrot
|
1271
|
+
assert parrot.persisted?
|
1272
|
+
assert_equal "green", parrot.color
|
1273
|
+
assert_equal "parrot", parrot.name
|
1274
|
+
|
1275
|
+
same_parrot = Bird.where(color: "green").first_or_create! { |bird| bird.name = "parakeet" }
|
1276
|
+
assert_equal parrot, same_parrot
|
1277
|
+
end
|
1278
|
+
|
1279
|
+
def test_first_or_create_bang_with_invalid_block
|
1280
|
+
assert_raise(ActiveRecord::RecordInvalid) do
|
1281
|
+
Bird.where(color: "green").first_or_create! { |bird| bird.pirate_id = 1 }
|
1282
|
+
end
|
1283
|
+
end
|
1284
|
+
|
1285
|
+
def test_first_or_create_with_valid_array
|
1286
|
+
several_green_birds = Bird.where(color: "green").first_or_create!([{ name: "parrot" }, { name: "parakeet" }])
|
1287
|
+
assert_kind_of Array, several_green_birds
|
1288
|
+
several_green_birds.each { |bird| assert bird.persisted? }
|
1289
|
+
|
1290
|
+
same_parrot = Bird.where(color: "green").first_or_create!([{ name: "hummingbird" }, { name: "macaw" }])
|
1291
|
+
assert_kind_of Bird, same_parrot
|
1292
|
+
assert_equal several_green_birds.first, same_parrot
|
1293
|
+
end
|
1294
|
+
|
1295
|
+
def test_first_or_create_with_invalid_array
|
1296
|
+
assert_raises(ActiveRecord::RecordInvalid) { Bird.where(color: "green").first_or_create!([ { name: "parrot" }, { pirate_id: 1 } ]) }
|
1297
|
+
end
|
1298
|
+
|
1299
|
+
def test_first_or_initialize
|
1300
|
+
parrot = Bird.where(color: "green").first_or_initialize(name: "parrot")
|
1301
|
+
assert_kind_of Bird, parrot
|
1302
|
+
assert !parrot.persisted?
|
1303
|
+
assert parrot.valid?
|
1304
|
+
assert parrot.new_record?
|
1305
|
+
assert_equal "parrot", parrot.name
|
1306
|
+
assert_equal "green", parrot.color
|
1307
|
+
end
|
1308
|
+
|
1309
|
+
def test_first_or_initialize_with_no_parameters
|
1310
|
+
parrot = Bird.where(color: "green").first_or_initialize
|
1311
|
+
assert_kind_of Bird, parrot
|
1312
|
+
assert !parrot.persisted?
|
1313
|
+
assert !parrot.valid?
|
1314
|
+
assert parrot.new_record?
|
1315
|
+
assert_equal "green", parrot.color
|
1316
|
+
end
|
1317
|
+
|
1318
|
+
def test_first_or_initialize_with_block
|
1319
|
+
parrot = Bird.where(color: "green").first_or_initialize { |bird| bird.name = "parrot" }
|
1320
|
+
assert_kind_of Bird, parrot
|
1321
|
+
assert !parrot.persisted?
|
1322
|
+
assert parrot.valid?
|
1323
|
+
assert parrot.new_record?
|
1324
|
+
assert_equal "green", parrot.color
|
1325
|
+
assert_equal "parrot", parrot.name
|
1326
|
+
end
|
1327
|
+
|
1328
|
+
def test_find_or_create_by
|
1329
|
+
assert_nil Bird.find_by(name: "bob")
|
1330
|
+
|
1331
|
+
bird = Bird.find_or_create_by(name: "bob")
|
1332
|
+
assert bird.persisted?
|
1333
|
+
|
1334
|
+
assert_equal bird, Bird.find_or_create_by(name: "bob")
|
1335
|
+
end
|
1336
|
+
|
1337
|
+
def test_find_or_create_by_with_create_with
|
1338
|
+
assert_nil Bird.find_by(name: "bob")
|
1339
|
+
|
1340
|
+
bird = Bird.create_with(color: "green").find_or_create_by(name: "bob")
|
1341
|
+
assert bird.persisted?
|
1342
|
+
assert_equal "green", bird.color
|
1343
|
+
|
1344
|
+
assert_equal bird, Bird.create_with(color: "blue").find_or_create_by(name: "bob")
|
1345
|
+
end
|
1346
|
+
|
1347
|
+
def test_find_or_create_by!
|
1348
|
+
assert_raises(ActiveRecord::RecordInvalid) { Bird.find_or_create_by!(color: "green") }
|
1349
|
+
end
|
1350
|
+
|
1351
|
+
def test_find_or_initialize_by
|
1352
|
+
assert_nil Bird.find_by(name: "bob")
|
1353
|
+
|
1354
|
+
bird = Bird.find_or_initialize_by(name: "bob")
|
1355
|
+
assert bird.new_record?
|
1356
|
+
bird.save!
|
1357
|
+
|
1358
|
+
assert_equal bird, Bird.find_or_initialize_by(name: "bob")
|
1359
|
+
end
|
1360
|
+
|
1361
|
+
def test_explicit_create_with
|
1362
|
+
hens = Bird.where(name: "hen")
|
1363
|
+
assert_equal "hen", hens.new.name
|
1364
|
+
|
1365
|
+
hens = hens.create_with(name: "cock")
|
1366
|
+
assert_equal "cock", hens.new.name
|
1367
|
+
end
|
1368
|
+
|
1369
|
+
def test_except
|
1370
|
+
relation = Post.where(author_id: 1).order("id ASC").limit(1)
|
1371
|
+
assert_equal [posts(:welcome)], relation.to_a
|
1372
|
+
|
1373
|
+
author_posts = relation.except(:order, :limit)
|
1374
|
+
assert_equal Post.where(author_id: 1).to_a, author_posts.to_a
|
1375
|
+
|
1376
|
+
all_posts = relation.except(:where, :order, :limit)
|
1377
|
+
assert_equal Post.all, all_posts
|
1378
|
+
end
|
1379
|
+
|
1380
|
+
def test_only
|
1381
|
+
relation = Post.where(author_id: 1).order("id ASC").limit(1)
|
1382
|
+
assert_equal [posts(:welcome)], relation.to_a
|
1383
|
+
|
1384
|
+
author_posts = relation.only(:where)
|
1385
|
+
assert_equal Post.where(author_id: 1).to_a, author_posts.to_a
|
1386
|
+
|
1387
|
+
all_posts = relation.only(:limit)
|
1388
|
+
assert_equal Post.limit(1).to_a, all_posts.to_a
|
1389
|
+
end
|
1390
|
+
|
1391
|
+
def test_anonymous_extension
|
1392
|
+
relation = Post.where(author_id: 1).order("id ASC").extending do
|
1393
|
+
def author
|
1394
|
+
"lifo"
|
1395
|
+
end
|
1396
|
+
end
|
1397
|
+
|
1398
|
+
assert_equal "lifo", relation.author
|
1399
|
+
assert_equal "lifo", relation.limit(1).author
|
1400
|
+
end
|
1401
|
+
|
1402
|
+
def test_named_extension
|
1403
|
+
relation = Post.where(author_id: 1).order("id ASC").extending(Post::NamedExtension)
|
1404
|
+
assert_equal "lifo", relation.author
|
1405
|
+
assert_equal "lifo", relation.limit(1).author
|
1406
|
+
end
|
1407
|
+
|
1408
|
+
def test_order_by_relation_attribute
|
1409
|
+
assert_equal Post.order(Post.arel_table[:title]).to_a, Post.order("title").to_a
|
1410
|
+
end
|
1411
|
+
|
1412
|
+
def test_default_scope_order_with_scope_order
|
1413
|
+
assert_equal "zyke", CoolCar.order_using_new_style.limit(1).first.name
|
1414
|
+
assert_equal "zyke", FastCar.order_using_new_style.limit(1).first.name
|
1415
|
+
end
|
1416
|
+
|
1417
|
+
def test_order_using_scoping
|
1418
|
+
car1 = CoolCar.order("id DESC").scoping do
|
1419
|
+
CoolCar.all.merge!(order: "id asc").first
|
1420
|
+
end
|
1421
|
+
assert_equal "zyke", car1.name
|
1422
|
+
|
1423
|
+
car2 = FastCar.order("id DESC").scoping do
|
1424
|
+
FastCar.all.merge!(order: "id asc").first
|
1425
|
+
end
|
1426
|
+
assert_equal "zyke", car2.name
|
1427
|
+
end
|
1428
|
+
|
1429
|
+
def test_unscoped_block_style
|
1430
|
+
assert_equal "honda", CoolCar.unscoped { CoolCar.order_using_new_style.limit(1).first.name }
|
1431
|
+
assert_equal "honda", FastCar.unscoped { FastCar.order_using_new_style.limit(1).first.name }
|
1432
|
+
end
|
1433
|
+
|
1434
|
+
def test_intersection_with_array
|
1435
|
+
relation = Author.where(name: "David")
|
1436
|
+
quails_author = relation.first
|
1437
|
+
|
1438
|
+
assert_equal [quails_author], [quails_author] & relation
|
1439
|
+
assert_equal [quails_author], relation & [quails_author]
|
1440
|
+
end
|
1441
|
+
|
1442
|
+
def test_primary_key
|
1443
|
+
assert_equal "id", Post.all.primary_key
|
1444
|
+
end
|
1445
|
+
|
1446
|
+
def test_ordering_with_extra_spaces
|
1447
|
+
assert_equal authors(:david), Author.order("id DESC , name DESC").last
|
1448
|
+
end
|
1449
|
+
|
1450
|
+
def test_update_all_with_blank_argument
|
1451
|
+
assert_raises(ArgumentError) { Comment.update_all({}) }
|
1452
|
+
end
|
1453
|
+
|
1454
|
+
def test_update_all_with_joins
|
1455
|
+
comments = Comment.joins(:post).where("posts.id" => posts(:welcome).id)
|
1456
|
+
count = comments.count
|
1457
|
+
|
1458
|
+
assert_equal count, comments.update_all(post_id: posts(:thinking).id)
|
1459
|
+
assert_equal posts(:thinking), comments(:greetings).post
|
1460
|
+
end
|
1461
|
+
|
1462
|
+
def test_update_all_with_joins_and_limit
|
1463
|
+
comments = Comment.joins(:post).where("posts.id" => posts(:welcome).id).limit(1)
|
1464
|
+
assert_equal 1, comments.update_all(post_id: posts(:thinking).id)
|
1465
|
+
end
|
1466
|
+
|
1467
|
+
def test_update_all_with_joins_and_limit_and_order
|
1468
|
+
comments = Comment.joins(:post).where("posts.id" => posts(:welcome).id).order("comments.id").limit(1)
|
1469
|
+
assert_equal 1, comments.update_all(post_id: posts(:thinking).id)
|
1470
|
+
assert_equal posts(:thinking), comments(:greetings).post
|
1471
|
+
assert_equal posts(:welcome), comments(:more_greetings).post
|
1472
|
+
end
|
1473
|
+
|
1474
|
+
def test_update_all_with_joins_and_offset
|
1475
|
+
all_comments = Comment.joins(:post).where("posts.id" => posts(:welcome).id)
|
1476
|
+
count = all_comments.count
|
1477
|
+
comments = all_comments.offset(1)
|
1478
|
+
|
1479
|
+
assert_equal count - 1, comments.update_all(post_id: posts(:thinking).id)
|
1480
|
+
end
|
1481
|
+
|
1482
|
+
def test_update_all_with_joins_and_offset_and_order
|
1483
|
+
all_comments = Comment.joins(:post).where("posts.id" => posts(:welcome).id).order("posts.id", "comments.id")
|
1484
|
+
count = all_comments.count
|
1485
|
+
comments = all_comments.offset(1)
|
1486
|
+
|
1487
|
+
assert_equal count - 1, comments.update_all(post_id: posts(:thinking).id)
|
1488
|
+
assert_equal posts(:thinking), comments(:more_greetings).post
|
1489
|
+
assert_equal posts(:welcome), comments(:greetings).post
|
1490
|
+
end
|
1491
|
+
|
1492
|
+
def test_update_on_relation
|
1493
|
+
topic1 = TopicWithCallbacks.create! title: "arel", author_name: nil
|
1494
|
+
topic2 = TopicWithCallbacks.create! title: "activerecord", author_name: nil
|
1495
|
+
topics = TopicWithCallbacks.where(id: [topic1.id, topic2.id])
|
1496
|
+
topics.update(title: "adequaterecord")
|
1497
|
+
|
1498
|
+
assert_equal "adequaterecord", topic1.reload.title
|
1499
|
+
assert_equal "adequaterecord", topic2.reload.title
|
1500
|
+
# Testing that the before_update callbacks have run
|
1501
|
+
assert_equal "David", topic1.reload.author_name
|
1502
|
+
assert_equal "David", topic2.reload.author_name
|
1503
|
+
end
|
1504
|
+
|
1505
|
+
def test_update_on_relation_passing_active_record_object_is_not_permitted
|
1506
|
+
topic = Topic.create!(title: "Foo", author_name: nil)
|
1507
|
+
assert_raises(ArgumentError) do
|
1508
|
+
Topic.where(id: topic.id).update(topic, title: "Bar")
|
1509
|
+
end
|
1510
|
+
end
|
1511
|
+
|
1512
|
+
def test_distinct
|
1513
|
+
tag1 = Tag.create(name: "Foo")
|
1514
|
+
tag2 = Tag.create(name: "Foo")
|
1515
|
+
|
1516
|
+
query = Tag.select(:name).where(id: [tag1.id, tag2.id])
|
1517
|
+
|
1518
|
+
assert_equal ["Foo", "Foo"], query.map(&:name)
|
1519
|
+
assert_sql(/DISTINCT/) do
|
1520
|
+
assert_equal ["Foo"], query.distinct.map(&:name)
|
1521
|
+
end
|
1522
|
+
assert_sql(/DISTINCT/) do
|
1523
|
+
assert_equal ["Foo"], query.distinct(true).map(&:name)
|
1524
|
+
end
|
1525
|
+
assert_equal ["Foo", "Foo"], query.distinct(true).distinct(false).map(&:name)
|
1526
|
+
end
|
1527
|
+
|
1528
|
+
def test_doesnt_add_having_values_if_options_are_blank
|
1529
|
+
scope = Post.having("")
|
1530
|
+
assert scope.having_clause.empty?
|
1531
|
+
|
1532
|
+
scope = Post.having([])
|
1533
|
+
assert scope.having_clause.empty?
|
1534
|
+
end
|
1535
|
+
|
1536
|
+
def test_having_with_binds_for_both_where_and_having
|
1537
|
+
post = Post.first
|
1538
|
+
having_then_where = Post.having(id: post.id).where(title: post.title).group(:id)
|
1539
|
+
where_then_having = Post.where(title: post.title).having(id: post.id).group(:id)
|
1540
|
+
|
1541
|
+
assert_equal [post], having_then_where
|
1542
|
+
assert_equal [post], where_then_having
|
1543
|
+
end
|
1544
|
+
|
1545
|
+
def test_multiple_where_and_having_clauses
|
1546
|
+
post = Post.first
|
1547
|
+
having_then_where = Post.having(id: post.id).where(title: post.title)
|
1548
|
+
.having(id: post.id).where(title: post.title).group(:id)
|
1549
|
+
|
1550
|
+
assert_equal [post], having_then_where
|
1551
|
+
end
|
1552
|
+
|
1553
|
+
def test_grouping_by_column_with_reserved_name
|
1554
|
+
assert_equal [], Possession.select(:where).group(:where).to_a
|
1555
|
+
end
|
1556
|
+
|
1557
|
+
def test_references_triggers_eager_loading
|
1558
|
+
scope = Post.includes(:comments)
|
1559
|
+
assert !scope.eager_loading?
|
1560
|
+
assert scope.references(:comments).eager_loading?
|
1561
|
+
end
|
1562
|
+
|
1563
|
+
def test_references_doesnt_trigger_eager_loading_if_reference_not_included
|
1564
|
+
scope = Post.references(:comments)
|
1565
|
+
assert !scope.eager_loading?
|
1566
|
+
end
|
1567
|
+
|
1568
|
+
def test_automatically_added_where_references
|
1569
|
+
scope = Post.where(comments: { body: "Bla" })
|
1570
|
+
assert_equal ["comments"], scope.references_values
|
1571
|
+
|
1572
|
+
scope = Post.where("comments.body" => "Bla")
|
1573
|
+
assert_equal ["comments"], scope.references_values
|
1574
|
+
end
|
1575
|
+
|
1576
|
+
def test_automatically_added_where_not_references
|
1577
|
+
scope = Post.where.not(comments: { body: "Bla" })
|
1578
|
+
assert_equal ["comments"], scope.references_values
|
1579
|
+
|
1580
|
+
scope = Post.where.not("comments.body" => "Bla")
|
1581
|
+
assert_equal ["comments"], scope.references_values
|
1582
|
+
end
|
1583
|
+
|
1584
|
+
def test_automatically_added_having_references
|
1585
|
+
scope = Post.having(comments: { body: "Bla" })
|
1586
|
+
assert_equal ["comments"], scope.references_values
|
1587
|
+
|
1588
|
+
scope = Post.having("comments.body" => "Bla")
|
1589
|
+
assert_equal ["comments"], scope.references_values
|
1590
|
+
end
|
1591
|
+
|
1592
|
+
def test_automatically_added_order_references
|
1593
|
+
scope = Post.order("comments.body")
|
1594
|
+
assert_equal ["comments"], scope.references_values
|
1595
|
+
|
1596
|
+
scope = Post.order("#{Comment.quoted_table_name}.#{Comment.quoted_primary_key}")
|
1597
|
+
if current_adapter?(:OracleAdapter)
|
1598
|
+
assert_equal ["COMMENTS"], scope.references_values
|
1599
|
+
else
|
1600
|
+
assert_equal ["comments"], scope.references_values
|
1601
|
+
end
|
1602
|
+
|
1603
|
+
scope = Post.order("comments.body", "yaks.body")
|
1604
|
+
assert_equal ["comments", "yaks"], scope.references_values
|
1605
|
+
|
1606
|
+
# Don't infer yaks, let's not go down that road again...
|
1607
|
+
scope = Post.order("comments.body, yaks.body")
|
1608
|
+
assert_equal ["comments"], scope.references_values
|
1609
|
+
|
1610
|
+
scope = Post.order("comments.body asc")
|
1611
|
+
assert_equal ["comments"], scope.references_values
|
1612
|
+
|
1613
|
+
scope = Post.order("foo(comments.body)")
|
1614
|
+
assert_equal [], scope.references_values
|
1615
|
+
end
|
1616
|
+
|
1617
|
+
def test_automatically_added_reorder_references
|
1618
|
+
scope = Post.reorder("comments.body")
|
1619
|
+
assert_equal %w(comments), scope.references_values
|
1620
|
+
|
1621
|
+
scope = Post.reorder("#{Comment.quoted_table_name}.#{Comment.quoted_primary_key}")
|
1622
|
+
if current_adapter?(:OracleAdapter)
|
1623
|
+
assert_equal ["COMMENTS"], scope.references_values
|
1624
|
+
else
|
1625
|
+
assert_equal ["comments"], scope.references_values
|
1626
|
+
end
|
1627
|
+
|
1628
|
+
scope = Post.reorder("comments.body", "yaks.body")
|
1629
|
+
assert_equal %w(comments yaks), scope.references_values
|
1630
|
+
|
1631
|
+
# Don't infer yaks, let's not go down that road again...
|
1632
|
+
scope = Post.reorder("comments.body, yaks.body")
|
1633
|
+
assert_equal %w(comments), scope.references_values
|
1634
|
+
|
1635
|
+
scope = Post.reorder("comments.body asc")
|
1636
|
+
assert_equal %w(comments), scope.references_values
|
1637
|
+
|
1638
|
+
scope = Post.reorder("foo(comments.body)")
|
1639
|
+
assert_equal [], scope.references_values
|
1640
|
+
end
|
1641
|
+
|
1642
|
+
def test_order_with_reorder_nil_removes_the_order
|
1643
|
+
relation = Post.order(:title).reorder(nil)
|
1644
|
+
|
1645
|
+
assert_nil relation.order_values.first
|
1646
|
+
end
|
1647
|
+
|
1648
|
+
def test_reverse_order_with_reorder_nil_removes_the_order
|
1649
|
+
relation = Post.order(:title).reverse_order.reorder(nil)
|
1650
|
+
|
1651
|
+
assert_nil relation.order_values.first
|
1652
|
+
end
|
1653
|
+
|
1654
|
+
def test_presence
|
1655
|
+
topics = Topic.all
|
1656
|
+
|
1657
|
+
# the first query is triggered because there are no topics yet.
|
1658
|
+
assert_queries(1) { assert topics.present? }
|
1659
|
+
|
1660
|
+
# checking if there are topics is used before you actually display them,
|
1661
|
+
# thus it shouldn't invoke an extra count query.
|
1662
|
+
assert_no_queries { assert topics.present? }
|
1663
|
+
assert_no_queries { assert !topics.blank? }
|
1664
|
+
|
1665
|
+
# shows count of topics and loops after loading the query should not trigger extra queries either.
|
1666
|
+
assert_no_queries { topics.size }
|
1667
|
+
assert_no_queries { topics.length }
|
1668
|
+
assert_no_queries { topics.each }
|
1669
|
+
|
1670
|
+
# count always trigger the COUNT query.
|
1671
|
+
assert_queries(1) { topics.count }
|
1672
|
+
|
1673
|
+
assert topics.loaded?
|
1674
|
+
end
|
1675
|
+
|
1676
|
+
test "find_by with hash conditions returns the first matching record" do
|
1677
|
+
assert_equal posts(:eager_other), Post.order(:id).find_by(author_id: 2)
|
1678
|
+
end
|
1679
|
+
|
1680
|
+
test "find_by with non-hash conditions returns the first matching record" do
|
1681
|
+
assert_equal posts(:eager_other), Post.order(:id).find_by("author_id = 2")
|
1682
|
+
end
|
1683
|
+
|
1684
|
+
test "find_by with multi-arg conditions returns the first matching record" do
|
1685
|
+
assert_equal posts(:eager_other), Post.order(:id).find_by("author_id = ?", 2)
|
1686
|
+
end
|
1687
|
+
|
1688
|
+
test "find_by returns nil if the record is missing" do
|
1689
|
+
assert_nil Post.all.find_by("1 = 0")
|
1690
|
+
end
|
1691
|
+
|
1692
|
+
test "find_by doesn't have implicit ordering" do
|
1693
|
+
assert_sql(/^((?!ORDER).)*$/) { Post.all.find_by(author_id: 2) }
|
1694
|
+
end
|
1695
|
+
|
1696
|
+
test "find_by requires at least one argument" do
|
1697
|
+
assert_raises(ArgumentError) { Post.all.find_by }
|
1698
|
+
end
|
1699
|
+
|
1700
|
+
test "find_by! with hash conditions returns the first matching record" do
|
1701
|
+
assert_equal posts(:eager_other), Post.order(:id).find_by!(author_id: 2)
|
1702
|
+
end
|
1703
|
+
|
1704
|
+
test "find_by! with non-hash conditions returns the first matching record" do
|
1705
|
+
assert_equal posts(:eager_other), Post.order(:id).find_by!("author_id = 2")
|
1706
|
+
end
|
1707
|
+
|
1708
|
+
test "find_by! with multi-arg conditions returns the first matching record" do
|
1709
|
+
assert_equal posts(:eager_other), Post.order(:id).find_by!("author_id = ?", 2)
|
1710
|
+
end
|
1711
|
+
|
1712
|
+
test "find_by! doesn't have implicit ordering" do
|
1713
|
+
assert_sql(/^((?!ORDER).)*$/) { Post.all.find_by!(author_id: 2) }
|
1714
|
+
end
|
1715
|
+
|
1716
|
+
test "find_by! raises RecordNotFound if the record is missing" do
|
1717
|
+
assert_raises(ActiveRecord::RecordNotFound) do
|
1718
|
+
Post.all.find_by!("1 = 0")
|
1719
|
+
end
|
1720
|
+
end
|
1721
|
+
|
1722
|
+
test "find_by! requires at least one argument" do
|
1723
|
+
assert_raises(ArgumentError) { Post.all.find_by! }
|
1724
|
+
end
|
1725
|
+
|
1726
|
+
test "loaded relations cannot be mutated by multi value methods" do
|
1727
|
+
relation = Post.all
|
1728
|
+
relation.to_a
|
1729
|
+
|
1730
|
+
assert_raises(ActiveRecord::ImmutableRelation) do
|
1731
|
+
relation.where! "foo"
|
1732
|
+
end
|
1733
|
+
end
|
1734
|
+
|
1735
|
+
test "loaded relations cannot be mutated by single value methods" do
|
1736
|
+
relation = Post.all
|
1737
|
+
relation.to_a
|
1738
|
+
|
1739
|
+
assert_raises(ActiveRecord::ImmutableRelation) do
|
1740
|
+
relation.limit! 5
|
1741
|
+
end
|
1742
|
+
end
|
1743
|
+
|
1744
|
+
test "loaded relations cannot be mutated by merge!" do
|
1745
|
+
relation = Post.all
|
1746
|
+
relation.to_a
|
1747
|
+
|
1748
|
+
assert_raises(ActiveRecord::ImmutableRelation) do
|
1749
|
+
relation.merge! where: "foo"
|
1750
|
+
end
|
1751
|
+
end
|
1752
|
+
|
1753
|
+
test "loaded relations cannot be mutated by extending!" do
|
1754
|
+
relation = Post.all
|
1755
|
+
relation.to_a
|
1756
|
+
|
1757
|
+
assert_raises(ActiveRecord::ImmutableRelation) do
|
1758
|
+
relation.extending! Module.new
|
1759
|
+
end
|
1760
|
+
end
|
1761
|
+
|
1762
|
+
test "relations with cached arel can't be mutated [internal API]" do
|
1763
|
+
relation = Post.all
|
1764
|
+
relation.arel
|
1765
|
+
|
1766
|
+
assert_raises(ActiveRecord::ImmutableRelation) { relation.limit!(5) }
|
1767
|
+
assert_raises(ActiveRecord::ImmutableRelation) { relation.where!("1 = 2") }
|
1768
|
+
end
|
1769
|
+
|
1770
|
+
test "relations show the records in #inspect" do
|
1771
|
+
relation = Post.limit(2)
|
1772
|
+
assert_equal "#<ActiveRecord::Relation [#{Post.limit(2).map(&:inspect).join(', ')}]>", relation.inspect
|
1773
|
+
end
|
1774
|
+
|
1775
|
+
test "relations limit the records in #inspect at 10" do
|
1776
|
+
relation = Post.limit(11)
|
1777
|
+
assert_equal "#<ActiveRecord::Relation [#{Post.limit(10).map(&:inspect).join(', ')}, ...]>", relation.inspect
|
1778
|
+
end
|
1779
|
+
|
1780
|
+
test "relations don't load all records in #inspect" do
|
1781
|
+
assert_sql(/LIMIT|ROWNUM <=|FETCH FIRST/) do
|
1782
|
+
Post.all.inspect
|
1783
|
+
end
|
1784
|
+
end
|
1785
|
+
|
1786
|
+
test "already-loaded relations don't perform a new query in #inspect" do
|
1787
|
+
relation = Post.limit(2)
|
1788
|
+
relation.to_a
|
1789
|
+
|
1790
|
+
expected = "#<ActiveRecord::Relation [#{Post.limit(2).map(&:inspect).join(', ')}]>"
|
1791
|
+
|
1792
|
+
assert_no_queries do
|
1793
|
+
assert_equal expected, relation.inspect
|
1794
|
+
end
|
1795
|
+
end
|
1796
|
+
|
1797
|
+
test "using a custom table affects the wheres" do
|
1798
|
+
post = posts(:welcome)
|
1799
|
+
|
1800
|
+
assert_equal post, custom_post_relation.where!(title: post.title).take
|
1801
|
+
end
|
1802
|
+
|
1803
|
+
test "using a custom table with joins affects the joins" do
|
1804
|
+
post = posts(:welcome)
|
1805
|
+
|
1806
|
+
assert_equal post, custom_post_relation.joins(:author).where!(title: post.title).take
|
1807
|
+
end
|
1808
|
+
|
1809
|
+
test "#load" do
|
1810
|
+
relation = Post.all
|
1811
|
+
assert_queries(1) do
|
1812
|
+
assert_equal relation, relation.load
|
1813
|
+
end
|
1814
|
+
assert_no_queries { relation.to_a }
|
1815
|
+
end
|
1816
|
+
|
1817
|
+
test "group with select and includes" do
|
1818
|
+
authors_count = Post.select("author_id, COUNT(author_id) AS num_posts").
|
1819
|
+
group("author_id").order("author_id").includes(:author).to_a
|
1820
|
+
|
1821
|
+
assert_no_queries do
|
1822
|
+
result = authors_count.map do |post|
|
1823
|
+
[post.num_posts, post.author.try(:name)]
|
1824
|
+
end
|
1825
|
+
|
1826
|
+
expected = [[1, nil], [5, "David"], [3, "Mary"], [2, "Bob"]]
|
1827
|
+
assert_equal expected, result
|
1828
|
+
end
|
1829
|
+
end
|
1830
|
+
|
1831
|
+
test "joins with select" do
|
1832
|
+
posts = Post.joins(:author).select("id", "authors.author_address_id").order("posts.id").limit(3)
|
1833
|
+
assert_equal [1, 2, 4], posts.map(&:id)
|
1834
|
+
assert_equal [1, 1, 1], posts.map(&:author_address_id)
|
1835
|
+
end
|
1836
|
+
|
1837
|
+
test "delegations do not leak to other classes" do
|
1838
|
+
Topic.all.by_lifo
|
1839
|
+
assert Topic.all.class.method_defined?(:by_lifo)
|
1840
|
+
assert !Post.all.respond_to?(:by_lifo)
|
1841
|
+
end
|
1842
|
+
|
1843
|
+
def test_unscope_with_subquery
|
1844
|
+
p1 = Post.where(id: 1)
|
1845
|
+
p2 = Post.where(id: 2)
|
1846
|
+
|
1847
|
+
assert_not_equal p1, p2
|
1848
|
+
|
1849
|
+
comments = Comment.where(post: p1).unscope(where: :post_id).where(post: p2)
|
1850
|
+
|
1851
|
+
assert_not_equal p1.first.comments, comments
|
1852
|
+
assert_equal p2.first.comments, comments
|
1853
|
+
end
|
1854
|
+
|
1855
|
+
def test_unscope_specific_where_value
|
1856
|
+
posts = Post.where(title: "Welcome to the weblog", body: "Such a lovely day")
|
1857
|
+
|
1858
|
+
assert_equal 1, posts.count
|
1859
|
+
assert_equal 1, posts.unscope(where: :title).count
|
1860
|
+
assert_equal 1, posts.unscope(where: :body).count
|
1861
|
+
end
|
1862
|
+
|
1863
|
+
def test_locked_should_not_build_arel
|
1864
|
+
posts = Post.locked
|
1865
|
+
assert posts.locked?
|
1866
|
+
assert_nothing_raised { posts.lock!(false) }
|
1867
|
+
end
|
1868
|
+
|
1869
|
+
def test_relation_join_method
|
1870
|
+
assert_equal "Thank you for the welcome,Thank you again for the welcome", Post.first.comments.join(",")
|
1871
|
+
end
|
1872
|
+
|
1873
|
+
test "#skip_query_cache!" do
|
1874
|
+
Post.cache do
|
1875
|
+
assert_queries(1) do
|
1876
|
+
Post.all.load
|
1877
|
+
Post.all.load
|
1878
|
+
end
|
1879
|
+
|
1880
|
+
assert_queries(2) do
|
1881
|
+
Post.all.skip_query_cache!.load
|
1882
|
+
Post.all.skip_query_cache!.load
|
1883
|
+
end
|
1884
|
+
end
|
1885
|
+
end
|
1886
|
+
|
1887
|
+
test "#skip_query_cache! with an eager load" do
|
1888
|
+
Post.cache do
|
1889
|
+
assert_queries(1) do
|
1890
|
+
Post.eager_load(:comments).load
|
1891
|
+
Post.eager_load(:comments).load
|
1892
|
+
end
|
1893
|
+
|
1894
|
+
assert_queries(2) do
|
1895
|
+
Post.eager_load(:comments).skip_query_cache!.load
|
1896
|
+
Post.eager_load(:comments).skip_query_cache!.load
|
1897
|
+
end
|
1898
|
+
end
|
1899
|
+
end
|
1900
|
+
|
1901
|
+
test "#skip_query_cache! with a preload" do
|
1902
|
+
Post.cache do
|
1903
|
+
assert_queries(2) do
|
1904
|
+
Post.preload(:comments).load
|
1905
|
+
Post.preload(:comments).load
|
1906
|
+
end
|
1907
|
+
|
1908
|
+
assert_queries(4) do
|
1909
|
+
Post.preload(:comments).skip_query_cache!.load
|
1910
|
+
Post.preload(:comments).skip_query_cache!.load
|
1911
|
+
end
|
1912
|
+
end
|
1913
|
+
end
|
1914
|
+
|
1915
|
+
private
|
1916
|
+
def custom_post_relation
|
1917
|
+
table_alias = Post.arel_table.alias("omg_posts")
|
1918
|
+
table_metadata = ActiveRecord::TableMetadata.new(Post, table_alias)
|
1919
|
+
predicate_builder = ActiveRecord::PredicateBuilder.new(table_metadata)
|
1920
|
+
|
1921
|
+
ActiveRecord::Relation.create(Post, table_alias, predicate_builder)
|
1922
|
+
end
|
1923
|
+
end
|