aboutsummaryrefslogtreecommitdiffstats
path: root/railties/test
Commit message (Collapse)AuthorAgeFilesLines
* add field ids when generating a scaffold form.Yves Senn2017-03-261-4/+4
| | | | | | This is a follow up to a6d065e. When using `form_with` you must supply field ids manually. Since the scaffold generator is using labels we need to make sure that they are linked up properly.
* Merge pull request #28527 from rst/fix_runner_argv_28515Rafael França2017-03-221-0/+8
|\ | | | | Correctly reset ARGV for "rails runner `CODE' arg arg arg..."
| * Fixup trailing whitespace, per complaints from CodeClimate.Robert Thau2017-03-221-1/+1
| |
| * Correctly reset ARGV for "rails runner `CODE' arg arg arg..."Robert Thau2017-03-221-0/+8
| | | | | | | | | | | | The code itself should not be in the ARGV vector. Fixes #28515
* | Merge pull request #28513 from maclover7/jm-fix-28500Rafael França2017-03-221-0/+8
|\ \ | | | | | | CLI arg "host" has precedence over ENV var "host"
| * | CLI arg "host" has precedence over ENV var "host"Jon Moss2017-03-211-0/+8
| |/ | | | | | | | | | | | | This is a regression from when the server command switched to its own argument parser, as opposed to Rack's. Rack's argument parser, when provided with a "host" argument, gives that value precedence over environment variables.
* / Don't comment out config.file_watcher during Rails upgradeyuuji.yaginuma2017-03-221-14/+0
|/ | | | | | | This is necessary only when updating to Rails 5.0, it is not necessary for updating to 5.1. Related #24243
* Default to yielding a `form` variable.Kasper Timm Hansen2017-03-201-4/+4
| | | | More intention revealing and means `f` can go F itself 😋
* Add `app:update` task to enginesyuuji.yaginuma2017-03-201-0/+16
| | | | | | Occasionally we update the file generated by engine. Therefore, I think that there is a task for updating as well as application in the engine, it is convenient for updating.
* Merge pull request #28481 from y-yagi/fix_warningKasper Timm Hansen2017-03-201-3/+3
|\ | | | | Fix `warning: character class has duplicated range`
| * Fix `warning: character class has duplicated range`yuuji.yaginuma2017-03-201-3/+3
| | | | | | | | | | | | | | | | | | | | This fixes the following warnings: ``` railties/test/generators/encrypted_secrets_generator_test.rb:15: warning: character class has duplicated range: /[\w\d]+/ railties/test/generators/encrypted_secrets_generator_test.rb:18: warning: character class has duplicated range: /production:\n# external_api_key: [\w\d]+/ railties/test/generators/encrypted_secrets_generator_test.rb:19: warning: character class has duplicated range: /production:\n# external_api_key: [\w\d]+/ ```
* | Correctly check whether key is defined in configurationyuuji.yaginuma2017-03-192-1/+13
|/ | | | | | | | | | | | | It can not check correctly with `defined?` ```ruby irb(main):001:0> Rails.application.config.active_record => {:maintain_test_schema=>true, :belongs_to_required_by_default=>true} irb(main):002:0> defined?(Rails.application.config.active_record) => nil ``` Follow up to #28469
* Track the version-compatible config settings inside railtiesMatthew Draper2017-03-182-22/+8
| | | | | | | | | | | | | | | | Instead of forcing new applications to carry an initializer that just switches things to what their default "should" be, we can handle it internally. The initializer is then only used by upgraders: it shows what the new default would be (commented out), while their upgraded application continues to operate as it did before. Under this model, a multiply-upgraded application could accumulate several new_framework_defaults_*.rb files, for each release series it has traversed. A given release series only needs to generate the latest, though, because we don't support `rails app:upgrade` while skipping releases.
* Merge pull request #28368 from y-yagi/add_test_for_secrets_commandKasper Timm Hansen2017-03-151-0/+13
|\ | | | | Add secrets edit test
| * Add secrets edit testyuuji.yaginuma2017-03-121-0/+13
| |
* | Merge pull request #28409 from y-yagi/make_destroy_command_work_within_enginesEileen M. Uchitelle2017-03-151-0/+55
|\ \ | | | | | | Make destroy command work within engines
| * | Make destroy command work within enginesyuuji.yaginuma2017-03-141-0/+55
| |/ | | | | | | | | Instead of calling methods of Rails.application directly, we need to use a method that is considered for the rails engine.
* / Rename test of `app:update` to more appropriate nameyuuji.yaginuma2017-03-151-7/+7
|/ | | | | `rails:update` was changed to `app:update` in 6fb31638c8b61731103d4963272755b217a2df87. Therefore, I think that it is better that the test name is also `app_update`.
* Merge pull request #28182 from y-yagi/show_correct_rails_commandsKasper Timm Hansen2017-03-091-0/+11
|\ | | | | Show correct commands in help
| * Show correct commands in helpyuuji.yaginuma2017-03-031-0/+11
| | | | | | | | | | Currently rails' help shows only namespace. However, the secrets command needs to specify command. Therefore, I fixed the command to display in help.
* | Use appropriate type in generators testyuuji.yaginuma2017-03-081-1/+1
| | | | | | | | | | | | | | | | This fixes the following thor's warning. ``` Expected string default value for '--generate'; got false (boolean) ```
* | Avoid running system tests by defaultRobin Dupret2017-03-051-0/+46
| | | | | | | | | | | | | | | | | | | | These tests may be expansive so let's only allow users to run them through `bin/rails test:system` or by passing a path to the `test` command. The same applies for `bin/rake test`. Refs #28109.
* | Fix random failure on system test with ajaxFumiaki MATSUSHIMA2017-03-031-0/+28
| | | | | | | | | | | | | | | | If application has ajax, browser may begin request after rollback. `teardown_fixtures` will be called after `super` on `after_teardown` so we must call `Capybara.reset_sessions!` before `super` https://github.com/rails/rails/blob/b61a56541aecd7ac685d4f19d943177a3f1b465a/activerecord/lib/active_record/fixtures.rb#L857
* | Move key packing into encryptor.Kasper Timm Hansen2017-03-021-3/+2
| |
* | Merge pull request #28139 from stouset/update-secrets-to-use-modern-cryptoKasper Timm Hansen2017-03-021-2/+3
|\ \ | | | | | | Update secrets to use modern crypto
| * | Default Secrets to AES-128-GCM, using ActiveSupport::MessageEncryptorStephen Touset2017-03-011-2/+3
| | | | | | | | | | | | Fixes #28135.
* | | Tell users how to assign a $EDITOR.Kasper Timm Hansen2017-03-011-0/+24
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In case there's no $EDITOR assigned users would see a cryptic: ``` % EDITOR= bin/rails secrets:edit Waiting for secrets file to be saved. Abort with Ctrl-C. sh: /var/folders/wd/xnncwqp96rj0v1y2nms64mq80000gn/T/secrets.yml.enc: Permission denied New secrets encrypted and saved. ``` That error is misleading, so give a hint in this easily detectable case. Fixes #28143.
* | | Set correct host except development environmentyuuji.yaginuma2017-02-271-0/+18
| |/ |/| | | | | | | | | | | | | Currently `localhost` is used for the default host in all environments. But up to Rails 5.0, `0.0.0.0` is used except for development. So fixed to use the same value as 5.0. Fixes #28184
* | Merge pull request #28137 from schneems/schneems/fix-default-puma-portRichard Schneeman2017-02-241-0/+8
|\ \ | | | | | | [close #24435] Send user_supplied_options to server
| * | [close #24435] Send user_supplied_options to serverschneems2017-02-241-0/+8
| |/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Currently when Puma gets a `:Port` it doesn't know if it is Rails' default port or if it is one that is specified by a user. Because of this it assumes that the port passed in is always a user defined port and therefor 3000 always "wins" even if you specify `port` inside of the `config/puma.rb` file when booting your server with `rails s`. The fix is to record the options that are explicitly passed in from the user and pass those to the Puma server (or all servers really). Puma then has enough information to know when `:Port` is the default and when it is user defined. I went ahead and did this for all values rails server exposes as server side options for completeness. The hardest thing was converting the input say `-p` or `--port` into the appropriate "name", in this case `Port`. There may be a more straightforward way to do this with Thor, but I'm not an expert here. Move logic for parsing user options to method Better variable name for iteration Explicitly test `--port` user input ✂️ Update array if environment variables are used
* | Merge pull request #28150 from ↵Rafael França2017-02-241-0/+7
|\ \ | | | | | | | | | | | | y-yagi/do_not_display_hidden_namespaces_in_generators_help does not show hidden namespaces in generator's help
| * | does not show hidden namespaces in generator's helpyuuji.yaginuma2017-02-241-0/+7
| | |
* | | Merge pull request #28062 from ↵Rafael França2017-02-241-0/+15
|\ \ \ | |/ / |/| | | | | | | | y-yagi/make_adding_gemfile_entry_work_even_if_specify_only_the_plugin_name Make adding gemfile entry work even if specify only the plugin name
| * | Make adding gemfile entry work even if specify only the plugin nameyuuji.yaginuma2017-02-241-0/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Whether the command was executed within the rails application is checked by whether or not the application's path matches `app_path`. https://github.com/rails/rails/blob/5-0-stable/railties/lib/rails/generators/rails/plugin/plugin_generator.rb#L439..L441 Therefore, if only plugin name is specified in `app_path`, addition to Gemfile is not done. However, in the rails guide an example of specifying only plugin name is given, and it is considered that there are many cases where only plugin name is specified. For that reason, made it work even if only plugin name was specified.
* | | Make help short-cut alias to workyuuji.yaginuma2017-02-241-0/+23
| | |
* | | Make version short-cut alias to workyuuji.yaginuma2017-02-241-0/+24
| |/ |/|
* | Add back tests for test:units and test:functionals.Kasper Timm Hansen2017-02-231-12/+16
| | | | | | | | | | | | | | Would have caught that the invoke changes broke rake delegation behavior. And we do ship the behavior so we should test it.
* | Revert "Revert "Add encrypted secrets""Kasper Timm Hansen2017-02-234-0/+152
| |
* | Revert "Add encrypted secrets" (#28127)David Heinemeier Hansson2017-02-234-152/+0
| |
* | Add encrypted secrets (#28038)Kasper Timm Hansen2017-02-234-0/+152
| |
* | Merge pull request #27572 from matthewd/prerelease-specifierMatthew Draper2017-02-231-4/+4
|\ \ | | | | | | Simplify the version specifier generated by prereleases
| * | Simplify the version specifier generated by prereleasesMatthew Draper2017-01-051-4/+4
| | | | | | | | | | | | | | | "~> 1.2.3.pre4" will automatically allow "1.2.4" -- no need for an explicit range.
* | | Merge pull request #23138 from rails/custom-url-helpers-and-polymorphic-urlsAndrew White2017-02-211-2/+185
|\ \ \ | | | | | | | | Implement custom url helpers and polymorphic mapping
| * | | Split direct method into twoAndrew White2017-02-211-4/+4
| | | | | | | | | | | | | | | | | | | | Use a separate method called `resolve` for the custom polymorphic mapping to clarify the API.
| * | | Prefer remove_method over undef_methodAndrew White2017-02-211-0/+58
| | | | | | | | | | | | | | | | | | | | | | | | Using `undef_method` means that when a route is removed any other implementations of that method in the ancestor chain are inaccessible so instead use `remove_method` which restores access to the ancestor.
| * | | Add custom polymorphic mappingAndrew White2017-02-211-4/+98
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Allow the use of `direct` to specify custom mappings for polymorphic_url, e.g: resource :basket direct(class: "Basket") { [:basket] } This will then generate the following: >> link_to "Basket", @basket => <a href="/basket">Basket</a> More importantly it will generate the correct url when used with `form_for`. Fixes #1769.
| * | | Rename url_helper to directAndrew White2017-02-211-4/+4
| | | |
| * | | Add support for defining custom url helpers in routes.rbAndrew White2017-02-211-2/+33
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Allow the definition of custom url helpers that will be available automatically wherever standard url helpers are available. The current solution is to create helper methods in ApplicationHelper or some other helper module and this isn't a great solution since the url helper module can be called directly or included in another class which doesn't include the normal helper modules. Reference #22512.
* | | | Revert back to the original of using package.json in the root of the project ↵David Heinemeier Hansson2017-02-212-6/+6
|/ / / | | | | | | | | | (#28093)
* | | Fix run_via[]= backwards compatibility.Kasper Timm Hansen2017-02-211-0/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | ``` Minitest.run_via[:rails] = true ``` 👆 would break because a simple alias won't catch the second true argument there.