aboutsummaryrefslogtreecommitdiffstats
Commit message (Collapse)AuthorAgeFilesLines
* Fix stubbed methods in test casesbogdanvlviv2018-07-102-3/+3
| | | | | | | | | | Remove returning of `false` value for stubbed `lock_thread=` methods since there aren't any needs in it. Remove unnecessary returning of `true` for stubbed `drop_database` method. Follow up #33309. Related to #33162, #33326.
* Merge pull request #33326 from utilum/replace_shallow_mocks_with_rubyRyuta Kamizono2018-07-105-18/+47
|\ | | | | Replace shallow mocks with Ruby classes
| * Replace shallow mocks with Ruby classesutilum2018-07-105-18/+47
|/ | | | | | | While preparing this I realised that some stubbed returns values serve no purpose, so this patch drops those as well. Step 3 in #33162
* Avoid unneeded expanded column aliases array cachingRyuta Kamizono2018-07-102-8/+5
|
* Merge pull request #33322 from utilum/test_value_instead_of_method_callRafael França2018-07-093-18/+24
|\ | | | | Reduce mocking by testing value instead of method call
| * Reduce mocking by testing value instead of method callutilum2018-07-093-18/+24
|/ | | | Step 2 in #33162
* Merge pull request #33309 from utilum/remove_unnecessary_mocha_stubsRafael França2018-07-095-48/+18
|\ | | | | Remove unnecessary Mocha stubs
| * Remove unnecessary Mocha stubsutilum2018-07-075-48/+18
| | | | | | | | | | | | Step 1 in #33162 [utilum + bogdanvlviv]
* | Merge pull request #33308 from anniecodes/notes-command-changelogRafael França2018-07-091-0/+19
|\ \ | | | | | | Add rake notes and SOURCE_ANNOTATION_DIRECTORIES deprecation to Changelog
| * | Add deprecations related to `rails notes` command to ChangelogAnnie-Claude Côté2018-07-091-0/+19
| | | | | | | | | | | | | | | | | | | | | * SOURCE_ANNOTATION_DIRECTORIES deprecation * Deprecation of `rake notes`, use `rails notes` instead * Deprecation of `rails notes:custom ANNOTATION=custom`, `rails notes:optimize`, `rails notes:todo`, and `rails notes:fixme` in favor of passing `-annotations` or `-a` to `rails notes` * They have all been deprecrated in https://github.com/rails/rails/pull/33220
* | | SQLite: Don't leak internal schema objectsRyuta Kamizono2018-07-093-4/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Related #31201. If creating custom primary key (like a string) in SQLite, it would also create an internal index implicitly which named begin with "sqlite_". It need to be hidden since the internal object names are reserved and prohibited for public use. See https://www.sqlite.org/fileformat2.html#intschema Fixes #33320.
* | | Subsecond precision is not supported until MySQL 5.6.4Ryuta Kamizono2018-07-092-19/+19
| | |
* | | Merge pull request #33280 from nkondratyev/fix/mysql-time-default-valuesRyuta Kamizono2018-07-094-4/+20
|\ \ \ | | | | | | | | | | | | Fix default value for mysql time types with specified precision
| * | | Fix default value for mysql time types with specified precisionNikolay Kondratyev2018-07-044-4/+20
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The TIME, DATETIME, and TIMESTAMP types [have supported](https://mariadb.com/kb/en/library/microseconds-in-mariadb/) a fractional seconds precision from 0 to 6. Default values from time columns with specified precision is read as `current_timestamp(n)` from information schema. rake `db:schema:dump` produces `schema.rb` **without** default values for time columns with the specified precision: t.datetime "last_message_at", precision: 6, null: false rake `db:schema:dump` produces `schema.rb` **with** default values for time columns with the specified precision: t.datetime "last_message_at", precision: 6, default: -> { "current_timestamp(6)" }, null: false
* | | | Merge pull request #28266 from Stellenticket/allow_disable_server_stdout_loggingKasper Timm Hansen2018-07-082-2/+21
|\ \ \ \ | | | | | | | | | | rails server: Allow to explicitly specify whether to output Rails's log to stdout
| * | | | Allow to explicitly specify whether to output Rails' log to stdoutMarkus Doits2018-07-082-2/+21
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Before Rails' logger output is mirrored to std out if: * environment is development and * the process is not daemonized It was not possible to change that behaviour, e.g. to disable log output in that case or enable it in other cases. Now you can explicitly disable or enable output with the new command line switch `--log-to-stdout`, regardless of any other circumstances. ``` // enable output in production rails server -e production --log-to-stdout // disable output in development rails server -e development --no-log-to-stdout ``` Enabling output when daemonized still makes no sense (since tty is detached), but this is ignored for now. If the command line flag is not specified, old behaviour still applies, so this change is completely backward compatible.
* | | | | Merge pull request #33319 from bogdanvlviv/rubocop-offense-single-quotesKasper Timm Hansen2018-07-081-1/+1
|\ \ \ \ \ | | | | | | | | | | | | Fix rubocop offense introduced in 161ed37
| * | | | | Fix rubocop offense introduced in 161ed37bogdanvlviv2018-07-081-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We prefer double quotes over single quotes. Fixes: ``` railties/lib/rails/commands/server/server_command.rb:279:39: C: Style/StringLiterals: Prefer double-quoted strings unless you need single quotes to avoi d extra backslashes for escaping. original_options.concat [ '-u', using ] ``` Related to 161ed37d7120e1f391eed19e49a3390e53e4fe91
* | | | | | Raise an ArgumentError instead of a RuntimeErrorGeorge Claghorn2018-07-083-3/+3
| |/ / / / |/| | | |
* | | | | Merge pull request #33318 from ↵Kasper Timm Hansen2018-07-082-0/+28
|\ \ \ \ \ | |/ / / / |/| | | | | | | | | | | | | | lxxxvi/multiple_expressions_in_assert_no_difference Documentation and some tests for `assert_no_difference`
| * | | | added tests for assert_no_difference with multiple expressionslxxxvi2018-07-082-0/+28
| | |_|/ | |/| |
* | | | Merge pull request #33317 from ↵Kasper Timm Hansen2018-07-085-23/+23
|\ \ \ \ | | | | | | | | | | | | | | | | | | | | bogdanvlviv/has_secure_password-use-recovery_password-instead-of-activation_token has_secure_password: use `recovery_password` instead of `activation_token`
| * | | | has_secure_password: use `recovery_password` instead of `activation_token`bogdanvlviv2018-07-085-23/+23
|/ / / / | | | | | | | | | | | | | | | | | | | | Since we have `has_secure_token`, it is too confusing to use `_token` suffix with `has_secure_password`. Context https://github.com/rails/rails/pull/33307#discussion_r200807185
* | | | Store newly-uploaded files on save rather than assignmentGeorge Claghorn2018-07-0722-679/+1049
| | | |
* | | | Merge pull request #33307 from ↵Ryuta Kamizono2018-07-082-9/+28
|\ \ \ \ | | | | | | | | | | | | | | | | | | | | bogdanvlviv/improve-docs-test-of-has_secure_password Improve docs/test of `has_secure_password`
| * | | | Improve `SecurePasswordTest#test_authenticate`bogdanvlviv2018-07-061-4/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - Ensure that execution of `authenticate`/`authenticate_XXX` returns `self` if password is correct, otherwise `false` (as mentioned in the documentation). - Test `authenticate_password`.
| * | | | Update `has_secure_password` info in the guidebogdanvlviv2018-07-061-5/+21
| | |_|/ | |/| | | | | | | | | | | | | | `has_secure_password` allows configuring name of attribute since #26764. This commit adds a mention about it in the Active Model Basics Guide.
* | | | Fix that models can clobber each others' attachment reflectionsGeorge Claghorn2018-07-073-16/+25
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Consider the following model definitions: class User < ApplicationRecord has_one_attached :avatar end class Group < ApplicationRecord has_one_attached :avatar end If you attempt to reflect on the User model's avatar attachment via User.reflect_on_attachment, you could receive a reflection for the Group model's avatar attachment. Fix this by ensuring that each model class uses its own Hash object to track attachment reflections.
* | | | Merge pull request #32986 from kevgathuku/patch-1Ryuta Kamizono2018-07-081-0/+3
|\ \ \ \ | |_|/ / |/| | | | | | | | | | | Specify location for engine-specific commands [ci skip]
| * | | Specify location for engine-specific commandsKevin Ndung'u Gathuku2018-07-041-0/+3
| | |/ | |/| | | | | | | | | | | | | Be more specific when pointing out where the commands relating to the engine should be run [ci skip]
* | | Don't balloon @original_options with --restart on restart.Kasper Timm Hansen2018-07-071-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | Our restart_command would pass in `--restart` which means that if the @original_options already contains --restart it would keep getting another --restart appended. Nothing here that would break the bank, but just a nicety.
* | | Don't show unneeded deprecation warning on server restart.Kasper Timm Hansen2018-07-072-11/+16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | If booting a server via `rails s -u puma`, we'd convert the option to a `using` positional. When using `rails restart` our `restart_command` would the option converted to the using positional and put that in the restart command. Thus we'd show users deprecation warnings for our own code. Fix that by converting a passed positional to an option instead. Also: fix initialize method signature. The local_options are an array, not a hash. But don't even bother assigning defaults as Thor passes them in.
* | | Remove restart_command leftover from switching to Thor options.Kasper Timm Hansen2018-07-071-4/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Ref: https://github.com/rails/rails/commit/654704247eba742e139cfaa8d1385f13605d9e12 Before the commit we had a restart_command in Rails::Server. But after there's another one in Rails::ServerCommand. The command version of the method is the right one as it's used in server_options. Give the leftover method the boot.
* | | Use only snake cased symbols in commands.Kasper Timm Hansen2018-07-071-5/+5
| |/ |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Mixing strings and symbols seems aesthetically less than ideal. We can also use underscores just fine. Thor converts them to dashes for the CLI and it makes access in Ruby code nicer. Here's the `server --help` output after this change: ``` Usage: rails server [thin/puma/webrick] [options] Options: -p, [--port=port] # Runs Rails on the specified port - defaults to 3000. -b, [--binding=IP] # Binds Rails to the specified IP - defaults to 'localhost' in development and '0.0.0.0' in other environments'. -c, [--config=file] # Uses a custom rackup configuration. # Default: config.ru -d, [--daemon], [--no-daemon] # Runs server as a Daemon. -e, [--environment=name] # Specifies the environment to run this server under (development/test/production). -u, [--using=name] # Specifies the Rack server used to run the application (thin/puma/webrick). -P, [--pid=PID] # Specifies the PID file. # Default: tmp/pids/server.pid -C, [--dev-caching], [--no-dev-caching] # Specifies whether to perform caching in development. [--early-hints], [--no-early-hints] # Enables HTTP/2 early hints. ``` See? Quite dashing ✨
* | Pass along arguments to underlying `get` method in `follow_redirect!` (#33299)Remo Fritzsche2018-07-053-3/+24
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Allow get arguments for follow_redirect Now all arguments passed to `follow_redirect!` are passed to the underlying `get` method. This for example allows to set custom headers for the redirection request to the server. This is especially useful for setting headers that may, outside of the testing environment, be set automatically on every request, i.e. by a web application firewall. * Allow get arguments for follow_redirect [Remo Fritzsche + Rafael Mendonça França]
* | Merge pull request #32776 from Edouard-chin/ec-as-hooksKasper Timm Hansen2018-07-051-10/+11
|\ \ | | | | | | Use testing lazy-load hooks
| * | Use testing lazy-load hooks:Edouard CHIN2018-07-041-10/+11
| | | | | | | | | | | | - In order to avoid loading classes prematurely, let's use lazy load hooks that are now provided with each test case
* | | Merge pull request #33298 from anniecodes/notes-command-testKasper Timm Hansen2018-07-051-12/+12
|\ \ \ | | | | | | | | Make NotesCommand tests more performant by getting rid of unnecessary map
| * | | Make NotesCommand tests more performant by getting rid of unecessary mapAnnie-Claude Côté2018-07-051-12/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | * Get rid of map and replace it with a multiplication of "\n" to generate document with multiple line preceding the annotation * Reduce number from 1000 to 100 since it achieves the same goal * Only keep one test for the multiple lines document since it's unecessary to test multiple times * Update some language in tests names to make it clearer what we are testing
* | | | Merge pull request #33297 from claudiob/shorter-attribute_previous_changeKasper Timm Hansen2018-07-051-1/+1
|\ \ \ \ | |/ / / |/| | | Shorter code: remove unnecessary condition
| * | | Shorter code: remove unnecessary conditionclaudiob2018-07-051-1/+1
|/ / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | See https://github.com/rails/rails/commit/136fc65c9b8b66e1fb56f3a17f0d1fddff9b4bd0#r28897107 I _think_ that this method can now be rewritten from: ```ruby def attribute_previous_change(attr) previous_changes[attr] if attribute_previously_changed?(attr) end ``` to: ```ruby def attribute_previous_change(attr) previous_changes[attr] end ``` without losing performance. --- Calling ```ruby previous_changes[attr] if attribute_previously_changed?(attr) ``` is equivalent to calling ```ruby previous_changes[attr] if previous_changes.include?(attr) ``` When this commit 136fc65c9b was made, Active Record had its own `previous_changes` method, added here below. However, that method has been recently removed from the codebase, so `previous_changes` is now only the method defined in Active Model as: ```ruby def previous_changes @previously_changed ||= ActiveSupport::HashWithIndifferentAccess.new @previously_changed.merge(mutations_before_last_save.changes) end ``` Since we are dealing with a memoized Hash, there is probably no need to check `if .include?(attr_name)` before trying to fetch `[attr]` for it. Does that make sense? Did I miss anything? Thanks!
* | | Merge pull request #33220 from anniecodes/notes-commandKasper Timm Hansen2018-07-055-46/+237
|\ \ \ | | | | | | | | Adds `Rails::Command::NotesCommand` and makes `rake notes` use it under the hood
| * | | Port Annotations rake task to use Rails::NotesCommandAnnie-Claude Côté2018-07-042-7/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | | | * Invokes the notes Rails::Command and passes the rake task ENV variables as annotations options to it * Adds a deprecation warning for unsupported commands * Gets rid of reference to ENV["SOURCE_ANNOTATION_DIRECTORIES"] in SourceAnnotationExtractor since its now dealt with in the NotesCommand * Gets rid of rake desc for each rake notes task so they are not documented while using `rails -T` or `rails --help`
| * | | Adds support to register directories and extensions to NotesCommandAnnie-Claude Côté2018-07-042-0/+46
| | | | | | | | | | | | | | | | | | | | * Require the application and environnement in the notes command in order to load the config files * Adds tests for both register_directories and register_extensions added to a config file
| * | | Adds a Rails::Command for NotesAnnie-Claude Côté2018-07-042-0/+121
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * It is called with `rails notes` * It defaults to displaying [OPTIMIZE, FIXME and TODO] annotations * It accepts custom annotations by using `rails notes -a CUSTOM_ANNOTATION OTHER_ANNOTATION` * It defaults to look for annotations in [app config db lib test] as dictated by SourceAnnotationExtractor * It supports ENV["SOURCE_ANNOTATION_DIRECTORIES"] but adds a deprecation warning and recommends using register_directories instead
| * | | [ci skip] Update documentation related to `rails notes`Annie-Claude Côté2018-07-032-39/+56
| | | | | | | | | | | | | | | | | | | | | | | | * Get rid of references to rake notes in the documentation * Get rid of references to environement variables used in SourceAnnotationExtractor * Updates the command line guide to reflect the new rails notes API
* | | | Merge pull request #33294 from bibstha/remove_unnecessary_require_on_gcs_serviceGeorge Claghorn2018-07-041-1/+0
|\ \ \ \ | |_|/ / |/| | | Remove vestigial require on ActiveStorage GCSService
| * | | Remove vestigial require on ActiveStorage GCSServiceBibek Shrestha2018-07-041-1/+0
|/ / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The file `filename.rb` as mentioned in `require "active_storage/filename"` belongs to the `app` folder while GCSService belongs to the lib folder. Looking at the git blame, it was added in commit https://github.com/rails/rails/commit/ccac681122db9747fec9512076772bca345e24b9#diff-bda6a610ef1575b2c8458c96b7f12578 where ActiveStorage::Filename was actually used. But it is no longer required on master and therefore can be removed. This allows anyone to use GCSService directly without enabling ActiveStorage engine.
* | | Merge pull request #33288 from ioquatix/patch-2Rafael França2018-07-041-2/+4
|\ \ \ | | | | | | | | Better compatibility with SPEC.
| * | | Better compatibility with SPEC.Samuel Williams2018-07-041-2/+4
| | |/ | |/| | | | | | | | | | | | | If `env` is duped or otherwise not the same as the original `env` that was generated at the top of rack middleware, it is impossible for the server hijack proc to update the right `env` instance. Therefore, capturing the return value is more reliable. This is the recommendation of the rack SPEC.