aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/test/core_ext/string_ext_test.rb
Commit message (Collapse)AuthorAgeFilesLines
* 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
| * Improve String#squish whitespaces matchingAntoine Lyset2013-01-221-3/+4
| |
* | Use Encoding::UTF_8 constant :do_not_litter:Akira Matsuda2013-01-281-2/+2
| |
* | Fix some wrong String extensions testsAkira Matsuda2013-01-231-7/+9
| | | | | | | | | | | | * ASCII_STRING was not an ASCII String * BYTE_STRING was not an in valid UTF-8 String * added an assertion for non-UTF-8 String
* | Test String#dasherizeAkira Matsuda2013-01-231-0/+6
|/
* Use `DateTime.parse` inside `String#to_datetime`Andrew White2013-01-211-0/+6
| | | | | | | | | | Use the standard library's `DateTime.parse` because it's marginally faster and supports partial date/time strings. Benchmark: user system total real old 3.980000 0.000000 3.980000 ( 3.987606) new 3.640000 0.010000 3.650000 ( 3.641342)
* Standardise the return value of `to_time`Andrew White2013-01-211-8/+39
| | | | | | | | | | | | | | | | | | | | | | This commit standardises the return value of `to_time` to an instance of `Time` in the local system timezone, matching the Ruby core and standard library behavior. The default form for `String#to_time` has been changed from :utc to :local but research seems to suggest the latter is the more common form. Also fix an edge condition with `String#to_time` where the string has a timezone offset in it and the mode is :local. e.g: # Before: >> "2000-01-01 00:00:00 -0500".to_time(:local) => 2000-01-01 05:00:00 -0500 # After: >> "2000-01-01 00:00:00 -0500".to_time(:local) => 2000-01-01 00:00:00 -0500 Closes #2453
* Better error message for String#to_dateKelly Stannard2013-01-041-0/+1
| | | | | | | | | | I did this because to_date gives a very unhelpful error message if you do not pass in a correct date. In the process I think this cleans up the code nicely and even better it tends to be slightly faster than the current implementation. Benchmark https://gist.github.com/4440875
* Deprecate obsolete Time to DateTime fallback methodsAndrew White2012-12-111-1/+1
| | | | | | | The Time.time_with_datetime_fallback, Time.utc_time and Time.local_time methods were added to handle the limitations of Ruby's native Time implementation. Those limitations no longer apply so we are deprecating them in 4.0 and they will be removed in 4.1.
* Beef up tests for String#in_time_zone and Date#in_time_zoneAndrew White2012-12-111-18/+0
|
* Add String#in_time_zone methodAndrew White2012-12-111-24/+44
| | | | | | This commit adds a convenience method for converting a string to an ActiveSupport::TimeWithZone instance using the configured Time.zone or another passed as an argument.
* &#39 dates back to SGML when &#x27 was introduced in HTML 4.0Kalys Osmonov2012-09-091-1/+1
|
* defines String#indent [closes #7263] [Xavier Noria & Ace Suares]Xavier Noria2012-08-071-0/+56
|
* html_escape should escape single quotesSantiago Pastorino2012-07-311-2/+2
| | | | | https://www.owasp.org/index.php/XSS_%28Cross_Site_Scripting%29_Prevention_Cheat_Sheet#RULE_.231_-_HTML_Escape_Before_Inserting_Untrusted_Data_into_HTML_Element_Content Closes #7215
* Truncate now has the ability to receive a html option that allows it to call ↵Li Ellis Gallardo2012-05-261-0/+4
| | | | | | | | | | | | rails helpers. This way if my text is long I don't have to do something like this: .text = truncate(@text, :length => 27) if @text.size >= 27 = link_to "continue", notes_path, ....."")
* Fix warning: possibly useless use of % in void contextkennyj2012-05-191-1/+1
|
* doesn't modify params in SafeBuffer#%Vasiliy Ermolovich2012-05-181-0/+7
|
* fix safe string interpolation with SafeBuffer#%, closes #6352Vasiliy Ermolovich2012-05-161-0/+24
|
* Tests for regexp separator in String#truncateAlexey Gaziev2012-04-291-0/+6
| | | | https://github.com/rails/rails/commit/5a7513593f64e0ff7e4de1ee37bac5eeddfae270
* use AS::TestCase as the base classAaron Patterson2012-01-051-2/+2
|
* deprecate String#encoding_aware? and remove its usageSergey Nartimov2011-12-241-1/+3
|
* Initial pass at removing dead 1.8.x code from Active Support.José Valim2011-12-201-44/+6
| | | | | | There are a bunch of other implicit branches that adds 1.8.x specific code that still needs to be removed. Pull requests for those cases are welcome.
* Restore performance of ERB::Util.html_escapeJon Jensen2011-12-031-6/+17
| | | | | | | Revert html_escape to do a single gsub again, but add the "n" flag (no language, i.e. not multi-byte) to protect against XSS via invalid utf8 Signed-off-by: José Valim <jose.valim@gmail.com>
* defines Module#qualified_const_(defined?|get|set) and String#deconstantizeXavier Noria2011-10-291-0/+4
| | | | | | | | | | This commit also implements a faster version of #demodulize I was unable to isolate with git add --patch. Not a big fan of the name #deconstantize. It complements #demodulize getting rid of the rightmost constant, hence the name, but it is unrelated to the well-known #constantize. So unsure. Could not come with anything better, please feel free to rename.
* Modified String#pluralize to take an optional count parameter.Ryan Oblak2011-09-281-4/+8
|
* Added ActiveSupport::Inflector.safe_constantize and String#safe_constantize; ↵Ryan Oblak2011-09-231-1/+22
| | | | refactored common constantize tests into ConstantizeTestCases
* properly escape html to avoid invalid utf8 causing XSS attacksAaron Patterson2011-08-161-0/+7
|
* Removing extra requires from the test. Already loaded in abstract_unit.Arun Agrawal2011-07-311-1/+0
|
* Changed the year of a date used in a test which fails when using 1.8.7 on a ↵Josh Kalderimis2011-07-191-1/+1
| | | | 32bit machine (ArgumentError: time out of range)
* Merge pull request #1463 from psanford/masterSantiago Pastorino2011-07-061-0/+1
|\ | | | | Fix timezone handling in String.to_time
| * Make String.to_time respect timezonesNate Mueller2011-06-021-0/+1
| |
* | all numerics should be html_safe - Closes #1935Damien Mathieu2011-07-031-0/+4
| |
* | Define ActiveSupport#to_param as to_str - closes #1663Andrew White2011-06-121-1/+7
|/
* Revert "Merge pull request #275 from pk-amooma/master"José Valim2011-05-071-12/+0
| | | | | | | Several AP tests fail after this change. This reverts commit aaf01cd53718c8aa5b69ac056b997e6dd9893777, reversing changes made to 9cc18c52faeebaad6a76bd62cdca1c6b9f96afed.
* Merge pull request #275 from pk-amooma/masterJosé Valim2011-05-071-0/+12
|\ | | | | properly escape "'" to "'" for XML
| * test "Escapes special HTML/XML characters" do ...Philipp Kempgen2011-04-261-0/+12
| |
* | Merge remote branch 'rolftimmermans/desc_tracker'José Valim2011-05-071-0/+1
|\ \
| * | Add missing dependency string inflection test.Rolf Timmermans2011-03-131-0/+1
| |/
* / Add String#inquiry as a convenience method for turning a string into a ↵David Heinemeier Hansson2011-04-181-0/+5
|/ | | | StringInquirer object [DHH]
* removes orphan tests, custom String#% was removed from AS in 39d6f9eXavier Noria2010-11-191-69/+0
|
* let String#strip_heredoc handle blank lines even if they are not indentedXavier Noria2010-08-301-0/+9
|
* implements String#strip_heredocXavier Noria2010-08-291-0/+23
|
* Deletes trailing whitespaces (over text files only find * -type f -exec sed ↵Santiago Pastorino2010-08-141-1/+1
| | | | 's/[ \t]*$//' -i {} \;)
* Added getbyte as a core_ext to Ruby < 1.9Santiago Pastorino2010-06-271-0/+8
| | | | Signed-off-by: José Valim <jose.valim@gmail.com>