aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/test
Commit message (Collapse)AuthorAgeFilesLines
* Return all mappings for a timezone id in `country_zones`Andrew White2018-02-191-0/+10
| | | | | | | | | | | | | | Some timezones like `Europe/London` have multiple mappings in `ActiveSupport::TimeZone::MAPPING` so return all of them instead of the first one found by using `Hash#value`. e.g: # Before ActiveSupport::TimeZone.country_zones("GB") # => ["Edinburgh"] # After ActiveSupport::TimeZone.country_zones("GB") # => ["Edinburgh", "London"] Fixes #31668.
* String#truncate_bytes: limit to N bytes without breaking multibyte charsJeremy Daer2018-02-181-0/+62
| | | | | This faithfully preserves grapheme clusters (characters composed of other characters and combining marks) and other multibyte characters.
* `String#strip_heredoc` preserves frozennessJeremy Daer2018-02-171-0/+4
| | | | | | | | | | | | | | | | | | ```ruby "foo".freeze.strip_heredoc.frozen? # => true ``` Fixes the case where frozen string literals would inadvertently become unfrozen: ```ruby foo = <<-MSG.strip_heredoc la la la MSG foo.frozen? # => false !?? ```
* Rails 6 requires Ruby 2.4.1+Jeremy Daer2018-02-174-79/+9
| | | | | | Skipping over 2.4.0 to sidestep the `"symbol_from_string".to_sym.dup` bug. References #32028
* Remove extra conditions in HWIDA since Rails 6 does not support Ruby 2.2bogdanvlviv2018-02-171-2/+0
| | | | See https://github.com/ruby/ruby/blob/ruby_2_3/NEWS
* Rails 6 requires Ruby 2.3+Jeremy Daer2018-02-172-3/+1
|
* Define transform_keys! in HashWithIndifferentAccessRafael Mendonça França2018-02-161-0/+13
| | | | | | | Make sure that when transforming the keys of a HashWithIndifferentAccess we can still access with indifferent access in Ruby 2.5. Closes #32007.
* Remove usage of strip_heredoc in the framework in favor of <<~Rafael Mendonça França2018-02-162-6/+5
| | | | | Some places we can't remove because Ruby still don't have a method equivalent to strip_heredoc to be called in an already existent string.
* Merge pull request #31866 from fatkodima/redis_cache-connection_poolRafael Mendonça França2018-02-142-2/+50
|\ | | | | | | Add support for connection pooling on RedisCacheStore
| * Add support for connection pooling on RedisCacheStorefatkodima2018-02-012-2/+50
| |
* | Add missing requireyuuji.yaginuma2018-02-081-0/+1
| | | | | | | | | | Without this require, an error occurs when executing only `duration_test.rb`. Ref: https://travis-ci.org/rails/rails/jobs/338817558#L2205-L2210
* | Merge pull request #31923 from jdelStrother/duration-deserializationRafael França2018-02-071-0/+6
|\ \ | | | | | | Fix yaml deserialization of ActiveSupport::Duration
| * | Fix yaml deserialization of ActiveSupport::DurationJonathan del Strother2018-02-071-0/+6
| | | | | | | | | | | | | | | | | | This ensures the duration's @parts hash has a default value, to avoid this regression introduced in 5.1: YAML.load(YAML.dump(10.minutes)) + 1 # => NoMethodError: undefined method `+' for nil:NilClass
* | | Use Redis#mget for RedisCacheStore#fetch_multifatkodima2018-02-051-0/+8
| | |
* | | Add missing instrumentation to RedisCacheStore#read_multifatkodima2018-02-056-17/+20
| | |
* | | RedisCacheStore: fix `#write_multi` mset serializationfatkodima2018-02-041-0/+10
| | | | | | | | | | | | | | | Closes #31886 Fixes #31884
* | | Merge pull request #28171 from sorra/fresh-thread-tagged-loggingRyuta Kamizono2018-02-031-1/+2
|\ \ \ | |_|/ |/| | Improve test for TaggedLogging "keeps each tag in their own thread"
| * | Merge branch 'master' into fresh-thread-tagged-loggingDongqing Hu2017-02-261-0/+13
| |\ \
| * | | Improve test for TaggedLogging "keeps each tag in their own thread"Dongqing Hu2017-02-261-1/+2
| | | |
* | | | Revert "Merge pull request #31447 from fatkodima/redis_cache-connection_pool"George Claghorn2018-01-311-32/+0
| | | | | | | | | | | | | | | | | | | | This reverts commit ac74e2c521f6ddc0eac02d74a1313261bcc1d60f, reversing changes made to ffdb06136152b3c5f7f4a93ca5928e16e755d228.
* | | | Suppress expected exceptions by `report_on_exception` = `false`yuuji.yaginuma2018-01-291-0/+4
| | | | | | | | | | | | | | | | | | | | This suppresses `Timeout::Error` exceptions. Ref: https://travis-ci.org/rails/rails/jobs/334622442#L1089-L1110
* | | | Merge pull request #31803 from rmosolgo/rm-dependenciesRafael França2018-01-261-0/+55
|\ \ \ \ | | | | | | | | | | Fix infinite loop when unloading autoloaded modules
| * | | | Add failing test for infinite loop when unloading autoloaded modules when an ↵Robert Mosolgo2018-01-261-0/+55
| | | | | | | | | | | | | | | | | | | | error occured during the load.
* | | | | Remove extra whitespaceDaniel Colson2018-01-255-42/+42
| | | | |
* | | | | Use assert_empty and assert_not_emptyDaniel Colson2018-01-258-31/+31
| | | | |
* | | | | Use assert_predicate and assert_not_predicateDaniel Colson2018-01-2526-141/+141
| | | | |
* | | | | Change refute to assert_notDaniel Colson2018-01-251-2/+2
| | | | |
* | | | | Use respond_to test helpersDaniel Colson2018-01-2513-47/+47
| | | | |
* | | | | Improve fault tolerance for redis cache storefatkodima2018-01-234-6/+126
| | | | |
* | | | | Add support for connection pooling on RedisCacheStorefatkodima2018-01-224-50/+91
| | | | |
* | | | | Pass desired driver to Redis client constructor rather than munging global ↵George Claghorn2018-01-211-16/+12
|/ / / / | | | | | | | | | | | | config
* | | | Support hash as first argument in `assert_difference`. (#31600)Julien Meichelbeck2018-01-181-0/+29
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * 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]
* | | | Support for connection pooling on mem cache storeGabriel Sobrinho2018-01-181-0/+74
| | | |
* | | | Test against the pure-Ruby Redis driverGeorge Claghorn2018-01-171-0/+6
| | | |
* | | | Fix constant referenceGeorge Claghorn2018-01-161-2/+1
| | | | | | | | | | | | | | | | Update the long key handling test so it triggers truncation in the Redis cache store.
* | | | Merge pull request #30268 from ignatiusreza/instrumentationRyuta Kamizono2018-01-111-6/+6
|\ \ \ \ | | | | | | | | | | | | | | | add instrumentation for read_multi
| * | | | add instrumentation for read_multiIgnatius Reza2017-12-291-6/+6
| | | | | | | | | | | | | | | | | | | | currently it's not possible to know what the hit rates are from read_multi
* | | | | Merge pull request #31648 from dixitp012/rubocop_active_support_testRyuta Kamizono2018-01-081-2/+2
|\ \ \ \ \ | | | | | | | | | | | | | | | | | | Fix rubocop space before comma
| * | | | | Fix rubocop space before commaDixit Patel2018-01-081-1/+1
|/ / / / /
* | | | | Merge pull request #31049 from gwincr11/cg-blankRyuta Kamizono2018-01-041-2/+2
|\ \ \ \ \ | | | | | | | | | | | | Add support for multiple encodings in String.blank?
| * | | | | Add support for multiple encodings in String.blank?Cory Gwin @gwincr112017-11-171-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* | | | | | Merge pull request #31011 from ↵Ryuta Kamizono2018-01-041-0/+11
|\ \ \ \ \ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | danielma/dma/assert-changes-with-to-should-still-assert-change `assert_changes` should always assert some change
| * | | | | | `assert_changes` should always assert some changeDaniel Ma2017-11-131-0/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* | | | | | | Merge pull request #31310 from kinnrot/duration-moduloRyuta Kamizono2018-01-011-0/+2
|\ \ \ \ \ \ \ | |_|_|/ / / / |/| | | | | | Duration created with no parts will have a default seconds part eqaul to 0
| * | | | | | Empty duration inspect fixChen Kinnrot2017-12-131-0/+2
| | | | | | |
* | | | | | | Test that cache stores build unversioned keysGeorge Claghorn2017-12-221-0/+12
| | | | | | |
* | | | | | | Handle `FrozenError` if it is availableYasuo Honda2017-12-202-1/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This pull request handles `FrozenError` introduced by Ruby 2.5. Refer https://bugs.ruby-lang.org/projects/ruby-trunk/repository/revisions/61131 Since `FrozenError` is a subclass of `RuntimeError` minitest used by master branch can handle it, though it would be better to handle `FrozenError` explicitly if possible. `FrozenError` does not exist in Ruby 2.4 or lower, `frozen_error_class` handles which exception is expected to be raised. This pull request is intended to be merged to master, then backported to `5-1-stable` to address #31508
* | | | | | | Merge pull request #31348 from y-yagi/fix_31283Kasper Timm Hansen2017-12-182-4/+15
|\ \ \ \ \ \ \ | | | | | | | | | | | | | | | | Raise an error only when `require_master_key` is specified
| * | | | | | | Raise an error only when `require_master_key` is specifiedyuuji.yaginuma2017-12-182-4/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | To prevent errors from being raise in environments where credentials is unnecessary. Context: https://github.com/rails/rails/issues/31283#issuecomment-348801489 Fixes #31283
* | | | | | | | Don't include ellipsis in truncated digest outputEugene Kenny2017-12-171-1/+1
|/ / / / / / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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