aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/test
Commit message (Collapse)AuthorAgeFilesLines
* Add test to cover increment/decrement of non-existing key in MemCacheStoreGuillermo Iguaran2012-08-171-0/+2
|
* Replace deprecated `memcache-client` gem with `dalli` in ↵Guillermo Iguaran2012-08-172-9/+9
| | | | | | ActiveSupport::Cache::MemCacheStore memcache-client was deprecated in favour of dalli in 2010.
* Evented notifications take priority over Timed notificationsEric Saxby2012-08-111-0/+20
| | | | | | | In cases where a notification subscriber includes methods to support both Evented and Timed events, Evented should take priority over Timed. This allows subscribers to be backwards compatible (older Rails only allows Timed events) while defaulting to newer behavior.
* Ensure I18n format values always have precedence over defaultsCarlos Antonio da Silva2012-08-112-1/+7
| | | | | | | | | | | | | | | | | | | Always merge I18n format values, namespaced or not, over the default ones, to ensure I18n format defaults will have precedence over our namespaced values. Precedence should happen like this: default :format default :namespace :format i18n :format i18n :namespace :format Because we cannot allow our namespaced default to override a I18n :format config - ie precision in I18n :format should always have higher precedence than our default precision for a particular :namespace. Also simplify default format options logic.
* Fallback to :en locale instead of handling a constant with defaultsCarlos Antonio da Silva2012-08-112-3/+38
| | | | | | | | Action Pack already comes with a default locale fine for :en, that is always loaded. We can just fallback to this locale for defaults, if values for the current locale cannot be found. Closes #4420, #2802, #2890.
* Deprecate ActiveSupport::JSON::VariableErich Menge2012-08-071-0/+7
| | | | | | | | | | Reason: ActiveSupport::JSON::Variable is not used anymore internally. It was deprecated in 3-2-stable but we reverted all the deprecation for point releases. See #6536 and #6546. Conflicts: activesupport/lib/active_support/json/variable.rb
* defines String#indent [closes #7263] [Xavier Noria & Ace Suares]Xavier Noria2012-08-071-0/+56
|
* Merge pull request #7272 from lexmag/string_inquirerRafael Mendonça França2012-08-061-3/+11
|\ | | | | Add AS::StringInquirer#respond_to? method
| * Add AS::StringInquirer#respond_to? methodAleksey Magusev2012-08-061-3/+11
| | | | | | | | Consistently with #method_missing
* | removes usage of Object#in? from the code base (the method remains defined ↵Xavier Noria2012-08-061-2/+1
|/ | | | | | | | | | | | | | | | | | | by Active Support) Selecting which key extensions to include in active_support/rails made apparent the systematic usage of Object#in? in the code base. After some discussion in https://github.com/rails/rails/commit/5ea6b0df9a36d033f21b52049426257a4637028d we decided to remove it and use plain Ruby, which seems enough for this particular idiom. In this commit the refactor has been made case by case. Sometimes include? is the natural alternative, others a simple || is the way you actually spell the condition in your head, others a case statement seems more appropriate. I have chosen the one I liked the most in each case.
* 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
* Make ActiveSupport::Inflector locale aware and multilingualDavid Celis2012-07-301-1/+30
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The Inflector is currently not very supportive of internationalized websites. If a user wants to singularize and/or pluralize words based on any locale other than English, they must define each case in locale files. Rather than create large locale files with mappings between singular and plural words, why not allow the Inflector to accept a locale? This patch makes ActiveSupport::Inflector locale aware and uses `:en`` unless otherwise specified. Users will still be provided a list of English (:en) inflections, but they may additionally define inflection rules for other locales. Each list is kept separately and permanently. There is no reason to limit users to one list of inflections: ActiveSupport::Inflector.inflections(:es) do |inflect| inflect.plural(/$/, 's') inflect.plural(/([^aeéiou])$/i, '\1es') inflect.plural(/([aeiou]s)$/i, '\1') inflect.plural(/z$/i, 'ces') inflect.plural(/á([sn])$/i, 'a\1es') inflect.plural(/é([sn])$/i, 'e\1es') inflect.plural(/í([sn])$/i, 'i\1es') inflect.plural(/ó([sn])$/i, 'o\1es') inflect.plural(/ú([sn])$/i, 'u\1es') inflect.singular(/s$/, '') inflect.singular(/es$/, '') inflect.irregular('el', 'los') end 'ley'.pluralize(:es) # => "leyes" 'ley'.pluralize(:en) # => "leys" 'avión'.pluralize(:es) # => "aviones" 'avión'.pluralize(:en) # => "avións" A multilingual Inflector should be of use to anybody that is tasked with internationalizing their Rails application. Signed-off-by: David Celis <david@davidcelis.com>
* Don't test language-level exception messagesJohn Firebaugh2012-07-271-5/+1
| | | | | | Ruby implementations should be free to produce exception messages that are not identical to MRI. For example, Rubinius produces 'Expected an even number, got 5'.
* Add Object#try! with the old NoMethodError raising behaviorDavid Heinemeier Hansson2012-07-271-1/+25
|
* will now return nil instead of raise a NoMethodError if the receiving ↵David Heinemeier Hansson2012-07-271-4/+4
| | | | object does not implement the method
* Revert "Merge pull request #7084 from LTe/logger_default_separator"Aaron Patterson2012-07-181-13/+2
| | | | | This reverts commit c08f30ff5fcda7e07cd9275a073acb2091e4b3f7, reversing changes made to e243a8a32eb4c8777f07ca4b974bd7e38d9477d3.
* Don't use default separatorPiotr Niełacny2012-07-181-2/+13
| | | | When the default separator is set logger will create incorrect output
* Fix class_eval without __FILE__ and __LINE__.kennyj2012-07-181-1/+1
|
* remove duplicate requires of mocha.Aaron Patterson2012-07-031-2/+0
| | | | | Mocha is already required by AS::TestCase, so remove the duplicate requires.
* Improve performance of DateTime#seconds_since_unix_epochAndrew White2012-07-021-0/+1
| | | | | | | | | | | | | | | | | | | Calculate the seconds since the UNIX epoch using the difference in Julian day numbers from the epoch date. By reducing the Rational math to just the offset component this gives a significant improvement. Benchmark: Calculating -------------------------------------------- new 27733 i/100ms current 15031 i/100ms new 27737 i/100ms current 15549 i/100ms -------------------------------------------------------- new 548182.1 (±0.9%) i/s - 2745567 in 5.008943s current 216380.9 (±1.6%) i/s - 1082232 in 5.002781s new 510281.9 (±1.2%) i/s - 2551804 in 5.001525s current 219858.3 (±1.8%) i/s - 1103979 in 5.023039s
* Make Time#change work with offsets other than UTC or localAndrew White2012-07-011-0/+31
| | | | | Use Time.new to create times where the current offset is not zero or not in the local time zone - closes #4847 and #6651.
* Fix failing test in file update checkerCarlos Antonio da Silva2012-06-291-2/+3
| | | | | | | | Introduced in 1abe31670fdad2c357b4356b40a4567a46d16693 The test was failing when running on isolation, because the extensions were not being loaded, thus 1.year.from_now was failing. Just use mktime instead, adding 1 year to Time.now.
* fix FileUpdateChecker when file has wrong mtime (from future)abonec2012-06-291-0/+14
|
* Ensure Array#to_sentence does not modify given hashCarlos Antonio da Silva2012-06-262-0/+11
| | | | | Also simplify I18n logic for Array#to_sentence, doing only one lookup for all keys and using merge!, instead of one lookup for each option key.
* Get rid of the clear_i18n hack by using a different localeCarlos Antonio da Silva2012-06-241-20/+10
| | | | | Use a different and very specific locale for testing currency negative format, and an empty store for currency defaults.
* Move number helper i18n related tests to ASCarlos Antonio da Silva2012-06-241-0/+124
| | | | | They also make more sense here since all the related logic with I18n is handled by AS::NumberHelper, and not by AV anymore.
* Adds missing inflector tests to ensure idempotencyGodfrey Chan2012-06-212-0/+12
| | | | | | | | | | | | | 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.
* Add prev_quarter and next_quarter method in Time/Date/DateTimeparanoiase Kang2012-06-203-0/+37
|
* Remove extra test case.Mike Gehard2012-06-191-7/+4
| | | | Make the test description better reflect what is happening
* Fix lookup on HashWithIndifferentAccess for array values.Chris Zetter2012-06-181-0/+7
|
* make events not use date and time to determine parent_of. fixes #5932タコ焼き仮面2012-06-181-1/+3
|
* raise the same exception in order to keep path infoAaron Patterson2012-06-121-0/+13
| | | | | | Ruby 2.0.0 implements LoadError#path, but newly raised load errors will not contain the path information. Replace the error message, copy blame, and rereaise the same exception object
* Proc always respond_to :bindingAkira Matsuda2012-06-121-43/+39
|
* removes the obsolete require_association method from dependenciesXavier Noria2012-06-101-4/+0
| | | | | | | | This is an obsolete method from the very early days, apparently it was used circa 2004 because STI support was not smart enough. This method is not public interface, and we are heading a major version, so removal seems right.
* Eliminate dependency on Rails::VERSION::STRINGAndrew White2012-06-052-3/+21
| | | | | | To facilitate the use of ActiveSupport::Testing::Performance outside of a Rails application conditionally check for the presence of Rails::VERSION::STRING before including it in the environment string.
* add instance_accessor option to ActiveSupport::Configurable#config_accessorFrancesco Rodriguez2012-06-051-4/+18
| | | | | | | | | | Changes: * Add `instance_accessor` option to opt out of the instance writer and instance reader methods. * Raises a NameError if the name of the attribute is not valid. * Update documentation and tests. * Add CHANGELOG entry in activesupport.
* Reduce warning messages when running Active Support testsAndrew White2012-05-311-2/+3
| | | | Eliminate the warnings generated by redefining methods and constants.
* Merge pull request #6554 from erichmenge/remove-json-variablePiotr Sarnacki2012-05-301-2/+0
|\ | | | | Remove deprecated ActiveSupport::JSON::Variable.
| * Remove deprecated ActiveSupport::JSON::Variable.Erich Menge2012-05-301-2/+0
| |
* | Merge pull request #6541 from ↵Rafael Mendonça França2012-05-301-3/+3
|\ \ | |/ |/| | | | | tjouan/tj/activesupport-fix-tests-requiring-unsafe-umask Make tests pass with umask
| * Make File#atomic_write tests pass with umaskThibault Jouan2012-05-291-3/+3
| | | | | | | | | | | | Assertions on file permissions only pass with some combinations of file create mode and the process file mode creation mask. This mask should be applied on the file create mode before related assertions.
* | True, False, and Nil should be represented in as_json as themselves.Erich Menge2012-05-291-0/+6
|/
* JRuby return different Array for module contents.Arun Agrawal2012-05-291-1/+1
| | | | | Test was failing against JRuby. It loads like [Constant3 Constant1]
* Merge pull request #6525 from freerange/minitest-passthrough-exceptionsJosé Valim2012-05-291-8/+50
|\ | | | | Exceptions like Interrupt & NoMemoryError should not be rescued in tests.
| * Exceptions like Interrupt should not be rescued.James Mead2012-05-281-8/+50
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Neither Test::Unit nor MiniTest rescue exceptions like Interrupt or NoMemoryError, but ActiveSupport::Testing::SetupAndTeardown#run which overrides MiniTest::Unit::TestCase#run rescues them. Rescuing an Interrupt exception is annoying, because it means when you are running a lot of tests e.g. when running one of the rake test tasks, you cannot break out using ctrl-C. Rescuing exceptions like NoMemoryError is foolish, because the most sensible thing to happen is for the process to terminate as soon as possible. This solution probably needs some finessing e.g. I'm not clear whether the assumption is that only MiniTest is supported. Also early versions of MiniTest did not have this behaviour. However, hopefully it's a start. Integrating with Test::Unit & MiniTest has always been a pain. It would be great if both of them provided sensible extension points for the kind of things that both Rails and Mocha want to do.
* | decoupling activesupport performance testing from actionview and adding testsAndrew Mutz2012-05-281-0/+40
|/
* Fix handling of negative zero in number_to_currencyJared Beck2012-05-281-0/+2
|
* Moving NumberHelpers from ActionView to ActiveSupportAndrew Mutz2012-05-273-0/+639
|
* 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 Range#sum optimized versionAlexey Vakhov2012-05-251-0/+5
| | | | | | | | | | | | | | | | | | | | | | At 1bd4d1c67459a91415ee73a8f55d2309c0d62a87 was added Range#sum optimized version for arithmetic progressions. This improvment injected a defect with not integer range boundaries. The defect was fixed by e0adfa82c05f9c975005f102b4bcaebfcd17d241. The second commit really disabled optimization at all because in Ruby integer-valued numbers are instances of Fixnum and Bignum classes. We should #use is_a? (#kind_of?) method instead #instance_of? to check if value is numerical: 1.class # => Fixnum 1.instance_of?(Integer) # => false 1.is_a?(Integer) # => true -100_000_000_000.class # => Bignum -100_000_000_000.instance_of?(Integer) # => false -100_000_000_000.is_a?(Integer) # => true Moreover original implementation of Range#sum has a defect with reverse range boundaries. If the first boundary is less than the second range is empty. Current commit fixes and tests this case too.