aboutsummaryrefslogtreecommitdiffstats
path: root/railties/test/application
Commit message (Collapse)AuthorAgeFilesLines
...
| * | 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
| | |
| * | ActiveSupport::CurrentAttributes provides a thread-isolated attributes ↵David Heinemeier Hansson2017-05-261-0/+88
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | singleton (#29180) * Add ActiveSupport::CurrentAttributes to provide a thread-isolated attributes singleton * Need to require first * Move stubs into test namespace. Thus they won't conflict with other Current and Person stubs. * End of the line for you, whitespace! * Support super in attribute methods. Define instance level accessors in an included module such that `super` in an overriden accessor works, akin to Active Model. * Spare users the manual require. Follow the example of concerns, autoload in the top level Active Support file. * Add bidelegation support * Rename #expose to #set. Simpler, clearer * Automatically reset every instance. Skips the need for users to actively embed something that resets their CurrentAttributes instances. * Fix test name; add tangible name value when blank. * Try to ensure we run after a request as well. * Delegate all missing methods to the instance This allows regular `delegate` to serve, so we don't need bidelegate. * Properly test resetting after execution cycle. Also remove the stale puts debugging. * Update documentation to match new autoreset
| * | Define path with __dir__bogdanvlviv2017-05-231-1/+1
| |/ | | | | | | | | | | ".. with __dir__ we can restore order in the Universe." - by @fxn Related to 5b8738c2df003a96f0e490c43559747618d10f5f
| * Use recyclable cache keys (#29092)David Heinemeier Hansson2017-05-181-0/+4
| |
| * Allow irb options to be passed from `rails console` commandyuuji.yaginuma2017-05-081-4/+12
| | | | | | | | Fixes #28988
| * Also raise error when VERSION is nilRafael Mendonça França2017-04-271-0/+6
| | | | | | | | Fix #28905
| * Merge pull request #28896 from pschambacher/load_with_sharedRafael França2017-04-261-0/+34
| |\ | | | | | | Added a shared section to config/database.yml that will be loaded for all envs
| | * Added a shared section to config/database.yml that will be loaded for all ↵Pierre Schambacher2017-04-261-0/+34
| | | | | | | | | | | | environments
* | | Set proper assertion to be sure the test failedbogdanvlviv2017-05-021-1/+1
| | |
* | | New minitest 'assert false' messagePavel Valena2017-04-261-1/+1
|/ /
* | Merge pull request #28897 from rafaelfranca/fix-name-error-error-pageAaron Patterson2017-04-261-0/+14
|\ \ | | | | | | Do not try to encoding the parameters when the controller is not defined
| * | Do not try to encoding the parameters when the controller is not definedRafael Mendonça França2017-04-261-0/+14
| |/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When you have a route that points to an nonexistent controller we raise an exception. This exception was being caught by the DebugExceptions middleware in development, but when trying to render the error page, we are reading the request format[[1][]]. To determine the request format we are reading the format parameters[[2][]], and to be able to read the parameters we need to encode them[[3][]]. This was raising another exception that to encode the parameter we try to load the controller to determine if we need to encode the parameters are binary[[4][]]. This new exception inside the DebugExceptions middleware makes Rails to render a generic error page. To avoid this new exception now we only encode the parameters when the controller can be loaded. Fixes #28892 [1]: https://github.com/rails/rails/blob/f52cdaac6336f99d13622ff9bda556a3124a4121/actionpack/lib/action_dispatch/middleware/debug_exceptions.rb#L80 [2]: https://github.com/rails/rails/blob/f52cdaac6336f99d13622ff9bda556a3124a4121/actionpack/lib/action_dispatch/http/mime_negotiation.rb#L63 [3]: https://github.com/rails/rails/blob/f52cdaac6336f99d13622ff9bda556a3124a4121/actionpack/lib/action_dispatch/http/parameters.rb#L58 [4]: https://github.com/rails/rails/blob/f52cdaac6336f99d13622ff9bda556a3124a4121/actionpack/lib/action_dispatch/http/parameters.rb#L88
* | Merge pull request #28244 from ixti/improve/action-mailer-preview-paramsRafael França2017-04-261-0/+51
|\ \ | |/ |/| Pass request params to ActionMailer::Preview
| * Pass request params to ActionMailer::PreviewAlexey Zapparov2017-03-011-0/+51
| |
* | Set to `form_with_generates_remote_forms` only when config is explicitly ↵yuuji.yaginuma2017-04-221-0/+28
| | | | | | | | | | | | | | | | | | specified Without this check, even if config is not specified, `ActionView::Helpers::FormHelper.form_with_generates_remote_forms` always be set to nil and remote form not be generated. Follow up to 128b804c6ce40fcbde744f294f8cb98654f6efec
* | Configure form_with_generates_remote_forms in its own initializerRafael Mendonça França2017-04-211-0/+32
| | | | | | | | | | | | | | | | | | This configuration is not present in ActionView::Base so we can't let the action_view.set_configs initializer set it. Also add tests to make sure this config works. Fixes #28824
* | Add additional raise UnknownMigrationVersionErrorbogdanvlviv2017-04-191-1/+31
| | | | | | | | | | Raise error on the movement of migrations when the current migration does not exist.
* | Fix `bin/rails db:forward` first migrationbogdanvlviv2017-04-191-0/+25
| |
* | Remove duplicated "test" prefixRyuta Kamizono2017-04-072-4/+4
| |
* | Merge pull request #28057 from eugeneius/clear_active_connectionsMatthew Draper2017-04-041-0/+8
|\ \ | | | | | | Clear active connections after initialization
| * | Clear active connections after initializationEugene Kenny2017-02-171-0/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Any connections that were checked out during initialization should be checked back in before the first request is processed, for two reasons: - Returning the connection to the pool allows it to be health checked before it's used again. If the connection dies before the first request arrives, the health check will replace it with a new one. - If the thread that initialized Rails is not the same thread that will be performing work, checking in the connection will allow it to be reused instead of being stuck to the initialization thread forever.