Commit Graph

74209 Commits

Author SHA1 Message Date
Wojciech Wnętrzak
8674417358
Support multiple arguments in HashWithIndifferentAccess for merge and update methods
It follows Ruby 2.6 addition https://github.com/ruby/ruby/pull/1951
2019-08-07 20:41:07 +02:00
Gannon McGibbon
7fd006de0b Pass optional record in blob finder methods
Allow record to be optionally passed to blob finders to make sharding
easier.
2019-08-07 14:38:05 -04:00
Abhay Nikam
76ed911a91 Correct the assertion argument order 2019-08-08 00:06:34 +05:30
Eileen M. Uchitelle
9894f652ad
Merge pull request #36881 from seejohnrun/address-activejob-pr-feedback
Add CHANGELOG entry for ActiveJob change
2019-08-07 14:25:27 -04:00
John Crepezzi
c45c84db72 Add CHANGELOG entry for ActiveJob change
In #36864 we made a change to an ActiveJob test helper to add a new
parameter for testing jobs delayed into the future.

This commit adds a CHANGELOG entry for that change as well as fixing a
circular argument error.
2019-08-07 19:55:16 +02:00
John Hawthorn
cd130297ec Fix test schema loading for multi-db
Previously we weren't passing in the spec_name, so this wasn't able to
pick up the alternate schema names when using multiple databases.
2019-08-07 10:25:02 -07:00
Carlos Antonio da Silva
683e1c7d18 Fix typo in test name 2019-08-07 13:46:15 -03:00
Rafael França
e39efdb87a
Merge pull request #36879 from akshaymohite/fix-cache-store-in-documentation-example
Fixed cache_store name used in adding other modules section of api app documentation guide. [ci skip]
2019-08-07 11:21:56 -04:00
Akshay Mohite
e29fb52074
Fixed cache_store name used in adding other modules section of api app documentation. [ci skip]
- Using `mem_cached_store` results in an exception as lib/active_support/cache.rb:106:in `rescue in retrieve_store_class': Could not find cache store adapter for mem_cached_store (cannot load such file -- active_support/cache/mem_cached_store) (RuntimeError)
- Changed the name of cache_store as `mem_cache_store` instead of `mem_cached_store`
2019-08-07 20:34:55 +05:30
George Claghorn
c2f197c775 Correct assertion argument order 2019-08-07 10:54:56 -04:00
Ryuta Kamizono
975a62224a
Merge pull request #36876 from kamipo/fix_group_by_aggregation_alias
Fix GROUP BY aggregation alias to not duplicate "_" chars
2019-08-07 23:20:43 +09:00
Vipul A M
135f79462a
Merge pull request #36877 from blaedj/patch-1
Fix typo in autoloading constants guide  [ci skip]
2019-08-07 19:49:46 +05:30
Michael Herold
ab34ed8acc Allow testing multipart emails in Action Mailbox
Allow passing a block to the create_inbound_email_from_mail and
receive_inbound_email_from_mail test helper methods.

When you wanted to test a multipart email -- for example, an email that
has both a plaintext part and an HTML part -- there wasn't a way to
easily build one without a pre-made fixture. By allowing you to pass a
block to these methods, we unlock the power of Mail.new to easily
create a variety of emails, from multi-part emails, to emails with
attachments, and beyond.
2019-08-07 10:12:13 -04:00
blaedj
ec812fc594
Fix typo in autoloading_and_reloading_constants
[ci skip]
2019-08-07 09:09:00 -05:00
Ryuta Kamizono
e62195e259 Fix GROUP BY aggregation alias to not duplicate "_" chars
c9e4c848 has one performance optimization for `aggregate_alias` to early
returning by `aggregate_alias.match?(/\A\w+\z/)`, but it is caused a
regression that failing deduplication for non word chars #36867.

I've quited the optimization and add a test to prevent a future
regression.

Fixes #36867.
2019-08-07 23:05:23 +09:00
John Hawthorn
6bc88355ea
Merge pull request #36870 from jhawthorn/schema_sha
Sync test DB from schema using its SHA1
2019-08-06 15:47:44 -07:00
George Claghorn
d1c2ba6dfc
Merge pull request #36866 from peterzhu2118/update-azure-storage-gem
Update azure-storage gem to latest version
2019-08-06 16:13:08 -04:00
Peter Zhu
ebedf0a6c0 Update azure-storage gem to latest version 2019-08-06 16:02:42 -04:00
Eileen M. Uchitelle
b4ee594d13
Merge pull request #36868 from eileencodes/make-prevent-writes-threadsafe
Fix thread safety of prevent_writes
2019-08-06 15:58:00 -04:00
John Hawthorn
ba093a5ada Sync test DB from schema using its SHA1
Previously, we used the migration status to determine whether the test
database(s) needed to be reloaded from the schema. This worked in most
cases, but if a schema.rb was modified outside of migrations or if a
migration was rolled back, it would require a manual db:test:prepare.

This commit updates load_schema to record the SHA1 of the loaded schema
file inside of the ar_internal_metadata table. We can then use this SHA
to determine whether we should reload the schema.

This ensures that the test DB stays exactly in sync with the schema
file, including rollbacks which fixes a test marked TODO.
2019-08-06 12:44:22 -07:00
Eileen M. Uchitelle
9678ac9b39
Merge pull request #36869 from eileencodes/fix-gemfile-lock
Fix Gemfile.lock
2019-08-06 14:48:31 -04:00
eileencodes
793b092f53 Fix Gemfile.lock
The PR #36860 changed ActionView's required version of
rails-html-sanitizer, but I missed that we needed to run bundle,
otherwise we end up with changes every time.
2019-08-06 13:15:50 -04:00
Eileen M. Uchitelle
eb4faa13e8
Merge pull request #36864 from seejohnrun/activejob-test-helper-set-wait
Add at option to perform_enqueued_jobs test helper
2019-08-06 13:08:32 -04:00
eileencodes
ff70c1764d Fix thread safety of prevent_writes
As demonstrated in the test added and in #36830 the code that prevents
writes wasn't thread safe. If one thread does a read, then another does
a write, and then another does a read the second read will cause the
first write to be unwriteable.

This change removes the instance variable and instead uses a
getter/setter on Thread.current[:prevent_writes] for the connection
handler to set whether writes are allowed.

Fixes #36830
2019-08-06 13:07:19 -04:00
John Crepezzi
647317d17e Add at option to perform_enqueued_jobs test helper
Currently, the `perform_enqueued_jobs` helpers will also immediately
perform jobs that are scheduled via `set(wait:)` to run in the future.
This commit adds a new argument to `perform_enqueued_jobs` to make it
only run jobs scheduled at or before the passed in `Time`. This allows
testing the side effects of immediate job execution separate of jobs
delayed in the future.
2019-08-06 16:31:48 +02:00
Ryuta Kamizono
7cd4148973
Merge pull request #36863 from okuramasafumi/add-explanation-of-context-to-activerecord-save-docs
[ci skip] Mention `context` option of save in documentation
2019-08-06 20:25:59 +09:00
OKURA Masafumi
e7ce8d2653 [ci skip] Mention context option of save in documentation
`ActiveRecord::Validations#save` takes `context` option
which can change validation context.
This fact should be mentioned in the documentation.
2019-08-06 20:10:11 +09:00
Eileen M. Uchitelle
3d83fff3bb
Merge pull request #36860 from cpruitt/update-gemspec-rails-html-sanitizer-version
Update rails-html-sanitizer to 1.1.0 in actionview.gemspec
2019-08-05 14:54:26 -04:00
Cliff Pruitt
265f97f1c1 Update rails-html-sanitizer to 1.1.0 in actionview.gemspec
Commit 52f0b050e2 replaces `white_list_sanitizer` with `safe_list_sanitizer`. This is a breaking change unless the installed version of `rails-html-sanitizer` is `>= 1.1.0`.

