aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/test/core_ext/string_ext_test.rb
Commit message (Collapse)AuthorAgeFilesLines
* 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
* typo fix in test name. [ci skip].Yves Senn2014-01-081-1/+1
|
* `core_ext/string/access.rb` test what we are documenting.Yves Senn2014-01-081-50/+89
| | | | | | | | | | | | | I also extracted the tests from a single bulk method into a separate test-case. The new tests cover the API described in the docs. There are two skipped tests, which are broken as of 2ef1fb2c455ca53a0c1e1768f50824926ce28bd3 * #to with negative Fixnum, position is counted from the end * #from and #to can be combined This was brought to my attention by #13627. Closes #13627.
* Add +capitalize+ option to Inflector.humanizeclaudiob2013-11-061-1/+7
| | | | | | | So strings can be humanized without being capitalized: 'employee_salary'.humanize # => "Employee salary" 'employee_salary'.humanize(capitalize: false) # => "employee salary"
* Removed unused modules and classesAnupam Choudhury2013-09-101-7/+0
|
* Add String#remove(pattern) as a short-hand for the common pattern of ↵David Heinemeier Hansson2013-08-131-0/+5
| | | | String#gsub(pattern, '')
* Remove deprecated `String#encoding_aware?` Arun Agrawal2013-07-031-6/+0
| | | core extensions (`core_ext/string/encoding`).
* Adjust for daylight savings in String#to_timeAndrew White2013-04-231-2/+118
| | | | | | | | | | | | | | | The changes in b79adc4323 had a bug where if the time in the String was in standard time but the current time was in daylight savings then the calculated adjustment was off by an hour. This commit fixes this and adds extra tests for the following: * time in string is standard time, current time is standard time * time in string is standard time, current time is daylight savings * time in string is daylight savings, current time is standard time * time in string is daylight savings, current time is daylight savings Fixes #10306.
* Fixed tests for returning an instance of `Time` in the local system timezone.Paul Nikitochkin2013-03-101-5/+5
|
* Merge pull request #8830 from antoinelyset/masterXavier Noria2013-01-281-3/+4
|\ | | | | Improve String#squish whitespaces matching