aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/test/core_ext
Commit message (Collapse)AuthorAgeFilesLines
* Alias refute methods to assert_not and perfer assert_not on testsRafael Mendonça França2012-12-311-2/+2
|
* Merge pull request #8471 from kytrinyx/refactor-xml-to-hashSteve Klabnik2012-12-211-1/+1
|\ | | | | WIP Refactor xml conversion to hash
| * Refactor Hash.from_xml.Steve Klabnik + Katrina Owen2012-12-211-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | Three basic refactors in this PR: * We extracted the logic into a method object. We now don't define a tone of extraneous methods on Hash, even if they were private. * Extracted blocks of the case statement into methods that do the work. This makes the logic more clear. * Extracted complicated if clauses into their own query methods. They often have two or three terms, this makes it much easier to see what they _do_. We took care not to refactor too much as to not break anything, and put comments where we suspect tests are missing. We think ActiveSupport::XMLMini might be a good candidate to move to a plugin in the future.
* | Backport thread-local variables from Ruby 2.0Rafael Mendonça França2012-12-111-0/+77
| |
* | Deprecate obsolete Time to DateTime fallback methodsAndrew White2012-12-114-29/+41
| | | | | | | | | | | | | | 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-112-18/+128
| |
* | Deprecate Date#to_time_in_current_zoneAndrew White2012-12-111-0/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | The to_time_in_current_zone method doesn't match the naming of the methods for converting to ActiveSupport::TimeWithZone on Time and DateTime. Since DateTime inherits from Date that has led to confusion with some users using the to_time_in_current_zone method with DateTime instances and having the time part dropped and the UTC offset lost. This commit fixes this by deprecating the old method and adding a new in_time_zone method which matches the naming for DateTime and Time. This should prevent accidently dropping times and UTC offsets when converting DateTime instances to ActiveSupport::TimeWithZone.
* | 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.
* Rename ActiveSupport::BasicObject to ActiveSupport::ProxyObjectFrancesco Rodriguez2012-12-071-2/+2
| | | | | AS::BasicObject is used for proxy classes. Let's give it a less concerning name. Also, it avoids the confusion with Ruby's Basic Object.
* Patched Marshal#load to work with constant autoloading ↵Uriel Katz2012-12-011-0/+124
| | | | (active_support/dependecies.rb) (issue #8167)
* Add #seconds_until_end_of_day to DateTime and TimeOlek Janiszewski2012-11-292-0/+56
|
* Use Integer#div instead of Integer#/ to avoid side effects from mathnMarc-Andre Lafortune2012-11-161-0/+8
|
* backporting Struct#to_h from ruby 2.0Aaron Patterson2012-11-131-0/+10
|
* Test Hash#diff deprecation, also prevent deprecation message in AS testsNikita Afanasenko2012-11-111-1/+3
|
* Kernel#capture replaced by version which can catch output from subprocessesDmitry Vorotilin2012-11-011-0/+2
|
* Fix some assert_raise calls containing messages in Active SupportCarlos Antonio da Silva2012-10-281-6/+13
|
* Implement replace method so key? works correctly.David Graham2012-10-261-0/+12
|
* Revert "remove unnecessary object/conversions file"Xavier Noria2012-10-162-0/+2
| | | | | | | This file is used at least by Active Merchant, its existence is maybe not necessary but no big deal either. This reverts commit ae9b3d7cecd77b9ace38671b183e1a360bf632b6.
* Merge pull request #7007 from Mik-die/hash_extractRafael Mendonça França2012-10-121-1/+25
|\ | | | | make Hash#extract! more symmetric with Hash#slice
| * add more testcases and doc about Hash#extract!Mikhail Dieterle2012-10-081-2/+9
| |
| * make Hash#extract! more symmetric with Hash#sliceMikhail Dieterle2012-10-081-0/+17
| |
* | let (array|hash)/conversions.rb load the extensions in ↵Xavier Noria2012-10-091-2/+0
| | | | | | | | object/to_(param|query).rb
* | adds a missing requireXavier Noria2012-10-091-0/+1
| |
* | adds missing requireXavier Noria2012-10-091-0/+1
| |
* | remove unnecessary object/conversions fileNihad Abbasov2012-10-022-2/+0
|/
* Remove .rb from require sentencesJosé Corcuera Z2012-09-211-1/+1
|
* Merge pull request #7613 from marcandre/delegate_to_classJeremy Kemper2012-09-201-0/+11
|\ | | | | Nice and easy delegation to the class
| * Nice and easy delegation to the classMarc-Andre Lafortune2012-09-111-0/+11
| |
* | Date.beginning_of_week thread local and beginning_of_week application config ↵gregolsen2012-09-181-0/+50
| | | | | | | | option added (default is Monday)
* | Allow passing block to deep_merge and deep_merge!Pranas Kiziela2012-09-131-0/+10
|/ | | | | Hash#merge accepts block that you can use to customize how hash values are merged. This change makes merge and deep_merge compatible.
* &#39 dates back to SGML when &#x27 was introduced in HTML 4.0Kalys Osmonov2012-09-091-1/+1
|
* Fix AS tests due to builder change with nil values / empty stringsCarlos Antonio da Silva2012-09-071-2/+2
| | | | | Check 0180e090ab6cbe66f7b521a0c03e278a0463accd for more reasoning about that.
* Extend HashWithIndifferentAccess#update to take an optional blockLeo Cassarani2012-09-051-0/+23
| | | | | | | | | | | | | When a block is passed into the method, it will be invoked for each duplicated key, with the key in question and the two values as arguments. The value for the duplicated key in the receiver will be set to the return value of the block. This behaviour matches Ruby's long-standing implementation of Hash#update and is intended to provide a more consistent interface. HashWithIndifferentAccess#merge is also affected by the change, as it uses #update internally.
* Merge pull request #7029 from panthomakos/date-and-timeRafael Mendonça França2012-08-254-469/+215
|\ | | | | Refactored common date and time calculations.
| * Refactored common date and time calculations.Pan Thomakos2012-08-044-469/+215
| | | | | | | | | | | | | | | | * Added the `DateAndTime::Calculations` module that is included in Time and Date. It houses common calculations to reduce duplicated code. * Simplified and cleaned-up the calculation code. * Removed duplication in tests by adding a behavior module for shared tests. I also added some missing tests.
* | Fix ActiveSupport tests that depend on run orderFrancesco Rodriguez2012-08-231-11/+18
| |
* | revises a brittle test in Active SupportXavier Noria2012-08-221-1/+1
| | | | | | | | | | | | | | The revised test assumed that the default permissions of a file matched the umask of the process, but in the general case that depends also on the file system. This test was failing in the /vagrant shared folder of Rails development boxes.
* | 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
* 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
* 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.
* Ensure Array#to_sentence does not modify given hashCarlos Antonio da Silva2012-06-261-0/+6
| | | | | 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.
* Add prev_quarter and next_quarter method in Time/Date/DateTimeparanoiase Kang2012-06-203-0/+37
|
* Fix lookup on HashWithIndifferentAccess for array values.Chris Zetter2012-06-181-0/+7
|
* Eliminate dependency on Rails::VERSION::STRINGAndrew White2012-06-051-1/+0
| | | | | | 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.
* Reduce warning messages when running Active Support testsAndrew White2012-05-311-2/+3
| | | | Eliminate the warnings generated by redefining methods and constants.
* 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.
* JRuby return different Array for module contents.Arun Agrawal2012-05-291-1/+1
| | | | | Test was failing against JRuby. It loads like [Constant3 Constant1]