This commit updates the minimum version in `actionview/actionview.gemspec` to `1.1.0`.
2019-08-05 13:20:53 -04:00
Eileen M. Uchitelle
170f5113d7
Merge pull request #36823 from abhaynikam/add-multiple-database-guide-entry-to-release-notes
Added multiple database Active Record guide entry to the release notes
2019-08-05 08:42:15 -04:00
Vipul A M
9f7461c6eb
Merge pull request #36857 from akshaymohite/correct-config-option-in-release-notes
Corrected config option path in release notes for deprecation release notes of Rails 6 [ci skip]
2019-08-05 11:36:47 +05:30
Akshay Mohite
d15a72aba6
Corrected deperecation config option path for active_record.sqlite3.represent_boolean_as_integer option in release notes. [ci skip] 2019-08-05 11:26:43 +05:30
Kasper Timm Hansen
064b7f6082
Remove unused require 2019-08-05 04:10:54 +02:00
Kasper Timm Hansen
4f235e9a86
Merge pull request #36537 from quadule/fix-cookie-rotation-hash-pollution
Fix cookie modification during rotation
2019-08-05 03:57:08 +02:00
Kasper Timm Hansen
3d1f6feda2
Use newly released rails-html-sanitizer 2019-08-05 03:55:12 +02:00
Juanito Fatas
52f0b050e2
Update sanitizer in ActionView::Helpers::SanitizeHelper
- The sanitizer has been changed to safe_list_sanitizer.
- deprecate white_list_sanitizer
2019-08-05 03:35:35 +02:00
Lachlan Sylvester
1af44e4aee
handle passing in primary key to unique_by, and handle primary keys missing indexes 2019-08-05 02:39:52 +02:00
Guilherme Mansur
6c6d852854
Use Thread.pass instead of Kernel.sleep to trigger race condition 2019-08-05 02:31:53 +02:00
Guilherme Mansur
2bd2d853da
Able to initalize default value for thread_mattr_*
Added the ability to initialize `thread_mattr_*` methods with default
values like so:

