aboutsummaryrefslogtreecommitdiffstats
path: root/railties/test/application
Commit message (Collapse)AuthorAgeFilesLines
* styleXavier Noria2019-02-121-3/+3
|
* Zeitwerk integrationXavier Noria2019-02-125-26/+190
|
* Fix assertion excpected/actual orderUfuk Kayserilioglu2019-02-111-6/+6
| | | | | | | | The assertion from the previous PR had the expected and the actual values in the wrong order, so when a test failed the error message was confusing. This commit fixes the problem by switching the order.
* Allow deprecated non-symbol access to nested `config_for` hashesUfuk Kayserilioglu2019-02-111-1/+102
| | | | | | | | | | | | | | | | | | | | | | | | | | | A change to `Rails::Application.config_for` in https://github.com/rails/rails/pull/33815 and https://github.com/rails/rails/pull/33882 has altered the behaviour of the returned object in a breaking manner. Before that change, nested hashes returned from `config_for` could be accessed using non-symbol keys. After the change, all keys are recursively symbolized so non-symbol access fails to read the expected values. This is a breaking change for any app that might be relying on the nested hashes returned from `config_for` calls, and thus should be deprecated before being removed from the codebase. This commit introduces a temporary `NonSymbolAccessDeprecatedHash` class that recursively wraps any nested hashes inside the `OrderedOptions` object returned from `config_for` and issues a deprecation notice when a non-symbol based access is performed. This way, apps that are still relying on the ability to access these nested hashes using non-symbol keys will be able to observe the deprecation notices and have time to implement changes before non-symbol access is removed for good. A CHANGELOG entry is also added to note that non-symbol access to nested `config_for` hashes is deprecated.
* Fix rubocop violationsyuuji.yaginuma2019-02-091-9/+7
|
* Deprecate finalizer configuration (it doesn't do anything)Aaron Patterson2019-02-061-0/+21
| | | | | | Revert "Remove finalizer and configuration" This reverts commit 9e7b4a3173788ea43b11e74a4d2f69a5f1565daa.
* Remove finalizer and configurationAaron Patterson2019-02-061-17/+0
|
* Respect ENV variables when finding DBs etc for the test suiteMatthew Draper2019-02-063-10/+15
| | | | | If they're not set we'll still fall back to localhost, but this makes it possible to run the tests against a remote Postgres / Redis / whatever.
* Merge pull request #35086 from gsamokovarov/cleanup-whitelisting-refsGannon McGibbon2019-02-041-1/+1
|\ | | | | Cleanup the whitelisting references after #33145
| * Cleanup the whitelisting references after #33145Genadi Samokovarov2019-02-031-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | During the development of #33145, I have named a few concepts in the code as `whitelisted`. We decided to stay away from the term and I adjusted most of the code afterwards, but here are the cases I forgot to change. I also found a case in the API guide that we could have cleaned up as well. [ci skip]
* | Railities typo fixes.alkesh262019-02-011-1/+1
| |
* | Rename methods and update docsEileen Uchitelle2019-01-291-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | This is a minor update to the named methods for the following: - s/desired_capabilities/capabilities - s/driver_options/capabilities Since they are all the same thing we should keep the name the same throughout the feature. Updated docs to match / be a little bit clearer Also updated the Gemfile for selenium-webdriver.
* | Implement a way to add browser capabilities:Edouard CHIN2019-01-291-0/+2
|/ | | | | | | | | | | | | | | | | | * There is currently no way to define specific browser capabilities since our SystemTest driver override the `option` key [Ref](https://github.com/rails/rails/blob/a07d0680787ced3c04b362fa7a238c918211ac70/actionpack/lib/action_dispatch/system_testing/driver.rb#L35) This option key is used internally by selenium to add custom capabilities on the browser. Depending on the Browser, some option are allowed to be passed inside a hash, the driver takes care of setting whatever you passed on the driver option. An example [here](https://github.com/rails/rails/blob/a07d0680787ced3c04b362fa7a238c918211ac70/actionpack/lib/action_dispatch/system_testing/driver.rb#L35) where you are allowed to pass args such as `--no-sandbox` etc However this behavior was only meant for backward compatibility and as you can see it's deprecated. The non-deprecated behavior is to create a `<Driver>::Option` object containing all the capabilities we want. This is what we [currently do](https://github.com/rails/rails/blob/a07d0680787ced3c04b362fa7a238c918211ac70/actionpack/lib/action_dispatch/system_testing/browser.rb#L34-L36) when chrome or firefox are in headless mode. This PR allows to pass a block when calling `driven_by`, the block will be pased a `<Driver>::Option` instance. You can modify this object the way you want by adding any capabilities. The option object will be then passed to selenium. ```ruby driven_by :selenium, using: :chrome do |driver_option| driver_option.add_argument('--no-sandbox') driver_option.add_emulation(device: 'iphone 4') end ```
* Merge pull request #34993 from schuetzm/allow-subdomains-of-localhostRafael França2019-01-231-0/+5
|\ | | | | Subdomains of localhost are safe against DNS rebinding
| * Subdomains of localhost are safe against DNS rebindingMarc Schütz2019-01-231-0/+5
| |
* | Add Channel tests to `rails stats`bogdanvlviv2019-01-211-1/+1
|/ | | | | | | | | Rails generates `test/channels`(#34933) and even allows `rails test:channels` (#34947). `rails stats` has been providing info about `app/channels`, it makes sense to add `test/channels` as well. (I've changed test because we generate `test/channels` with some code)
* Remove deprecated support to old `config.ru` that use the application class ↵Rafael Mendonça França2019-01-171-14/+0
| | | | as argument of `run`
* Remove deprecated `environment` argument from the rails commandsRafael Mendonça França2019-01-171-1/+1
|
* Remove deprecated `config.secret_token`Rafael Mendonça França2019-01-173-211/+3
|
* Change `SQLite3Adapter` to always represent boolean values as integersRafael Mendonça França2019-01-171-19/+11
|
* Minimize boilerplate setup code for JavaScript librariesJavan Makhmali2019-01-161-1/+1
|
* Add `rails test:channels`.bogdanvlviv2019-01-161-2/+13
| | | | | Add this rake task to test channels only. We've added `rails test:mailboxes` recently in the same way #34828.
* Restructure credentials after environment overrides.Kasper Timm Hansen2019-01-142-2/+58
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | Follow up to: e0d3313 - Revert renames from `encrypted` and `encrypted_file` back to `credentials`. They might be using our Encrypted* generators but from that level of abstraction they're still about credentials. - Same vein: extract a `credentials` method for the `encrypted` local variable. But don't call it `encrypted` just because it uses that under the hood. It's about capturing the credentials. It's also useful in `change_credentials_in_system_editor`. - Remove lots of needless argument passing. We've abstracted content_path and key_path into methods for a reason, so they should be used. Also spares a conspicuous rename of content_path into file_path in other methods. - Reorders private methods so they're grouped into: command building blocks, option parsers, and the generators. - Extracts commonality in the credentials application tests. A tad unsure about this. But I do like that we go with key, content thus matching the command and remove the yield which isn't really needed. - Moves test/credentials_test.rb to beneath the test/application directory. It's a Rails application test, so it should be in there. - Uses `root.join` — a neat trick gleaned from the tests! — and composes the configuration private methods such that the building block is below the callers.
* Add Exim and Qmail support to Action MailboxGeorge Claghorn2019-01-121-1/+1
|
* Merge pull request #34907 from wildbit/actionmailbox-postmarkGeorge Claghorn2019-01-091-0/+1
|\ | | | | Add Postmark ingress support to ActionMailbox
| * Added Postmark ingress supportTomek Maszkowski2019-01-091-0/+1
| |
* | Move MailDeliveryJob default to 6.0 defaultsGannon McGibbon2019-01-071-0/+27
|/
* Test Action Mailbox configurationsbogdanvlviv2019-01-041-0/+71
| | | | Related to https://github.com/rails/rails/commit/0d40c62213cf0be58a470637bd364e92c5666402
* Send Active Storage jobs to dedicated queues by defaultGeorge Claghorn2019-01-041-0/+28
| | | Match Action Mailbox, which sets a default queue for each of its two jobs.
* Merge pull request #33985 from eugeneius/attribute_methods_schema_cacheKasper Timm Hansen2019-01-031-1/+63
|\ | | | | Only define attribute methods from schema cache
| * Only define attribute methods from schema cacheEugene Kenny2018-09-281-1/+63
| | | | | | | | | | | | | | | | | | | | | | | | | | To define the attribute methods for a model, Active Record needs to know the schema of the underlying table, which is usually achieved by making a request to the database. This is undesirable behaviour while the app is booting, for two reasons: it makes the boot process dependent on the availability of the database, and it means every new process will make one query for each table, which can cause issues for large applications. However, if the application is using the schema cache dump feature, then the schema cache already contains the necessary information, and we can define the attribute methods without causing any extra database queries.
* | Add Rake task for testing mailboxesGeorge Claghorn2018-12-301-2/+14
| |
* | Import Action MailboxGeorge Claghorn2018-12-251-7/+22
| |
* | No need to handle if FrozenError is availableYasuo Honda2018-12-231-1/+1
| | | | | | | | | | | | | | Rails 6 requires Ruby 2.5, which introduces `FrozenError` https://docs.ruby-lang.org/en/2.5.0/NEWS.html Related to #31520
* | Enable `Style/RedundantBegin` cop to avoid newly adding redundant begin blockRyuta Kamizono2018-12-213-48/+40
| | | | | | | | | | | | | | | | | | | | Currently we sometimes find a redundant begin block in code review (e.g. https://github.com/rails/rails/pull/33604#discussion_r209784205). I'd like to enable `Style/RedundantBegin` cop to avoid that, since rescue/else/ensure are allowed inside do/end blocks in Ruby 2.5 (https://bugs.ruby-lang.org/issues/12906), so we'd probably meets with that situation than before.
* | Module#{define_method,alias_method,undef_method,remove_method} become public ↵Ryuta Kamizono2018-12-211-1/+1
| | | | | | | | | | | | since Ruby 2.5 https://bugs.ruby-lang.org/issues/14133
* | Clarify implicit meaning of 'workers: 2' in parallelization tests.Kasper Timm Hansen2018-12-191-6/+8
| |
* | Add option to set parallel test worker count to the physical core count of ↵Bogdan2018-12-181-5/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | the machine (#34735) * Add option to set parallel test worker count to the physical core count of the machine Also, use the physical core count of the machine as the default number of workers, and generate the `test_helper.rb` file with `parallelize(workers: :number_of_processors)` Closes #34734 * Ensure that we always test parallel testing Since #34734 we decided to use the physical core count of the machine as the default number of workers in the parallel testing, we need to ensure that some tests use at least 2 workers because we could run those tests on VM that has only 1 physical core. It also fixes tests failures on the CI since Travis server we are using has only one physical core. See https://travis-ci.org/rails/rails/jobs/469281088#L2352
* | Introduce a guard against DNS rebinding attacksGenadi Samokovarov2018-12-151-6/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The ActionDispatch::HostAuthorization is a new middleware that prevent against DNS rebinding and other Host header attacks. By default it is included only in the development environment with the following configuration: Rails.application.config.hosts = [ IPAddr.new("0.0.0.0/0"), # All IPv4 addresses. IPAddr.new("::/0"), # All IPv6 addresses. "localhost" # The localhost reserved domain. ] In other environments, `Rails.application.config.hosts` is empty and no Host header checks will be done. If you want to guard against header attacks on production, you have to manually permit the allowed hosts with: Rails.application.config.hosts << "product.com" The host of a request is checked against the hosts entries with the case operator (#===), which lets hosts support entries of type RegExp, Proc and IPAddr to name a few. Here is an example with a regexp. # Allow requests from subdomains like `www.product.com` and # `beta1.product.com`. Rails.application.config.hosts << /.*\.product\.com/ A special case is supported that allows you to permit all sub-domains: # Allow requests from subdomains like `www.product.com` and # `beta1.product.com`. Rails.application.config.hosts << ".product.com"
* | Improve deprecation message for enqueue returning falseRafael Mendonça França2018-12-051-0/+27
| | | | | | | | | | | | And make sure new applications in Rails 6.0 has this config enabled. Also, improve test coverage and add a CHANGELOG entry.
* | Merge pull request #33882 from ↵Rafael França2018-11-301-26/+54
|\ \ | | | | | | | | | | | | mberlanda/mberlanda/as-inheritable-options-intialization [Realties] config_for as ActiveSupport::OrderedOptions
| * | chore: implement config_for as ActiveSupport::OrderedOptionsMauro Berlanda2018-10-191-26/+54
| | |
* | | Compile packs before run testyuuji.yaginuma2018-11-221-1/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Sometimes `test_scaffold_tests_pass_by_default` test fails in CI. https://travis-ci.org/rails/rails/jobs/457621750#L2095-L2120 It seems `manifest.json` was broken. `webpacker` will compile automatically if packs is not compiled. If parallel test is enabled, it seems that this compilation process is executed simultaneously in multiple processes, and it may become an inconsistent state. In order to avoid this, compile before running the test.
* | | Correctly handle unknown object in parallel testsyuuji.yaginuma2018-11-171-0/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | DRb wraps in `DRbUnknown` if the data contains a type that can not be resolved locally. This can happen if an error occurs in the test and the error class can not be resolved on the server side. When this happens, an instance of `DRbUnknown` is passed to the `result` of `Server#record`. This causes another error(undefined method assertions for #<DRb::DRbUnknown:> (NoMethodError)) in `reporter.record`. This can confirm by the following steps. ``` $ rails new app -B --dev; cd app $ rails g scaffold user name:string $ edit `config.action_controller.allow_forgery_protection = true` in environments/test.rb $ bin/rails t ``` In the case of `DRbUnknown` occurs, can't resolve error exception. So wrap exception with `DRbRemoteError` in the same way as an unmarshalled object.
* | | Merge pull request #34400 from gmcgibbon/rm_autoload_app_javascriptsRafael França2018-11-131-0/+8
|\ \ \ | | | | | | | | Remove asset paths from autoload_paths
| * | | Remove asset paths from eager_load_paths and autoload_pathsGannon McGibbon2018-11-091-0/+8
| | | | | | | | | | | | | | | | | | | | Remove `app/assets` and `app/javascript` from `eager_load_paths` and `autoload_paths`.
* | | | Merge pull request #34411 from N0xFF/masterRafael França2018-11-131-0/+25
|\ \ \ \ | | | | | | | | | | Reset Capybara sessions if failed system test screenshot raising an exception
| * | | | Reset sessions on failed system test screenshotMaxim Perepelitsa2018-11-131-0/+25
| | | | | | | | | | | | | | | | | | | | | | | | | Reset Capybara sessions if `take_failed_screenshot` raise exception in system test `after_teardown`.
* | | | | Ignore warnings such as `Psych.safe_load is deprecated`Yasuo Honda2018-11-131-0/+2
| |/ / / |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Addressing warnings are important but it should be out of this test scope. https://travis-ci.org/rails/rails/jobs/454145524#L4122-L4131 ``` .F Failure: ApplicationTests::BinSetupTest#test_bin_setup_output [test/application/bin_setup_test.rb:49]: --- expected +++ actual @@ -1,4 +1,5 @@ "== Installing dependencies == +warning: Passing permitted_classes with the 2nd argument of Psych.safe_load is deprecated. Use keyword argument like Psych.safe_load(yaml, permitted_classes: ...) instead. The Gemfile's dependencies are satisfied == Preparing database == rails test test/application/bin_setup_test.rb:38 ```
* | | | Add test for parallel tests with unmarshable exceptionyuuji.yaginuma2018-11-091-0/+24
|/ / / | | | | | | | | | Follow up #34131.