aboutsummaryrefslogtreecommitdiffstats
path: root/railties/test
Commit message (Collapse)AuthorAgeFilesLines
* Merge branch 'master' into active-storage-importDavid Heinemeier Hansson2017-08-023-3/+3
|\
| * Merge remote-tracking branch 'origin/master' into unlock-minitestRafael Mendonça França2017-08-0122-141/+368
| |\
| * | Fix test runner's outputyuuji.yaginuma2017-07-302-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | 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-1514-22/+397
| |\ \
| * \ \ Merge branch 'master' into unlock-minitestRafael Mendonça França2017-06-022-2/+2
| |\ \ \
| * \ \ \ Merge branch 'master' into unlock-minitestKasper Timm Hansen2017-05-2930-117/+341
| |\ \ \ \
| * | | | | Set proper assertion to be sure the test failedbogdanvlviv2017-05-021-1/+1
| | | | | |
| * | | | | New minitest 'assert false' messagePavel Valena2017-04-261-1/+1
| | | | | |
* | | | | | Merge branch 'master' into active-storage-importDavid Heinemeier Hansson2017-08-012-1/+2
|\ \ \ \ \ \ | | |_|_|_|/ | |/| | | |
| * | | | | Merge pull request #30015 from larskanis/use-duktake-on-mingwGuillermo Iguaran2017-08-011-0/+2
| |\ \ \ \ \ | | | | | | | | | | | | | | Use duktape gem as default JS engine on Windows-MINGW
| | * | | | | Use duktape gem as default JS engine on Windows-MINGW and MS-Visual-C buildsLars Kanis2017-08-011-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The fallback javascript engine on Windows is Windows Script Host (JScript). However this engine isn't able to process the default assets, because it supports ES3 only but the coffeescript compiler requires ES5. Fixes #30014
| * | | | | | Remove unnecessary `doc` directory deletionyuuji.yaginuma2017-08-011-1/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Since 553b695, `doc` directory is not created in application.
* | | | | | | Use config/storage.yml as part of the skeleton and loadingDavid Heinemeier Hansson2017-07-311-1/+1
| | | | | | |
* | | | | | | Include default storage configurationDavid Heinemeier Hansson2017-07-311-0/+1
|/ / / / / /
* / / / / / Set Ruby version in Gemfile and .ruby-version by defaultAlberto Almagro2017-07-311-0/+12
|/ / / / /
* | | | | 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-254-65/+36
|\ \ \ \ \ \ | |/ / / / / |/| | | | | | | | | | | | | | | | | 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-254-65/+36
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* | | | | | Merge pull request #29916 from lugray/stop_generating_application_recordEileen M. Uchitelle2017-07-255-34/+26
|\ \ \ \ \ \ | |/ / / / / |/| | | | | Stop creating ApplicationRecord on model generation
| * | | | | Stop creating ApplicationRecord on model generationLisa Ugray2017-07-245-34/+26
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When generating models, we created ApplicationRecord in the default location if no file existed there. That was annoying for people who moved it to somewhere else in the autoload path. At this point, the vast majority of apps should have either run the upgrade script or generated a model since upgrading. For those that haven't the error message after generating a new model should be helpful: NameError: uninitialized constant ApplicationRecord To ease friction in that case, this also adds a generator for ApplicationRecord.
* | | | | | 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 ```
* | | | | | Fix regression from multiple mountpoint supportDavid Rodríguez2017-07-242-0/+38
|/ / / / /
* | | | | 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.
* | | | | Fix false positive test related to wrong app root path.Wojciech Wnętrzak2017-07-211-11/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Without setting root config, `config.paths["config/secrets"]` located in https://github.com/rails/rails/blob/84eb498f84ebc5d1be0b0db6f7bca9da3d679ca6/railties/lib/rails/application.rb#L390 always returned empty list.
* | | | | 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`.
* | | | | Merge pull request #29782 from y-yagi/follow_up_29699Kasper Timm Hansen2017-07-161-12/+35
|\ \ \ \ \ | | | | | | | | | | | | Set `represent_boolean_as_integer` via `configuration`
| * | | | | 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
| | | | | |
* | | | | | Properly expand the environment's nameRobin Dupret2017-07-162-0/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Running the `console` and `dbconsole` commands with a regular argument as the environment's name automatically expand it to match an existing environment (e.g. dev for development). This feature wasn't available using the `--environment` (a.k.a `-e`) option.
* | | | | | Deprecate environment as an argument for dbconsole and consoleRobin Dupret2017-07-162-12/+24
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | People should rather rely on the `-e` or `--environment` options to specify in which environment they want to work. This will allow us to specify the connection to pick as a regular argument in the future.
* | | | | | Allow to pass a connection to the `dbconsole` commandRobin Dupret2017-07-161-0/+43
|/ / / / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Since 0a4f6009, it's possible to specify a 3-level database configuration to gather connections by environment. The `dbconsole` command will try to look for a database configuration which points to the current environment but with such flavour, the environment key is flushed out so let's add the ability to specify the connection and pick `primary` by default to be consistent with Active Record.
* | | | | Do not generate unused components contents in `app:update` taskyuuji.yaginuma2017-07-161-0/+16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Currently, `app:update` generates all contents regardless of the component using in application. For example, even if not using Action Cable, `app:update` will generate a contents related to Action Cable. This is a little inconvenient. This PR checks the existence of the component and does not generate unnecessary contents. Can not check all options in this way. However, it will be able to prevent the generation of unnecessary files.
* | | | | 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-102-5/+8
|/ / / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* | | | Merge pull request #29721 from y-yagi/fix_29696Kasper Timm Hansen2017-07-091-0/+34
|\ \ \ \ | | | | | | | | | | Treat secrets as binary
| * | | | Treat secrets as binaryyuuji.yaginuma2017-07-091-0/+34
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Until Rails 5.1.1 secrets was treated as binary inside Rails. https://github.com/rails/rails/blob/v5.1.1/railties/lib/rails/secrets.rb#L59 https://github.com/rails/rails/blob/v5.1.1/railties/lib/rails/secrets.rb#L63 However, it is treated as String in Rails 5.1.2(changed by 157db872103429e8782b62d1cb5d1d91337177a7). https://github.com/rails/rails/blob/v5.1.2/railties/lib/rails/secrets.rb#L104 https://github.com/rails/rails/blob/v5.1.2/railties/lib/rails/secrets.rb#L108 As a result, when upgrading from Rails 5.1.1 to 5.1.2, to write the value treated as binary using `File.write`, causing an error. In order to avoid `UndefinedConversionError`, fixed it to treat it as binary like 5.1.1. Fixes #29696
* | | | | 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 #29695 from y-yagi/secrets_showMatthew Draper2017-07-092-1/+14
|\ \ \ \ | | | | | | | | | | Add `rails secrets:show` command
| * | | | Add `rails secrets:show` commandyuuji.yaginuma2017-07-072-1/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When secrets confirmed with the `secrets:edit` command, `secrets.yml.enc` will change without updating the secrets. Therefore, even if only want to check secrets, the difference will come out. This is a little inconvenient. In order to solve this problem, added the `secrets:show` command. If just want to check secrets, no difference will occur use this command.
* | | | | Merge pull request #29705 from y-yagi/do_not_update_secrets_yml_encMatthew Draper2017-07-091-0/+18
|\ \ \ \ \ | | | | | | | | | | | | Do not update `secrets.yml.enc` when secretes do not change
| * | | | | Do not update `secrets.yml.enc` when secretes do not changeyuuji.yaginuma2017-07-071-0/+18
| |/ / / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Currently, if open a file with `secrets:edit` command, `secrets.yml.enc` will be changed even if its contents do not change. Therefore, even if only want to check secrets, the difference will come out. This is a little inconvenient. As a fix to the above problem, when content does not change, `secrets.yml.ecn` is fixed so that it is not changed.
* / / / / Update default app files in app_generator_testKoichi ITO2017-07-061-2/+40
|/ / / /
* | | | Allow mounting same engine under several locationsDavid Rodríguez2017-07-051-0/+86
| | | |