aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/test/core_ext/object
Commit message (Collapse)AuthorAgeFilesLines
* Let's try not to depend too much on other core extensions in a core ↵Akira Matsuda2019-08-021-1/+1
| | | | extension test
* require only what each test concernsAkira Matsuda2019-08-024-4/+7
|
* Implement UnboundMethod#duplicable?Jean Boussier2019-07-121-1/+1
|
* ruby < 2.5 is no longer supportedAkira Matsuda2019-05-281-7/+2
|
* Add `Style/RedundantFreeze` to remove redudant `.freeze`Yasuo Honda2018-09-291-1/+1
| | | | | | | | | | | | | | | | | | | | | Since Rails 6.0 will support Ruby 2.4.1 or higher `# frozen_string_literal: true` magic comment is enough to make string object frozen. This magic comment is enabled by `Style/FrozenStringLiteralComment` cop. * Exclude these files not to auto correct false positive `Regexp#freeze` - 'actionpack/lib/action_dispatch/journey/router/utils.rb' - 'activerecord/lib/active_record/connection_adapters/sqlite3_adapter.rb' It has been fixed by https://github.com/rubocop-hq/rubocop/pull/6333 Once the newer version of RuboCop released and available at Code Climate these exclude entries should be removed. * Replace `String#freeze` with `String#-@` manually if explicit frozen string objects are required - 'actionpack/test/controller/test_case_test.rb' - 'activemodel/test/cases/type/string_test.rb' - 'activesupport/lib/active_support/core_ext/string/strip.rb' - 'activesupport/test/core_ext/string_ext_test.rb' - 'railties/test/generators/actions_test.rb'
* Enable `Performance/UnfreezeString` copyuuji.yaginuma2018-09-231-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In Ruby 2.3 or later, `String#+@` is available and `+@` is faster than `dup`. ```ruby # frozen_string_literal: true require "bundler/inline" gemfile(true) do source "https://rubygems.org" gem "benchmark-ips" end Benchmark.ips do |x| x.report('+@') { +"" } x.report('dup') { "".dup } x.compare! end ``` ``` $ ruby -v benchmark.rb ruby 2.5.1p57 (2018-03-29 revision 63029) [x86_64-linux] Warming up -------------------------------------- +@ 282.289k i/100ms dup 187.638k i/100ms Calculating ------------------------------------- +@ 6.775M (± 3.6%) i/s - 33.875M in 5.006253s dup 3.320M (± 2.2%) i/s - 16.700M in 5.032125s Comparison: +@: 6775299.3 i/s dup: 3320400.7 i/s - 2.04x slower ```
* Fix obsoleted method URI.unescape in activesupport/testVitor Oliveira2018-08-151-1/+1
|
* e4e1b62 broke `to_param` handling:Edouard CHIN2018-07-121-0/+14
| | | | | | | | | | | | | | | | | | | - There was an issue inside controller tests where order params were not respected, the reason was because we were calling `Hash#to_query` which sorts the results lexicographically. 1e4e1b62 fixed that issue by not using `to_query` but instead a utility function provided by rack. - However with the fix came another issue where it's now no longer possible to do this ``` post :foo, params: { user: User.first } # Prior to the patch the controller will receive { "user" => "1" } # Whereas now you get { "user": "#<User: ...>" } ``` The fix in this PR is to modify `Hash#to_query` to sort only when it doesn't contain an array structure that looks something like "bar[]" Ref https://github.com/rails/rails/pull/33341#issuecomment-404039396
* Fix `CustomCops/AssertNot` to allow it to have failure messageRyuta Kamizono2018-05-131-1/+1
| | | | Follow up of #32605.
* Replace `assert !` with `assert_not`Daniel Colson2018-04-193-13/+13
| | | | | This autocorrects the violations after adding a custom cop in 3305c78dcd.
* Use try in tests that try to test try.Kasper Timm Hansen2018-03-211-7/+2
|
* Rails 6 requires Ruby 2.4.1+Jeremy Daer2018-02-171-7/+1
| | | | | | Skipping over 2.4.0 to sidestep the `"symbol_from_string".to_sym.dup` bug. References #32028
* Use respond_to test helpersDaniel Colson2018-01-251-4/+4
|
* 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.
* | Suppress `warning: BigDecimal.new is deprecated`Yasuo Honda2017-12-151-4/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | `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.
* | These strings should already be frozen where ruby accepts the magic-commentAkira Matsuda2017-11-151-2/+2
|/
* [Active Support] `rubocop -a --only Layout/EmptyLineAfterMagicComment`Koichi ITO2017-07-1111-0/+11
|
* Use frozen-string-literal in ActiveSupportKir Shatrov2017-07-0911-0/+11
|
* Revert "Merge pull request #29540 from kirs/rubocop-frozen-string"Matthew Draper2017-07-0211-11/+0
| | | | | This reverts commit 3420a14590c0e6915d8b6c242887f74adb4120f9, reversing changes made to afb66a5a598ce4ac74ad84b125a5abf046dcf5aa.
* Enforce frozen string in RubocopKir Shatrov2017-07-0111-0/+11
|
* Fix duplicable? for Ratiional and Complex on ruby master, since they are now ↵Vipul A M2017-03-231-1/+4
| | | | duplicable
* Add Time#blank? to blank_testkenta-s2017-02-121-1/+1
|
* Uninterned Symbol can be duped since ruby 2.4.1Akira Matsuda2017-01-261-1/+4
| | | | | | https://github.com/ruby/ruby/commit/11e6bd5ac2a2eebfa589bd6db8c9c4daa337733e Leaving the 2.4.0 conditional for now, in order never to forget backporting r57407 to 2.4.1
* Give a message to `#test_duplicable` assertionyui-knk2017-01-251-1/+1
| | | | | Giving a message helps us to know what happened when we look at Travis CI.
* Fix style guide violationsRafael Mendonça França2017-01-051-1/+1
|
* Fix Symbol#duplicable? for Ruby 2.4.0.Kasper Timm Hansen2017-01-011-2/+2
| | | | | | | | | | | | | Ruby 2.4.0 has trouble duplicating certain symbols created from strings via `to_sym`. It didn't happen with `'symbol'.to_sym.dup` for some reason, but works fine with the longer string sample. Once a newer Ruby version with a fix is released we'll get have a failing test case we can fix. Ref: #27532
* "Use assert_nil if expecting nil. This will fail in minitest 6."Akira Matsuda2016-12-252-5/+5
|
* Fix Complex and Rational are duplicable?utilum2016-12-211-2/+2
| | | | See [this test](https://gist.github.com/utilum/78918f1b64f8b61ee732cb266db7c43a).
* change return value of `duplicable?` with Ruby 2.4+yuuji.yaginuma2016-12-131-2/+7
| | | | | | | `NilClass`, `FalseClass`, `TrueClass`, `Symbol` and `Numeric` can dup with Ruby 2.4+. Ref: https://bugs.ruby-lang.org/issues/12979
* :nail_care:Akira Matsuda2016-12-131-2/+1
|
* nil, true, 1, etc. don't raise on #dup since Ruby 2.4Akira Matsuda2016-12-131-1/+1
| | | | https://bugs.ruby-lang.org/issues/12979
* Add more rubocop rules about whitespacesRafael Mendonça França2016-10-292-4/+4
|
* Add three new rubocop rulesRafael Mendonça França2016-08-162-5/+5
| | | | | | | | Style/SpaceBeforeBlockBraces Style/SpaceInsideBlockBraces Style/SpaceInsideHashLiteralBraces Fix all violations in the repository.
* applies remaining conventions across the projectXavier Noria2016-08-061-2/+0
|
* normalizes indentation and whitespace across the projectXavier Noria2016-08-061-2/+2
|
* remove redundant curlies from hash argumentsXavier Noria2016-08-061-5/+5
|
* modernizes hash syntax in activesupportXavier Noria2016-08-062-9/+9
|
* applies new string literal convention in activesupport/testXavier Noria2016-08-0611-88/+88
| | | | | The current code base is not uniform. After some discussion, we have chosen to go with double quotes by default.
* Revert "Adds `not_in?` onto Object"David Heinemeier Hansson2016-07-291-53/+0
|
* Adds `not_in?` onto ObjectJon McCartie2016-07-211-0/+53
|
* Support for unified Integer class in Ruby 2.4+Jeremy Daer2016-05-181-1/+1
| | | | | | | | Ruby 2.4 unifies Fixnum and Bignum into Integer: https://bugs.ruby-lang.org/issues/12005 * Forward compat with new unified Integer class in Ruby 2.4+. * Backward compat with separate Fixnum/Bignum in Ruby 2.2 & 2.3. * Drops needless Fixnum distinction in docs, preferring Integer.
* Fix some typos in comments.Joe Rafaniello2016-05-041-1/+1
| | | | [ci skip]
* :hocho: TyposAkira Matsuda2015-09-211-1/+1
|
* :scissors: empty line at the top of filesAkira Matsuda2015-09-211-1/+0
|
* Expand coverage of JSON gem testsGodfrey Chan2015-07-111-16/+30
|
* Add tests to ensure we don't interfere with json gem's outputGodfrey Chan2015-07-111-0/+52
|
* Small stylistic tweaks for `Delegator#try` patchGodfrey Chan2015-05-191-15/+15
| | | | | | * Rename `ActiveSupport::Try` => `ActiveSupport::Tryable` * Include the modules inline * `private` indentation