``` ruby
  class MyClass
    thread_attr_reader :foo, default: :foo
    thread_attr_writer :bar, default: :bar
    thread_attr_accessor: baz do
      "baz"
    end
  end
```

This is consistent with the api exposed by `mattr_accessor`.
2019-08-05 02:31:36 +02:00
Prathamesh Sonpatki
cebbf6c6cf
Mention how to use webpacker in updated Rails apps [ci skip] 2019-08-04 22:20:59 +02:00
Eileen M. Uchitelle
2c0b67c281
Merge pull request #36845 from eileencodes/fix-pg-closed-connection
Fix `PG::ConnectionBad` error when running fixtures
2019-08-04 15:25:05 -04:00
Kasper Timm Hansen
5f3848a979
Merge pull request #36854 from eugeneius/media_type_instead_of_content_type
Use media_type instead of content_type internally
2019-08-04 02:53:01 +02:00
Kasper Timm Hansen
f1f5024b91
Revise flow to what was described in 03e44f9 2019-08-04 02:19:55 +02:00
Eugene Kenny
7cf445d3bd Use media_type instead of content_type internally
These calls to `content_type` were triggering the deprecation from
c631e8d011a7cf3e7ade4e9e8db56d2b89bd530c in upgraded applications.

We can use `media_type` in all of these cases to avoid the deprecation.
2019-08-04 00:35:49 +01:00
Kasper Timm Hansen
03e44f9300
Revise credentials diffing flow to use a separate diff command
Didn't like the complicated stuff that happened on credentials:edit. It
would append to .gitattributes multiple times. Though I see why it was
written that way.

I'm cutting off for now, but since this new flow would require each developer
to run --enable perhaps this should really be:

1. Developer enrolls Rails app by running `credentials:diff --enable`
2. credentials:edit checks .gitattributes for `diff=rails_credentials` and
   if the current file is covered by that.
3. If so, set up the "rails_credentials" driver automatically.
2019-08-04 01:32:41 +02:00
Kasper Timm Hansen
6db2c426c0
Extract diffing to separate credentials:diff command 2019-08-04 00:00:16 +02:00
Kasper Timm Hansen
b4112f45b3
Commands already make fileutils available. 2019-08-03 23:19:14 +02:00
Kasper Timm Hansen
af2880bdda
Rename to Diffing and move module into credentials command
Helpers is more for sharing between commands. Since `Diffing` is only
for credentials we should just keep it only for credentials.

Replaces "pretty" with diffing since the former is ambiguous, while
diffing captures what it does. `opt_in` seemed clunky so it's swapped
for the one-word enable.
2019-08-03 23:06:47 +02:00
y-yagi
99650550e8
Merge pull request #36849 from yahonda/use_assert_nil
Address `DEPRECATED: Use assert_nil if expecting nil`
2019-08-03 11:50:17 +09:00
Yasuo Honda
20772f6c53 Address DEPRECATED: Use assert_nil if expecting nil
```ruby
$ cd activerecord
$ bin/test test/cases/dirty_test.rb:494
... snip ...
DEPRECATED: Use assert_nil if expecting nil from /home/yahonda/git/rails/activerecord/test/cases/dirty_test.rb:494. This will fail in Minitest 6.
DEPRECATED: Use assert_nil if expecting nil from /home/yahonda/git/rails/activerecord/test/cases/dirty_test.rb:511. This will fail in Minitest 6.
.

Finished in 0.061593s, 16.2356 runs/s, 795.5428 assertions/s.
1 runs, 49 assertions, 0 failures, 0 errors, 0 skips
$
```

Refer seattlerb/minitest#666 rails/rails#27712
2019-08-03 02:27:56 +00:00