aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/test/inflector_test_cases.rb
Commit message (Collapse)AuthorAgeFilesLines
* Fixed typo in test for activesupport parameterizePierre Hedkvist2017-11-011-1/+1
|
* [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.
* Enforce frozen string in RubocopKir Shatrov2017-07-011-0/+1
|
* Merge pull request #28480 from ↵Rafael Mendonça França2017-03-281-0/+15
|\ | | | | | | | | | | 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/+15
| | | | | | | | | | | | | | | | | | | | | | | | 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.
* | Update `titlelize` regex to allow apostrophesAndrew White2017-03-061-0/+1
|/ | | | | | | | | | | | | | | In 4b685aa the regex in `titlelize` was updated to not match apostrophes to better reflect the nature of the transformation. Unfortunately this had the side effect of breaking capitalization on the first word of a sub-string, e.g: >> "This was 'fake news'".titleize => "This Was 'fake News'" This is fixed by extending the look-behind to also check for a word character on the other side of the apostrophe. Fixes #28312.
* Add more rubocop rules about whitespacesRafael Mendonça França2016-10-291-1/+1
|
* normalizes indentation and whitespace across the projectXavier Noria2016-08-061-18/+18
|
* modernizes hash syntax in activesupportXavier Noria2016-08-061-4/+4
|
* applies new string literal convention in activesupport/testXavier Noria2016-08-061-25/+25
| | | | | The current code base is not uniform. After some discussion, we have chosen to go with double quotes by default.
* Merge pull request #19428 from bdmac/fix_safe_buffer_titleizeRafael Mendonça França2016-05-181-1/+2
|\ | | | | | | Fixes Inflector#titleize to work with SafeBuffer
| * Fixes Inflector#titleize to work with SafeBufferBrian McManus2015-03-201-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The way Inflector#titleize was implemented did not work properly when called on a SafeBuffer object. Using the global `$&` variable in the gsub resulted in calling capitalize on a nil object for reasons I still do not fully understand. Removing the UNSAFE_STRING_METHODS override for the gsub method in SafeBuffer "fixed" the bug but is obviously unacceptable. An example of this is very easy to see in rails console: ActiveSupport::SafeBuffer.new("my test").titleize > NoMethodError: undefined method `capitalize' for nil:NilClass Using the non global version of gsub with a |match| arg passed to the block fixes the problem. Again I do not quite understand why. I noticed that other parts of Inflector were already using the standard block arg version of gsub so I don't think it should be a problem to convert this method to using it as well.
* | Parameterize with options to preserve case of stringSwaathi K2015-11-071-0/+34
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* | :scissors: empty line at the top of filesAkira Matsuda2015-09-211-1/+0
|/
* Removed magic comments # encoding: utf-8 , since its default from ruby 2.0 ↵Vipul A M2015-02-031-1/+0
| | | | onwards.
* Fix for inflector's incorrect camelCase replacement for acronymsMatthew Draper2014-09-061-0/+1
| | | | | | Fixes #8015, #9756. [Fred Wu & Matthew Draper]
* several enhancements to humanize [closes #12288]Xavier Noria2014-05-061-3/+5
| | | | | | | | | | * Strips leading underscores. * Changes some unnecessary gsub!s to sub!s. * Replaces some anchors ^, $ with \A, \z. * Documents that human inflection rules are applied. * Documents that words are downcased except acronyms. * Adds an example with an acronym. * Rewords docs.
* Add a comment to ensure that a test won't be removed [ci skip]Robin Dupret2014-03-031-1/+1
| | | | | | The 'cow' => 'kine' inflection has gone with c300dca9 but it should not be removed from the tested irregularities since it ensures that inflections work with words that do not begin with the same letters.
* wrap test that changes inflections in with_dupLihan Li2013-11-281-0/+1
|
* Add +capitalize+ option to Inflector.humanizeclaudiob2013-11-061-0/+6
| | | | | | | So strings can be humanized without being capitalized: 'employee_salary'.humanize # => "Employee salary" 'employee_salary'.humanize(capitalize: false) # => "employee salary"
* Don't mutate the original inflections instance in the testsAndrew White2013-07-301-1/+0
|
* Inflector irregular singularize rulesJuanjo Bazán2013-01-011-0/+1
|
* Adds missing inflector tests to ensure idempotencyGodfrey Chan2012-06-211-0/+2
| | | | | | | | | | | | | This is a follow up to #4719. It appears that singularize and pluralize are supposed to be idempotent - i.e. when you call singularize or pluralize multiple times on the same string, you should get the same result. (At least for the "officially supported" cases that the stock inflector is designed to handle.) #4719 added the missing tests for regular cases, and this commit added the missing tests for the irregularities. While I'm at that, I also synced up the irregularity test cases with the current set of irregularity cases that we ship out-of-the-box.
* Fix an issue with inflection where my_analyses (in plular form) incorrectly ↵Anuj Dutta2012-05-161-0/+1
| | | | converted to my_analyasis(in singular form).
* Merge pull request #5177 from cap10morgan/fix-gh-issue-4374José Valim2012-04-301-1/+3
|\ | | | | fix inflector bug where -ice gets singularized into -ouse
| * fix inflector bug where -ice gets pluralized into -ouseWes Morgan2012-02-251-1/+3
| | | | | | | | This should happen for mouse or louse, but not slice or pumice.
* | adds a new test case for titleizeXavier Noria2012-04-081-0/+1
| |
* | revises the regexp used in titleizeXavier Noria2012-04-071-12/+15
| | | | | | | | | | | | | | | | | | The regexp used in titleize matches saxon genitive and other contractions, only to call capitalize on the captured text and have the apostrophe upcased which yields the apostrophe itself. It is more clear that the regexp matches just what it has to match.
* | String#titleize works properly with smart quotes, closes #5584Vasiliy Ermolovich2012-03-261-1/+3
|/
* fixes a regression introduced by 532cd4, and a bogus test in AP the ↵Xavier Noria2012-02-101-0/+1
| | | | regression uncovered
* Fix inflection regexes for mouse, miceMark Rushakoff2011-12-071-1/+5
|
* Added the test case for #3537Pavan Kumar Sunkara2011-11-061-0/+1
|
* Revert removing gsub and sub from safe buffer.José Valim2011-09-081-0/+7
|
* remove support of symbols on classify and camelizeDamien Mathieu2011-09-081-7/+0
|
* StringToParameterizeWithNoSeparator: dashed parameter will notArun Agrawal2011-06-251-1/+1
| | | change.
* Test retain delimiter in parameterization inflectorDavid Lee2011-06-111-0/+3
|
* ordinalize negative numbers patchJason2011-05-071-0/+30
| | | | | | | Applied patch by Amir Manji https://github.com/rails/rails/issues/437#issuecomment-1116045 Signed-off-by: Jason <jasonmichaelroth@gmail.com>
* handle double pluralization for irregular pluralsDan Pickett2011-02-161-0/+1
| | | | | | [#6363] Signed-off-by: Santiago Pastorino <santiago@wyeworks.com>
* Improve reliability of Inflector.transliterate. [#4374 state:resolved]Norman Clarke2010-04-121-1/+4
| | | | Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
* Changed the way inflections for uncountables work for 'funky jeans' [#3576 ↵Rolf Bjaanes2010-04-051-0/+2
| | | | | | state:resolved] Signed-off-by: José Valim <jose.valim@gmail.com>
* Parameterize should accept malformed utf8 characters [#4323 state:resolved]Kristopher Murata2010-04-041-4/+8
| | | | Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
* Any reason we can't just use the slow 1.8 path for transliteration in 1.9?wycats2010-03-171-12/+4
|
* Removed the + sign as an accepted character from the parameterize method, as ↵Stijn Mathysen2010-03-051-3/+6
| | | | | | | | a + sign is interpreted by the browser as a space, possibly resulting in a "ArgumentError: illegal character in key" [#4080 state:committed] Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
* ensure Inflector.camelize works with symbols [#2856 state:resolved]Yehuda Katz + Carl Lerche2009-07-011-0/+7
| | | Signed-off-by: Yehuda Katz + Carl Lerche <ykatz+clerche@engineyard.com>
* Allow String#parameterize to accept a separator [#2157 state:resolved]Sam Granieri2009-03-071-0/+16
| | | | Signed-off-by: Pratik Naik <pratiknaik@gmail.com>
* Adding inflection of databases (usually we wouldn't amend the current ↵Jiri Zajpt2009-02-121-1/+2
| | | | | | defaults, but this seems to obvious) [#1942 state:committed] Signed-off-by: David Heinemeier Hansson <david@loudthinking.com>
* Ruby 1.9 compat: no Unicode normalization support yetJeremy Kemper2008-11-261-2/+13
|
* Mark utf-8 source encodingJeremy Kemper2008-10-061-0/+2
|