aboutsummaryrefslogtreecommitdiffstats
path: root/railties/test/application
Commit message (Collapse)AuthorAgeFilesLines
...
* Adding frozen_string_literal pragma to Railties.Pat Allan2017-08-1448-0/+96
|
* Railties updates for frozen string literals.Pat Allan2017-08-141-1/+2
|
* Merge pull request #29559 from kirs/eager-load-controller-actionsRafael França2017-08-111-0/+60
|\ | | | | Eager load controller actions to reduce response time of the first request
| * Eager load controller and mailer actionsKir Shatrov2017-07-291-0/+60
| | | | | | | | | | | | | | | | | | | | | | On the first request, ActionController::Base#action_methods computes and memoized the list of available actions [1]. With this PR we move this expensive operation into eager load step to reduce response time of the first request served in production. This also reduces the memory footprint when running on forking server like Unicorn. [1] https://github.com/rails/rails/blob/a3813dce9a0c950a4af7909111fa730a2622b1db/actionpack/lib/abstract_controller/base.rb#L66-L77
* | Deprecate support of older `config.ru`yuuji.yaginuma2017-08-081-0/+31
| | | | | | | | | | | | | | | | Since Rails 4.0, `config.ru` generated by default uses instances of `Rails.application`. Therefore, I think that it is good to deprecate the old behavior. Related: #9669
* | Check for `app.secrets.secret_key_base`, not `app.config.secret_key_base`George Claghorn2017-08-051-3/+1
| | | | | | | | By default, apps only have the former set.
* | Convert to strings so array can be sorted deterministicallyDavid Heinemeier Hansson2017-08-041-3/+3
| |
* | Deterministic comparisons pleaseDavid Heinemeier Hansson2017-08-031-3/+3
| |
* | Do not eager load ActiveRecord::BaseRafael Mendonça França2017-08-032-10/+6
| | | | | | | | Everything inside the app directory of a engine is autoload/eager loaded automatically so we don't need to require them.
* | Active Storage routes are now part of the default routesDavid Heinemeier Hansson2017-08-031-9/+37
| | | | | | | | It's worth considering whether we should hide these by default, but I'm kinda thinking no. It's very reasonable that someone would want to call these directly, so they should be documented.
* | Same issue from AR getting loaded earlierDavid Heinemeier Hansson2017-08-031-3/+3
| | | | | | | | cc @rafaelfranca
* | Including new default classes in loading testDavid Heinemeier Hansson2017-08-031-3/+3
| |
* | Active Storage loads AR earlier to extend it so require env laterDavid Heinemeier Hansson2017-08-031-3/+7
| |
* | Generating the app is where the exception is now raisedDavid Heinemeier Hansson2017-08-031-1/+1
| |
* | Merge remote-tracking branch 'origin/master' into unlock-minitestRafael Mendonça França2017-08-018-60/+154
|\ \
| * | Fix `warning: method redefined;`yuuji.yaginuma2017-07-281-3/+3
| |/ | | | | | | | | | | | | | | | | This fixes the following warning: ``` /tmp/d20170727-7039-kmdtb1/app/app/models/user.rb:5: warning: method redefined; discarding old model_name rails/activemodel/lib/active_model/naming.rb:222: warning: previous definition of model_name was here ```
| * Merge pull request #29926 from pawandubey:fix-test-with-absolute-pathsKasper Timm Hansen2017-07-251-0/+26
| |\
| | * Allow bin/rails test task to take absolute paths as argumentsPawan Dubey2017-07-251-0/+26
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Solves #29923 This regression was caused due to a wrong regex to filter out paths, introduced in commit 796a1cf0e The regex was /^\w+\// which did not accept paths with a leading slash and hence all absolute paths were filtered out. This change introduces a change in regex which allows for a leading slash and acts on the matched term accordingly. While cascading through the case block, the paths are checked for line number specification, existence of a directory at that path and if none of those match, then it is considered to be a path to the file. The regex matchers specified are filtered out via the call to `Array#compact` since they do not match any of these conditions.
| * | Merge pull request #29931 from ↵Sean Griffin2017-07-252-44/+10
| |\ \ | | |/ | |/| | | | | | | y-yagi/extract_assert_output_and_available_pty_to_module Extract `assert_output` and `available_pty?` into `ConsoleHelpers` module
| | * Extract `assert_output` and `available_pty?` into `ConsoleHelpers` moduleyuuji.yaginuma2017-07-252-44/+10
| | | | | | | | | | | | | | | We define almost the same method with multiple tests. Therefore, it extract into module.
| * | Fix `dbconsole` test when tempdir is a long pathSean Griffin2017-07-251-1/+1
| |/ | | | | | | | | | | | | | | The output of `.databases` in SQLite will truncate to a certain size. This causes the test to fail when run locally from a mac, or anything which has a tempdir with more than a few characters. This pragma has the same output, but presented as a normal query, meaning no truncation will occur.
| * Fix `warning: ambiguous first argument`yuuji.yaginuma2017-07-251-1/+1
| | | | | | | | | | | | | | | | This fixes the following warning: ``` railties/test/application/rake/dbs_test.rb:265: warning: ambiguous first argument; put parentheses or a space even after `/' operator ```
| * Avoid modifying frozen string in check_schema_fileEugene Kenny2017-07-231-0/+7
| | | | | | | | | | | | This was missed when the frozen string literal pragma was added to this file because the string is only modified when running in the context of a full Rails app, which wasn't covered by the test suite.
| * support `-` as an argument to `rails runner`Cody Cutrer2017-07-171-0/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | in Rails 4.0, you could use `/dev/stdin` on both Linux and Mac, but with the switch to Kernel.load in Rails 4.1, this broke on Linux (you get a LoadError). Instead, explicitly detect `-` as meaning stdin, then read from stdin explicitly, instead of performing file gymnastics. This should now work on any platform uniformly. Passing a script via stdin is useful when you're sshing to a server, and the script you want to run is stored locally. You could theoretically pass the entire script on the command line, but in reality you'll run into problems with the command being too long.
| * Rename helper to force_lazy_load_hooks.Kasper Timm Hansen2017-07-171-14/+14
| | | | | | | | | | | | Clarifies the intent that aren't just loading the model but really caring about triggering the on_load callbacks.
| * Set `RAILS_ENV` before load application fileyuuji.yaginuma2017-07-171-3/+32
| | | | | | | | | | | | | | Since #29725, load application file when `dbconsole` command is executed. However, if do not set `RAILS_ENV` before reading the application file, can not connect to the env specified in option, so added the setting of `RAILS_ENV`.
| * add helper method for explicit lazy loadyuuji.yaginuma2017-07-161-13/+18
| |
| * Set `represent_boolean_as_integer` via `configuration`yuuji.yaginuma2017-07-161-0/+18
| |
| * Change sqlite3 boolean serialization to use 1 and 0Lisa Ugray2017-07-111-0/+28
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Abstract boolean serialization has been using 't' and 'f', with MySQL overriding that to use 1 and 0. This has the advantage that SQLite natively recognizes 1 and 0 as true and false, but does not natively recognize 't' and 'f'. This change in serialization requires a migration of stored boolean data for SQLite databases, so it's implemented behind a configuration flag whose default false value is deprecated. The flag itself can be deprecated in a future version of Rails. While loaded models will give the correct result for boolean columns without migrating old data, where() clauses will interact incorrectly with old data. While working in this area, also change the abstract adapter to use `"TRUE"` and `"FALSE"` as quoted values and `true` and `false` for unquoted. These are supported by PostreSQL, and MySQL remains overriden.
| * Merge pull request #29742 from lugray/default_protect_from_forgeryRafael França2017-07-102-1/+8
| |\ | | | | | | Default protect from forgery
| | * Protect from forgery by defaultLisa Ugray2017-07-102-1/+8
| | | | | | | | | | | | | | | | | | | | | | | | Rather than protecting from forgery in the generated ApplicationController, add it to ActionController::Base by config. This configuration defaults to false to support older versions which have removed it from their ApplicationController, but is set to true for Rails 5.2.
| * | * Don't eagerly require Rails' minitest plugin.Kasper Timm Hansen2017-07-101-2/+2
| |/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | By making the Rails minitest behave like a standard minitest plugin we're much more likely to not break when people use other minitest plugins. Like minitest-focus and pride. To do this, we need to behave like minitest: require files up front and then perform the plugin behavior via the at_exit hook. This also saves us a fair bit of wrangling with test file loading. Finally, since the environment and warnings options have to be applied as early as possible, and since minitest loads plugins at_exit, they have to be moved to the test command. * Don't expect the root method. It's likely this worked because we eagerly loaded the Rails minitest plugin and that somehow defined a root method on `Rails`. * Assign a backtrace to failed exceptions. Otherwise Minitest pukes when attempting to filter the backtrace (which Rails' backtrace cleaner then removes). Means the exception message test has to be revised too. This is likely caused by the rails minitest plugin now being loaded for these tests and assigning a default backtrace cleaner.
* | Fix test runner's outputyuuji.yaginuma2017-07-301-1/+1
| | | | | | | | | | | | | | | | Output changed due to specification change of `SummaryReporter#aggregated_results` in minitest 5.10.2. In my opinion, that should fix rails's test runner(proceeding with #29354). However, we still need discussion and the fix itself is minor, so I think that we can fix only the test first.
* | Merge branch 'master' into unlock-minitestKasper Timm Hansen2017-07-155-11/+158
|\|
| * Load environment file in `dbconsole` commandyuuji.yaginuma2017-07-091-0/+66
| | | | | | | | | | | | | | | | | | Currently the environment file is not loaded in `dbconsole` command. Therefore, for example, if use encrypted secrets values in database.yml, `read_encrypted_secrets` will not be true, so the value can not be used correctly. Fixes #29717
| * Merge pull request #29677 from eugeneius/parameters_configuration_testsRafael Mendonça França2017-07-051-0/+36
| |\ | | | | | | | | | Fix Parameters configuration integration tests
| | * Fix Parameters configuration integration testsEugene Kenny2017-07-041-0/+41
| | | | | | | | | | | | | | | | | | | | | | | | | | | These tests relied on `ActionController::Parameters` being configured as part of the boot process; since that now happens lazily we need to force `ActionController::Base` to load so that we can test the behaviour. The new tests added here ensure that `ActionController::Parameters` can be configured from an initializer, which was broken until recently.
| * | Force ActionController::Base lazy laod hooks to runRafael Mendonça França2017-07-051-0/+12
| |/ | | | | | | | | | | | | Now that the parameters configurations are only loaded when ActionController::Base is we need to foce them to load in our tests. In an application this is not needed since every request already load the controllers.
| * Remove redundant `assert_respond_to`Ryuta Kamizono2017-07-031-3/+0
| | | | | | | | It is covered by following assertion.
| * Move test related to `tmp:clear` task to `tmp_test.rb`yuuji.yaginuma2017-07-022-7/+7
| |
| * Revert "Merge pull request #29540 from kirs/rubocop-frozen-string"Matthew Draper2017-07-0246-46/+0
| | | | | | | | | | This reverts commit 3420a14590c0e6915d8b6c242887f74adb4120f9, reversing changes made to afb66a5a598ce4ac74ad84b125a5abf046dcf5aa.
| * Merge pull request #29540 from kirs/rubocop-frozen-stringMatthew Draper2017-07-0246-0/+46
| |\ | | | | | | | | | Enforce frozen string in Rubocop
| | * Enforce frozen string in RubocopKir Shatrov2017-07-0145-0/+45
| | |
| * | Clear screenshots files in `tmp:clear` taskyuuji.yaginuma2017-06-271-0/+36
| |/ | | | | | | | | | | | | | | | | If system test fails, it creates screenshot under `tmp/screenshots`. https://github.com/rails/rails/blob/34fe2a4fc778d18b7fe6bdf3629c1481bee789b9/actionpack/lib/action_dispatch/system_testing/test_helpers/screenshot_helper.rb#L45 But currently, screenshot files is not cleared by `tmp:clear` task. This patch make clears screenshot files with `tmp:clear` task as well as other tmp files.
| * Make i18n test match the description of the testGuillermo Iguaran2017-06-091-1/+1
| |
* | Merge branch 'master' into unlock-minitestKasper Timm Hansen2017-05-297-14/+225
|\|
| * Merge pull request #28132 from mikeycgto/aead-encrypted-cookiesKasper Timm Hansen2017-05-281-9/+84
| |\ | | | | | | AEAD encrypted cookies and sessions
| | * AEAD encrypted cookies and sessionsMichael Coyne2017-05-221-9/+84
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This commit changes encrypted cookies from AES in CBC HMAC mode to Authenticated Encryption using AES-GCM. It also provides a cookie jar to transparently upgrade encrypted cookies to this new scheme. Some other notable changes include: - There is a new application configuration value: +use_authenticated_cookie_encryption+. When enabled, AEAD encrypted cookies will be used. - +cookies.signed+ does not raise a +TypeError+ now if the name of an encrypted cookie is used. Encrypted cookies using the same key as signed cookies would be verified and serialization would then fail due the message still be encrypted.
| * | Make reset execution assertions easier to read.Kasper Timm Hansen2017-05-281-15/+11
| | | | | | | | | | | | | | | The app is booted by then, so there's no need to stash the code away in some other script.
| * | Use models to match the docs.Kasper Timm Hansen2017-05-271-1/+1
| | |