aboutsummaryrefslogtreecommitdiffstats
path: root/railties/test/application/configuration_test.rb
Commit message (Collapse)AuthorAgeFilesLines
* Remove extra whitespaceDaniel Colson2018-01-251-5/+5
|
* Use assert_predicate and assert_not_predicateDaniel Colson2018-01-251-1/+1
|
* Change refute to assert_notDaniel Colson2018-01-251-1/+1
|
* Use respond_to test helpersDaniel Colson2018-01-251-1/+1
|
* Use SHA-1 for non-sensitive digests by defaultEugene Kenny2018-01-081-6/+14
| | | | | | Instead of providing a configuration option to set the hash function, switch to SHA-1 for new apps and allow upgrading apps to opt in later via `new_framework_defaults_5_2.rb`.
* Allow use_authenticated_message_encryption to be set in ↵Eugene Kenny2018-01-071-3/+27
| | | | | | | | | | new_framework_defaults_5_2.rb Enabling this option in new_framework_defaults_5_2.rb didn't work before, as railtie initializers run before application initializers. Using `respond_to?` to decide whether to set the option wasn't working either, as `ActiveSupport::OrderedOptions` responds to any message.
* Add test case that configure `config.active_support.hash_digest_class`yuuji.yaginuma2017-12-201-0/+18
| | | | Follow up of #31289.
* Raise an error only when `require_master_key` is specifiedyuuji.yaginuma2017-12-181-0/+8
| | | | | | | | | To prevent errors from being raise in environments where credentials is unnecessary. Context: https://github.com/rails/rails/issues/31283#issuecomment-348801489 Fixes #31283
* Log call site for all queriesOlivier Lacan2017-12-131-4/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This new ActiveRecord configuration option allows you to easily pinpoint what line of application code is triggering SQL queries in the development log by appending below each SQL statement log the line of Ruby code that triggered it. It’s useful with N+1 issues, and to locate stray queries. By default this new option ignores Rails and Ruby code in order to surface only callers from your application Ruby code or your gems. It is enabled on newly generated Rails 5.2 applications and can be enabled on existing Rails applications: ```ruby Rails.application.configure do # ... config.active_record.verbose_query_logs = true end ``` The `rails app:upgrade` task will also add it to `config/development.rb`. This feature purposely avoids coupling with ActiveSupport::BacktraceCleaner since ActiveRecord can be used without ActiveRecord. This decision can be reverted in the future to allow more configurable backtraces (the exclusion of gem callers for example).
* Change `form_with` to generates ids by defaultnpezza932017-11-251-0/+62
| | | | | | | | | | When `form_with` was introduced we disabled the automatic generation of ids that was enabled in `form_for`. This usually is not an good idea since labels don't work when the input doesn't have an id and it made harder to test with Capybara. You can still disable the automatic generation of ids setting `config.action_view.form_with_generates_ids` to `false.`
* Deprecate secret_token, long since usurped by secret_key_base.Kasper Timm Hansen2017-09-281-0/+26
| | | | | | | | | | See the changelog entry. Remove `secrets.secret_token` from the bug report templates, since we don't accept bug reports for Rails versions that don't support a `secret_key_base`. [ claudiob & Kasper Timm Hansen ]
* Add credentials using a generic EncryptedConfiguration class (#30067)David Heinemeier Hansson2017-09-111-50/+32
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * WIP: Add credentials using a generic EncryptedConfiguration class This is sketch code so far. * Flesh out EncryptedConfiguration and test it * Better name * Add command and generator for credentials * Use the Pathnames * Extract EncryptedFile from EncryptedConfiguration and add serializers * Test EncryptedFile * Extract serializer validation * Stress the point about losing comments * Allow encrypted configuration to be read without parsing for display * Use credentials by default and base them on the master key * Derive secret_key_base in test/dev, source it from credentials in other envs And document the usage. * Document the new credentials setup * Stop generating the secrets.yml file now that we have credentials * Document what we should have instead Still need to make it happen, tho. * [ci skip] Keep wording to `key base`; prefer defaults. Usually we say we change defaults, not "spec" out a release. Can't use backticks in our sdoc generated documentation either. * Abstract away OpenSSL; prefer MessageEncryptor. * Spare needless new when raising. * Encrypted file test shouldn't depend on subclass. * [ci skip] Some woordings. * Ditch serializer future coding. * I said flip it. Flip it good. * [ci skip] Move require_master_key to the real production.rb. * Add require_master_key to abort the boot process. In case the master key is required in a certain environment we should inspect that the key is there and abort if it isn't. * Print missing key message and exit immediately. Spares us a lengthy backtrace and prevents further execution. I've verified the behavior in a test app, but couldn't figure the test out as loading the app just exits immediately with: ``` /Users/kasperhansen/Documents/code/rails/activesupport/lib/active_support/testing/isolation.rb:23:in `load': marshal data too short (ArgumentError) from /Users/kasperhansen/Documents/code/rails/activesupport/lib/active_support/testing/isolation.rb:23:in `run' from /Users/kasperhansen/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/minitest-5.10.2/lib/minitest.rb:830:in `run_one_method' from /Users/kasperhansen/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/minitest-5.10.2/lib/minitest/parallel.rb:32:in `block (2 levels) in start' ``` It's likely we need to capture and prevent the exit somehow. Kernel.stub(:exit) didn't work. Leaving it for tomorrow. * Fix require_master_key config test. Loading the app would trigger the `exit 1` per require_master_key's semantics, which then aborted the test. Fork and wait for the child process to finish, then inspect the exit status. Also check we aborted because of a missing master key, so something else didn't just abort the boot. Much <3 to @tenderlove for the tip. * Support reading/writing configs via methods. * Skip needless deep symbolizing. * Remove save; test config reader elsewhere. * Move secret_key_base check to when we're reading it. Otherwise we'll abort too soon since we don't assign the secret_key_base to secrets anymore. * Add missing string literal comments; require unneeded yaml require. * ya ya ya, rubocop. * Add master_key/credentials after bundle. Then we can reuse the existing message on `rails new bc4`. It'll look like: ``` Using web-console 3.5.1 from https://github.com/rails/web-console.git (at master@ce985eb) Using rails 5.2.0.alpha from source at `/Users/kasperhansen/Documents/code/rails` Using sass-rails 5.0.6 Bundle complete! 16 Gemfile dependencies, 72 gems now installed. Use `bundle info [gemname]` to see where a bundled gem is installed. Adding config/master.key to store the master encryption key: 97070158c44b4675b876373a6bc9d5a0 Save this in a password manager your team can access. If you lose the key, no one, including you, can access anything encrypted with it. create config/master.key ``` And that'll be executed even if `--skip-bundle` was passed. * Ensure test app has secret_key_base. * Assign secret_key_base to app or omit. * Merge noise * Split options for dynamic delegation into its own method and use deep symbols to make it work * Update error to point to credentials instead * Appease Rubocop * Validate secret_key_base when reading it. Instead of relying on the validation in key_generator move that into secret_key_base itself. * Fix generator and secrets test. Manually add config.read_encrypted_secrets since it's not there by default anymore. Move mentions of config/secrets.yml to config/credentials.yml.enc. * Remove files I have no idea how they got here. * [ci skip] swap secrets for credentials. * [ci skip] And now, changelogs are coming.
* Preload Rails component gems in railties testsMatthew Draper2017-09-041-0/+1
|
* Remove needless `silence_warnings`yuuji.yaginuma2017-09-011-4/+1
| | | | Since ff30db1, warning is not show.
* Fix RuboCop offensesKoichi ITO2017-08-161-2/+2
| | | | And enable `context_dependent` of Style/BracesAroundHashParameters cop.
* Add test case to make sure Parameters configuration are executed onceRafael Mendonça França2017-08-151-0/+10
| | | | Test case for #30045
* Adding frozen_string_literal pragma to Railties.Pat Allan2017-08-141-0/+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
* | 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.
* | Generating the app is where the exception is now raisedDavid Heinemeier Hansson2017-08-031-1/+1
|/
* 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.
* 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.
* Protect from forgery by defaultLisa Ugray2017-07-101-0/+7
| | | | | | | | 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.
* 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.
* Revert "Merge pull request #29540 from kirs/rubocop-frozen-string"Matthew Draper2017-07-021-1/+0
| | | | | This reverts commit 3420a14590c0e6915d8b6c242887f74adb4120f9, reversing changes made to afb66a5a598ce4ac74ad84b125a5abf046dcf5aa.
* Enforce frozen string in RubocopKir Shatrov2017-07-011-0/+1
|
* Added a shared section to config/database.yml that will be loaded for all ↵Pierre Schambacher2017-04-261-0/+34
| | | | environments
* 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
* Correct spellingBenjamin Fleischer2017-02-051-2/+2
| | | | | | | ``` go get -u github.com/client9/misspell/cmd/misspell misspell -w -error -source=text . ```
* correctly check error messageyuuji.yaginuma2017-01-251-2/+4
| | | | | | | `assert_raise` does not check error message. However, in some tests, it seems like expecting error message checking with `assert_raise`. Instead of specifying an error message in `assert_raise`, modify to use another assert to check the error message.
* Merge pull request #27399 from sinogermany/rails-env-for-empty-string-env-varsRafael Mendonça França2017-01-031-0/+12
|\ | | | | | | Rails env for empty string env vars
| * Rails.env falls back to dev mode when env var is emptyDaniel Deng2017-01-041-0/+12
| |
* | Fix configuration test now that Metal#env was removedRafael Mendonça França2017-01-031-1/+1
| |
* | Remove deprecated config.serve_static_filesRafael Mendonça França2017-01-031-10/+0
| |
* | Remove deprecated `config.static_cache_control`Rafael Mendonça França2017-01-031-10/+0
| |
* | "Use assert_nil if expecting nil. This will fail in minitest 6."Akira Matsuda2016-12-251-3/+3
|/
* Remove aggressive unit test with mock. And add integration level test.Taishi Kasuga2016-11-241-0/+19
|
* deep symbolize keys on secrets.ymlIsaac Sloan2016-11-211-0/+14
|
* Add more rubocop rules about whitespacesRafael Mendonça França2016-10-291-3/+3
|
* Remove deprecated support to :text in renderRafael Mendonça França2016-10-101-9/+9
|
* Add three new rubocop rulesRafael Mendonça França2016-08-161-3/+3
| | | | | | | | Style/SpaceBeforeBlockBraces Style/SpaceInsideBlockBraces Style/SpaceInsideHashLiteralBraces Fix all violations in the repository.
* Add `Style/EmptyLines` in `.rubocop.yml` and remove extra empty linesRyuta Kamizono2016-08-071-1/+0
|
* remove redundant curlies from hash argumentsXavier Noria2016-08-061-3/+3
|