aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/test/core_ext/string_ext_test.rb
Commit message (Collapse)AuthorAgeFilesLines
* Use assert_predicate and assert_not_predicateDaniel Colson2018-01-251-31/+31
|
* Fixed typo in test for activesupport parameterizePierre Hedkvist2017-11-011-1/+1
|
* Update String#camelize to provide feedback when wrong option is passedRicardo Díaz2017-08-021-0/+7
| | | | | | | | | String#camelize was returning nil without any feedback when an invalid option was passed as parameter. This update makes the method to raises an ArgumentError when the option passed is invalid, similar to what Ruby does for String#downcase (and others) in 2.4.1. https://ruby-doc.org/core-2.4.1/String.html#method-i-downcase
* [Active Support] `rubocop -a --only Layout/EmptyLineAfterMagicComment`Koichi ITO2017-07-111-0/+1
|
* Use frozen-string-literal in ActiveSupportKir Shatrov2017-07-091-0/+1
|
* Revert "Merge pull request #29540 from kirs/rubocop-frozen-string"Matthew Draper2017-07-021-1/+0
| | | | | This reverts commit 3420a14590c0e6915d8b6c242887f74adb4120f9, reversing changes made to afb66a5a598ce4ac74ad84b125a5abf046dcf5aa.
* Merge pull request #29540 from kirs/rubocop-frozen-stringMatthew Draper2017-07-021-0/+1
|\ | | | | | | Enforce frozen string in Rubocop
| * Enforce frozen string in RubocopKir Shatrov2017-07-011-0/+1
| |
* | Make ActiveSupport frozen string literal friendly.Pat Allan2017-06-201-9/+10
|/ | | | | | | The ActiveSupport test suite only passes currently if it uses the latest unreleased commits for dalli, and a patch for Builder: https://github.com/tenderlove/builder/pull/6 Beyond that, all external dependencies (at least, to the extent they’re used by ActiveSupport) are happy, including Nokogiri as of 1.8.0.
* Merge pull request #28480 from ↵Rafael Mendonça França2017-03-281-0/+12
|\ | | | | | | | | | | mubashirhanif/add_keep_id_suffix_option_to_humanize_new Add keep id suffix option to humanize new
| * Added options hash to titleize method and keep_id_suffix option to humanizeMubashir Hanif2017-03-211-0/+12
| | | | | | | | | | | | | | | | | | | | | | | | some documentation remove extra whitespace. Added id in the middle test case and corrected some testcases. Some Coding standard guidelines corrections as suggested by codeclimate. Some more corrections suggested by codeclimate.
* | Add more missing requiresAndrew White2017-02-221-0/+1
| | | | | | | | Further missing requires for Timeout exposed due to Bundler 1.14.5
* | Reduce string objects by using \ instead of + or << for concatenating stringsAkira Matsuda2017-01-121-1/+1
| | | | | | | | (I personally prefer writing one string in one line no matter how long it is, though)
* | assert_equal takes expectation firstAkira Matsuda2016-12-261-9/+9
| |
* | "Use assert_nil if expecting nil. This will fail in minitest 6."Akira Matsuda2016-12-251-1/+1
|/
* Remove deprecated separator argument from parameterizeAndrew White2016-11-141-16/+0
|
* modernizes hash syntax in activesupportXavier Noria2016-08-061-15/+15
|
* applies new string literal convention in activesupport/testXavier Noria2016-08-061-62/+62
| | | | | The current code base is not uniform. After some discussion, we have chosen to go with double quotes by default.
* Support for unified Integer class in Ruby 2.4+Jeremy Daer2016-05-181-11/+11
| | | | | | | | 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 tests when preserving timezonesAndrew White2016-05-051-4/+11
| | | | | | These two tests are explicitly testing that to_time is returning times with the sytem timezone's UTC offset, therefore they will fail when running them with `ActiveSupport.to_time_preserves_timezone = true`.
* Fix to_yaml test when run individuallyAndrew White2016-05-051-0/+1
| | | | | | | | | The to_yaml method is undefined when running the test as: $ ruby -I lib:test test/core_ext/string_ext_test.rb Doesn't fail when running rake test:isolated presumably because something else has required 'yaml' already.
* Match `String#to_time`'s behaviour to rubySiim Liiser2016-04-041-0/+1
| | | | | | | | Previously `String#to_time` returned the midnight of the current date in some cases where there was no relavant information in the string. Now the method returns `nil` instead in those cases. Fixes #22958.
* Fix method String#upcase_firstbogdanvlviv2016-03-311-0/+8
|
* Add upcase_first methodGlauco Custódio2016-02-251-0/+4
|
* Parameterize with options to preserve case of stringSwaathi K2015-11-071-2/+36
| | | | | | | | | | | | | | | | | | | | | | | | Added test cases Using kwargs instead of three seperate functions Updated parameterize in transliterate.rb Updated parameterize in transliterate.rb Added deprecation warnings and updating RDoc+Guide Misspelled separtor. Fixed. Deprecated test cases and added support to parameterize with keyword parameters Squashing commits. Fixed test cases and added deprecated test cases Small changes to Gemfile.lock and CHANGELOG Update Gemfile.lock
* Handle invalid UTF-8 strings when HTML escapingGrey Baker2015-06-081-2/+8
| | | | | | | Use `ActiveSupport::Multibyte::Unicode.tidy_bytes` to handle invalid UTF-8 strings in `ERB::Util.unwrapped_html_escape` and `ERB::Util.html_escape_once`. Prevents user-entered input passed from a querystring into a form field from causing invalid byte sequence errors.
* Removed mocha stubbing in active_supportRonak Jangir2015-06-071-86/+92
|
* Merge pull request #19076 from nygrenh/truncate-words-fixRafael Mendonça França2015-02-251-0/+9
|\ | | | | | | Fix a backtracking problem in String#truncate_words
| * Fix a backtracking problem in String#truncate_wordsHenrik Nygren2015-02-251-0/+9
|/ | | | Fixes #19070.
* Removed magic comments # encoding: utf-8 , since its default from ruby 2.0 ↵Vipul A M2015-02-031-1/+0
| | | | onwards.
* Remove deprecated `ActiveSupport::SafeBuffer#prepend`Rafael Mendonça França2015-01-041-10/+0
|
* Pass symbol as an argument instead of a blockErik Michaels-Ober2014-11-291-6/+2
|
* added example of squish!, remove, test case for multiple occurrence ofRishi Jain2014-11-061-0/+6
| | | | | | | | pattern removal added example for string#remove and test case for remove of multiple occurence of pattern removed extra whitespaces
* tests, add note about the usage of a specific timezone. Closes #17448.Yves Senn2014-11-051-1/+1
|
* Fix broken string_ext_test due to change in timezonePrathamesh Sonpatki2014-11-051-1/+1
| | | | | - Russian time was changed to UTC+3 from UTC+4 recently. This broke the string_to_ext test.
* Make `String#remove` and `String#remove!` accept multiple argumentsPavel Pravosud2014-10-251-2/+12
|
* As of Unicode 6.3, Mongolian Vowel Separator is not whitespaceMatthew Draper2014-09-151-3/+3
| | | | | Ruby 2.2 knows this, and no longer matches it with [[:space:]], so it's not a good candidate for testing String#squish.
* Expectations firstAkira Matsuda2014-08-181-4/+4
|
* missing activesupport test coverageEugene Gilburg2014-07-191-0/+8
|
* Fix typos in string_ext_test.rb [ci skip]Jon Atack2014-07-161-4/+4
|
* Merge pull request #16190 from oss92/word_truncationMatthew Draper2014-07-171-0/+21
|\ | | | | | | Word truncation
| * Added truncate_words method to activesupport stringsroot2014-07-161-0/+20
|/
* Extract out with_env_tz helper method.Zuhao Wan2014-06-181-8/+4
| | | | | It’s used at so many places that extracting it out into a helper file is worth doing.
* Fix inconsistent behavior from String#pluralizeKuldeep Aggarwal2014-04-191-0/+5
| | | | | | | | | | | Before: When calling String#pluralize with count=1 then it returned same string, but with count other than 1, returned new string. After: String#pluralize always return a new string. => Prevent mutation of a string inadvertently.
* Fix inconsistent behavior from String#first/#lastErnie Miller2014-04-181-0/+12
| | | | | | | While calling String#first or String#last with zero or a Fixnum < the string's length returns a new string, a Fixnum >= the string's length returns the string itself. This inconsistency can lead to inadvertent mutation of a string.
* Move require to actual fileCarlos Antonio da Silva2014-04-021-1/+0
| | | | | Change to require all active_support/deprecation since that's the actual entry point for the deprecation methods.
* Use asert_deprecatedRafael Mendonça França2014-04-021-3/+5
|
* Make AS::SafeBuffer#prepend act like String#prependPavel Pravosud2014-03-311-0/+22
| | | | | | | Make `#prepend` method modify instance in-place and return self instead of just returning modified value. That is exactly what `#prepend!` method was doing previously, so it's deprecated from now on.
* fix interplay of humanize and html_escapeSean Walbran2014-02-051-0/+4
|
* Revert "Speedup String#to"Yves Senn2014-01-081-2/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | This reverts commit 2ef1fb2c455ca53a0c1e1768f50824926ce28bd3. As described in PR #13627 this commit broke functionality when passing a negative Fixnum to the `String#to` method: ```ruby assert_equal "hell", s.to(-2) ``` Before the revert, this failed with: ``` 1) Failure: StringAccessTest#test_#to_with_negative_Fixnum,_position_is_counted_from_the_end [test/core_ext/string_ext_test.rb:275]: Expected: "hell" Actual: nil ``` This revert is to keep the functionality on `master` working. If there is another way to get the performance benefit and keep the documented functionality we can add that. /cc @amatsuda @carlosantoniodasilva