| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* Support hash as first argument for `assert_difference`.
This allows to specify multiple numeric differences in the same assertion.
Example:
assert_difference 'Article.count' => 1, 'Notification.count' => 2 do
# post :create, params: { article: {...} }
end
* Support error message when passing a hash as a first parameter
* Format CHANGELOG properly
[Julien Meichelbeck + Rafael Mendonça França]
|
| |
|
|
|
|
| |
Fix encoding errors when using the pure-Ruby Redis driver instead of Hiredis. Dodge incompatibilities between UTF-8 and arbitrary value encodings, which rear their heads when the Redis driver tries to build a single command string from incompatibly-encoded keys and values.
|
|
|
|
| |
Update the long key handling test so it triggers truncation in the Redis cache store.
|
|\
| |
| | |
Use SHA-1 for non-sensitive digests by default
|
| |
| |
| |
| |
| |
| | |
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`.
|
|\ \
| | |
| | |
| | | |
add instrumentation for read_multi
|
| | |
| | |
| | |
| | | |
currently it's not possible to know what the hit rates are from read_multi
|
|\ \ \
| | | |
| | | | |
Add support for Minitest 5.11
|
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | | |
Runnable.marshal_dump/load was removed in
https://github.com/seattlerb/minitest/commit/00433fc0a4fdd0e6b302aace633384ba1312237
Instead, `Minitest::Result` is contained test result and the that can be
marshalled.
|
| | | | |
|
|\ \ \ \
| |_|_|/
|/| | | |
Fix performance issue with NameError#missing_name on ruby >= v2.3.0.
|
| | | |
| | | |
| | | |
| | | |
| | | | |
Since ruby v2.3.0 `did_you_mean` gem shipped and ENABLED by default.
It patches NameError#message with spell corrections which are SLOW.
|
| | | |
| | | |
| | | |
| | | | |
`ActiveSupport::OrderedOptions` responds to any message.
|
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | | |
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 support for multiple encodings in String.blank?
|
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | | |
Motivation:
- When strings are encoded with `.encode("UTF-16LE")` `.blank?` throws
an `Encoding::CompatibilityError` exception.
- We tested multiple implementation to see what the fastest
implementation was, rescueing the execption seems to be the fastest
option we could find.
Related Issues:
- #28953
Changes:
- Add a rescue to catch the exception.
- Added a `Concurrent::Map` to store a cache of encoded regex objects
for requested encoding types.
- Use the new `Concurrent::Map` cache to return the correct regex for
the string being checked.
|
|\ \ \ \ \
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | | |
danielma/dma/assert-changes-with-to-should-still-assert-change
`assert_changes` should always assert some change
|
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | | |
While using `assert_changes`, I came across some unexpected behavior:
if you provide a `to:` argument, and the expression matches but didn't
actually change, the assertion will pass.
The way `assert_changes` reads, I assumed that it would both assert
that there was any change at all, _and_ that the expression changed to
match my `to:` argument.
In the case of just a `from:` argument, `assert_changes` does what I
expect as well. It asserts that the before value `=== from` and that
the after value changed.
My key change is that `assert_changes` will now _always_ assert that
expression changes, no matter what combination of `from:` and `to:`
arguments
|
| |_|_|/ /
|/| | | | |
|
|\ \ \ \ \
| | | | | |
| | | | | | |
Bump license years for 2018
|
| | |_|_|/
| |/| | | |
|
|\ \ \ \ \
| |/ / / /
|/| | | | |
Duration created with no parts will have a default seconds part eqaul to 0
|
| | | | | |
|
| | | | |
| | | | |
| | | | |
| | | | | |
This reverts commit 57f0e3d1300d01444d2a311560c055d26968dc3f.
|
|\ \ \ \ \
| | | | | |
| | | | | | |
Raise an error only when `require_master_key` is specified
|
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | | |
To prevent errors from being raise in environments where credentials
is unnecessary.
Context: https://github.com/rails/rails/issues/31283#issuecomment-348801489
Fixes #31283
|
|\ \ \ \ \ \
| | | | | | |
| | | | | | | |
Clarify docs for delegate :allow_nil option
|
| |/ / / / / |
|
|/ / / / /
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | | |
Using `truncate` to limit the length of the digest has the unwanted side
effect of adding an ellipsis when the input is longer than the limit.
Also:
- Don't instantiate a new object for every digest
- Rename the configuration option to `hash_digest_class`
- Update the CHANGELOG entry to describe how to use the feature
|
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | | |
`BigDecimal.new` has been deprecated in BigDecimal 1.3.3
which will be a default for Ruby 2.5.
Refer
https://github.com/ruby/bigdecimal/commit/533737338db915b00dc7168c3602e4b462b23503
* This commit has been made as follows:
```
cd rails
git grep -l BigDecimal.new | grep -v guides/source/5_0_release_notes.md | grep -v activesupport/test/xml_mini_test.rb | xargs sed -i -e "s/BigDecimal.new/BigDecimal/g"
```
- `activesupport/test/xml_mini_test.rb`
Editmanually to remove `.new` and `::`
- guides/source/5_0_release_notes.md
This is a Rails 5.0 release notes.
|
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | | |
* The `DEFAULT_ERROR_HANDLER` constant in
`ActiveSupport::Cache::RedisCacheStore` contained references
to an undefined argument `e`, which is supposed to refer
to the `exception` parameter.
* Update the default error handler proc to correctly reference
the `exception` parameter.
|
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | | |
```ruby
/path/to/rails/activesupport/lib/active_support/digest.rb:7:
warning: instance variable @hash_digest_class not initialized
``
|
|\ \ \ \ \
| | | | | |
| | | | | | |
Initial support for running Rails on FIPS-certified systems
|
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | | |
implementation
and defaults to `Digest::MD5`.
Replaced calls to `::Digest::MD5.hexdigest` with calls to `ActiveSupport::Digest.hexdigest`.
|
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | | |
This commit fixes `deprecate` so that it preserves method visibility (like it
did previously when it was utilizing `alias_method_chain`).
When Module#prepend replaced alias_method_chain in a982a42 it caused deprecated
methods to always become public.
`alias_method_chain` had this bit of code:
https://github.com/rails/rails/blob/v5.0.6/activesupport/lib/active_support/core_ext/module/aliasing.rb#L40-L47
which preserved method visibility.
Without this fix, a workaround would be:
```ruby
class C8
private
def new_method
end
def old_method
end
deprecate :old_method, :new_method
# workaround:
instance_method(:old_method).owner.send(:private, :old_method)
end
```
Because the visibility needs to be fixed on the Module prepended by
MethodWrapper.
|
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | | |
If the current thread is preempted after the stub has been removed but
before the original method has been restored, then the other thread will
get a `NoMethodError` when it tries to call the method.
Using `silence_redefinition_of_method` instead of `undef_method` ensures
that either the stub or the original method is always in place.
|
|/ / / / /
| | | | |
| | | | |
| | | | |
| | | | | |
Example codes that use `has_many` or `before_create` in `Module::Concerning` look like active record models.
So I've made them inherit `ApplicationRecord`.
|
| | | | |
| | | | |
| | | | |
| | | | |
| | | | | |
(#31275)
https://www.ruby-lang.org/en/news/2016/09/08/ruby-2-4-0-preview2-released/
|
| | | | | |
|
|\ \ \ \ \
| | | | | |
| | | | | | |
Refactor Date/Time next_occurring and prev_occurring
|
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | | |
These methods were originally added in https://github.com/rails/rails/pull/26600
This includes a couple of refactors to make these methods behave more similarly to other Date/Time extensions added by Active Support:
1. Use `advance` instead of `since` and `ago` to time-travel — this is particularly important to keep the returned instance’s class matching `self`. Before this change:
today = Date.today # => Tue, 28 Nov 2017
today.class # => Date
today.next_occurring(:wednesday) # => Wed, 29 Nov 2017 00:00:00 UTC +00:00
today.next_occurring(:wednesday).class # => ActiveSupport::TimeWithZone
After this change, a Date (or Time, or DateTime) instance is properly returned (just like is shown in the new docs). This is generally how everything else in DateAndTime::Calculations works.
2. Move the tests from the DateTime tests to the DateAndTimeBehavior tests. The latter location is mixed in to the core_ext tests for _all_ of Date, Time, and DateTime to test the behavior across all of the classes. The previous location is for testing core_ext functionality added specifically just to DateTime.
3. Better docs!
|
|/ / / / /
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | | |
Just cleaning up the formatting of the example code here to format an inline bit of commentary as a comment.
Before:
![](https://monosnap.com/file/Clso8IQGOWHU3o6cStbY5NaMPx3ysP.png)
After:
![](https://monosnap.com/file/QdbKKvLAeiQ0RucppVYETvaWEstnOI.png)
[ci skip]
|
| | | | | |
|
|\ \ \ \ \
| | | | | |
| | | | | | |
[ci skip] Fix documentation for deprecation method_wrappers
|
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | | |
Seems like version with class methods doesn't work.
```ruby
require "active_support/deprecation.rb"
module Fred
extend self
def aaa; end
def bbb; end
def ccc; end
def ddd; end
def eee; end
end
ActiveSupport::Deprecation.deprecate_methods(Fred, :aaa, bbb: :zzz, ccc: 'use Bar#ccc instead')
Fred.aaa
Fred.bbb
Fred.ccc
```
# produces nothing
vs
```ruby
require "active_support/deprecation.rb"
class Fred
def aaa; end
def bbb; end
def ccc; end
def ddd; end
def eee; end
end
ActiveSupport::Deprecation.deprecate_methods(Fred, :aaa, bbb: :zzz, ccc: 'use Bar#ccc instead')
Fred.new.aaa
Fred.new.bbb
Fred.new.ccc
```
produces
```
DEPRECATION WARNING: aaa is deprecated and will be removed from Rails 5.2 (called from <main> at deprications.rb:15)
DEPRECATION WARNING: bbb is deprecated and will be removed from Rails 5.2 (use zzz instead) (called from <main> at deprications.rb:16)
DEPRECATION WARNING: ccc is deprecated and will be removed from Rails 5.2 (use Bar#ccc instead) (called from <main> at deprications.rb:17)
```
|
|/ / / / / |
|
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | | |
The def with blank `()` was newly added in #31176, but we have not used
the blank `()` style in most part of our code base.
So I've enabled `Style/DefWithParentheses` to prevent to newly added the
code.
|
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | | |
Even that collisions are unlikely we need to make sure the two strings
are equal.
Timing is not important in this case because this only runs after the
comparison between the SHA256 digested strings returns true.
|
|\ \ \ \ \
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | | |
vipulnsward/make-variable_size_secure_compare-public
Make variable_size_secure_compare public
|