aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/test
Commit message (Collapse)AuthorAgeFilesLines
* Merge pull request #34405 from shugo/safe_buffer_backref_fixMatthew Draper2019-03-281-0/+18
|\ | | | | sub, sub!, gsub, and gsub! should set back references
| * sub, sub!, gsub, and gsub! should set back referencesShugo Maeda2018-11-081-0/+18
| |
* | Fix bug in Range comparisons when comparing to excluded-end RangeOwen Stephens2019-03-281-2/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Before: ```ruby (1..10).cover?(1...11) => false ``` After: ```ruby (1..10).cover?(1...11) => true ``` See https://git.io/fjTtz for the commit against Ruby core that added support for Range arguments, with similar handling of this case.
* | Use weak references in descendants trackerEdgars Beigarts2019-03-261-0/+9
| | | | | | | | It allows anonymous subclasses to be garbage collected.
* | Update AS::Notifications::Instrumenter#instrumentAli Ibrahim2019-03-221-0/+6
| | | | | | | | | | * Update #instrument to make passing a block optional. This will let users leverage #instrument for messaging in addition to instrumentation.
* | Fix Time#advance to work with dates before 1001-03-07Andrew White2019-03-181-0/+2
| | | | | | | | | | | | | | | | | | In #10634 the behavior of Time#advance was changed to maintain a proleptic gregorian calendar for dates before calendar reform. However it didn't full address dates a long time before calendar reform and they gradually drift away from the proleptic calendar the further you go back in time. Fix this by always converting the date to gregorian before calling advance which sets the reform date to -infinity.
* | Match evented checker behavior on dir with no extsJohn Hawthorn2019-03-151-0/+12
| | | | | | | | | | | | | | | | | | | | When FileUpdateChecker is passed a directory and given an empty array of extensions to match on, it will match any extension. Previously, EventedFileUpdateChecker would never match any files when given an empty array. This commit makes it EventedFileUpdateChecker match FileUpdateChecker, and watch all extensions when given an empty array.
* | support slice assignment on SafeBufferRichard Monette2019-03-131-0/+32
| |
* | Fix bug with parametrize when `locale` is passedSharang Dashputre2019-03-123-0/+18
| | | | | | | | Also add tests for parametrize and transliterate
* | Fix including/excluding flatteningGabriel Sobrinho2019-03-062-0/+3
| |
* | Added Array#including, Array#excluding, Enumerable#including, ↵David Heinemeier Hansson2019-03-052-3/+19
| | | | | | | | Enumerable#excluding
* | Run activesupport's memcache store tests on Buildkitebogdanvlviv2019-02-263-14/+15
| | | | | | | | Related to 287920ca7d06c8f51198ec750d65ba703835b257
* | Use Dir#children and Dir#each_child instead of excluding "." and ".."Ricardo Díaz2019-02-131-1/+1
| | | | | | | | | | | | | | | | Both methods were introduced in Ruby 2.5 and fit this use case very nicely: listing a directory's entries excluding the "." and ".." nodes. The private method #exclude_from was removed as it no longer serves its original purpose.
* | Merge pull request #32861 from zvkemp/asn-unsubscribe-proxyAaron Patterson2019-02-112-0/+52
|\ \ | | | | | | use ProxyPattern to match for ActiveSupport::Notifications fanout/unsubscribe
| * | use a proxy matcher for AS::N fanoutzvkemp2019-02-112-0/+52
| | |
* | | Fix rubocop violationsyuuji.yaginuma2019-02-091-2/+2
| | |
* | | Delete uneeded blank fileGuillermo Iguaran2019-02-081-0/+0
| | |
* | | Add 'Hash#deep_transform_values', and 'Hash#deep_transform_values!'Guillermo Iguaran2019-02-082-0/+27
|/ /
* | Respect ENV variables when finding DBs etc for the test suiteMatthew Draper2019-02-061-1/+1
| | | | | | | | | | If they're not set we'll still fall back to localhost, but this makes it possible to run the tests against a remote Postgres / Redis / whatever.
* | Merge pull request #35063 from rosa/current-before-reset-callbackRafael Mendonça França2019-02-041-7/+30
|\ \ | | | | | | | | | Support before_reset callback in CurrentAttributes
| * | Support before_reset callback in CurrentAttributesRosa Gutierrez2019-01-301-7/+30
| | | | | | | | | | | | | | | | | | | | | | | | | | | This is useful when we need to do some work associated to `Current.reset` but that work depends on the values of the current attributes themselves. This cannot be done in the supported `resets` callback because when the block is executed, CurrentAttributes's instance has already been reset. For symmetry, `after_reset` is defined as alias of `resets`.
* | | ActiveSupport typo fixes.alkesh262019-02-017-7/+7
|/ /
* | Add HashWithIndifferentAccess#assocStefan Schüßler2019-01-301-0/+8
| |
* | Remove deprecated `Module#reachable?` methodRafael Mendonça França2019-01-171-51/+0
| |
* | Remove deprecated `#acronym_regex` method from `Inflections`Rafael Mendonça França2019-01-171-6/+0
| |
* | Fix safe_constantize to not raise a LoadError.Keenan Brock2019-01-092-0/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | ### Summary There was an issues when using `safe_constantize` on a string that has the wrong case. File `em.rb` defines `EM`. `"Em".safe_constantize` causes a little confusion with the autoloader. The autoloader finds file "em.rb", expecting it to define `Em`, but `Em` is not defined. The autoloader raises a `LoadError`, which is good, But `safe_constantize` is defined to return `nil` when a class is not found. ### Before ``` "Em".safe_constantize LoadError: Unable to autoload constant Em, \ expected rails/activesupport/test/autoloading_fixtures/em.rb to define it ``` ### After ``` "Em".safe_constantize # => nil ```
* | Enable `Lint/UselessAssignment` cop to avoid unused variable warnings (#34904)Ryuta Kamizono2019-01-091-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | * Enable `Lint/UselessAssignment` cop to avoid unused variable warnings Since we've addressed the warning "assigned but unused variable" frequently. 370537de05092aeea552146b42042833212a1acc 3040446cece8e7a6d9e29219e636e13f180a1e03 5ed618e192e9788094bd92c51255dda1c4fd0eae 76ebafe594fc23abc3764acc7a3758ca473799e5 And also, I've found the unused args in c1b14ad which raises no warnings by the cop, it shows the value of the cop.
* | Merge pull request #34700 from gmcgibbon/fetch_multi_key_orderRafael França2019-01-071-1/+9
|\ \ | | | | | | Preserve key order of #fetch_multi
| * | Preserve key order passed to ActiveSupport::CacheStore#fetch_multiGannon McGibbon2018-12-271-1/+9
| | | | | | | | | | | | | | | | | | fetch_multi(*names) now returns its results in the same order as the `*names` requested, rather than returning cache hits followed by cache misses.
* | | Tweak test nameGeorge Claghorn2018-12-301-1/+1
| | |
* | | Make Active Storage blob keys lowercaseJulik Tarkhanov2018-12-301-0/+20
| | | | | | | | | Accommodate case-insensitive filesystems and database collations.
* | | No need to handle if FrozenError is availableYasuo Honda2018-12-232-5/+1
| | | | | | | | | | | | | | | | | | | | | Rails 6 requires Ruby 2.5, which introduces `FrozenError` https://docs.ruby-lang.org/en/2.5.0/NEWS.html Related to #31520
* | | Fixes `warning: mismatched indentations at 'rescue' with 'def' at 15`.utilum2018-12-211-2/+2
| | | | | | | | | | | | See https://travis-ci.org/rails/rails/jobs/470890129#L2361
* | | Merge pull request #34764 from kamipo/avoid_redundant_beginRyuta Kamizono2018-12-215-140/+123
|\ \ \ | | | | | | | | Enable `Style/RedundantBegin` cop to avoid newly adding redundant begin block
| * | | Enable `Style/RedundantBegin` cop to avoid newly adding redundant begin blockRyuta Kamizono2018-12-215-140/+123
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Currently we sometimes find a redundant begin block in code review (e.g. https://github.com/rails/rails/pull/33604#discussion_r209784205). I'd like to enable `Style/RedundantBegin` cop to avoid that, since rescue/else/ensure are allowed inside do/end blocks in Ruby 2.5 (https://bugs.ruby-lang.org/issues/12906), so we'd probably meets with that situation than before.
* | | | Merge pull request #33822 from y-yagi/do_not_check_parents_dor_directoriesYuji Yaginuma2018-12-211-0/+28
|\ \ \ \ | | | | | | | | | | Do no watch parent directory of `dirs`
| * | | | Do not add parent directory to file system monitoringyuuji.yaginuma2018-12-181-0/+28
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | `EventedFileUpdateChecker` will search the parent directory if the specified directory does not exist. Since `test/mailers/previews` is included in the watch target by default, if there is no test directory (e.g. using `rspec`), the Rails root directory will be included in the watch target. ``` $ rails new app $ cd app $ ./bin/rails r "p Rails.application.reloaders.last.send(:directories_to_watch).include?(Rails.root)" false $ rm -rf test $ ./bin/rails r "p Rails.application.reloaders.last.send(:directories_to_watch).include?(Rails.root)" true ``` This causes `node_modules` to be included in watch target. Adding parent directories to watch target may include unexpected directories. In order to avoid this, fixed that parents of nonexistent directories are not added to the watch targets, instead checking that the directory exists when checking changes. Related to #32700. [Matthew Draper & Yuji Yaginuma]
* | | | | Add test for `travel_to` with time zoneyuuji.yaginuma2018-12-211-0/+17
| | | | | | | | | | | | | | | | | | | | This is a regression test for #34751.
* | | | | Merge pull request #34762 from bogdanvlviv/fix-a-few-deprecation-warningsKasper Timm Hansen2018-12-201-28/+6
|\ \ \ \ \ | |_|/ / / |/| | | | Follow up #34754
| * | | | Follow up #34754bogdanvlviv2018-12-201-28/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - Fix a few deprecation warnings - Remove testing of `Hash#slice` - Imporve test of `Hash#slice!` - Remove mention about `Hash#slice` from the guide
* | | | | Module#{define_method,alias_method,undef_method,remove_method} become public ↵Ryuta Kamizono2018-12-211-1/+1
|/ / / / | | | | | | | | | | | | | | | | | | | | since Ruby 2.5 https://bugs.ruby-lang.org/issues/14133
* | | | Remove remaining tests for `Hash#transform_keys` and `Hash#transform_keys!`Ryuta Kamizono2018-12-211-27/+0
| | | | | | | | | | | | | | | | Follow up #34761.
* | | | Use native `Array#append`, `Array#prepend`, `Hash#transform_keys`, and ↵Ryuta Kamizono2018-12-202-71/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | `Hash#transform_keys!` Since Rails 6 requires Ruby 2.5. https://github.com/ruby/ruby/blob/ruby_2_5/NEWS Follow up #34754.
* | | | Extend documentation of `ActiveSupport::Notifications.subscribe` (#34721)Bogdan2018-12-171-1/+1
|/ / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Extend documentation of `ActiveSupport::Notifications.subscribe` Add mention that a block with only one argument passed to the method will yield an event object. Related to #33451 * Emphasize that `SubscribeEventObjects` is a test class by adding suffix `Test`
* | | Test ActiveSupport::Deprecation.deprecate_methodsYosuke Kabuto2018-12-141-0/+7
| | | | | | | | | | | | There was no test without an alternate method name is given.
* | | Enable `Layout/SpaceAfterSemicolon` cop to avoid newly adding odd spacingRyuta Kamizono2018-12-131-1/+1
|/ / | | | | | | Ref https://github.com/rails/rails/commit/59ff1ba30d9f4d34b4d478104cc3f453e553c67a#diff-38fb97fba84b1ef0f311c4110a597c44R35
* | Make `deprecate` work for non-exists methodsyuuji.yaginuma2018-12-071-0/+7
| | | | | | | | | | | | | | | | Before #33325, `deprecate` works for non-exist methods. This is necessary, for example, if want to deprecate dynamically defined methods like attributes methods. Fixes #34646
* | Do nothing when the same block is included again.Mark J. Titorenko2018-11-292-0/+19
| | | | | | | | | | | | | | | | | | If the same block is included multiple times, we no longer raise an exception or overwrite the included block instance variable. Fixes #14802. [Mark J. Titorenko + Vlad Bokov]
* | Merge pull request #34037 from reitermarkus/atomic_write-permissionsRafael França2018-11-221-0/+14
|\ \ | | | | | | `atomic_write`: Ensure correct permission when `tmpdir` is the same as `dirname`.
| * | Ensure correct permission when `tmpdir` is the same as `dirname`.Markus Reiter2018-10-021-0/+14
| | |