aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/test/core_ext
Commit message (Collapse)AuthorAgeFilesLines
* 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]
* Moving NumberHelpers from ActionView to ActiveSupportAndrew Mutz2012-05-272-0/+266
|
* 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.
* Add missing requires for deep_dup and hash ext testCarlos Antonio da Silva2012-05-241-0/+1
|
* Use deep_dup in the deep_transform_keys tests.Rafael Mendonça França2012-05-241-20/+98
| | | | | | | | Using only dup make some tests to not catch up an implementation error because the methods were changing the nested hashes. Related to: https://github.com/rails/rails/commit/541429fbe49b0671adb3842ab1818230d670ef9f#L1R96
* Add Hash#deep_transform_keys and Hash#deep_transform_keys! Also convert ↵Mark McSpadden2012-05-231-1/+16
| | | | deep_*_keys to use deep_transform_keys.
* Adding deep versions of stringify_keys and symbolize_keys (plain and bang) ↵Lucas Húngaro2012-05-231-0/+92
| | | | for nested hashes
* Add Hash#transform_keys and Hash#transform_keys! and refactor *_keys methods ↵Mark McSpadden2012-05-231-0/+15
| | | | to use them.
* changed xml type datetime to dateTime, fixes #6328Angelo capilleri2012-05-231-2/+2
| | | | | | | | | XmlMini define the xml 'datatime', but according to http://www.w3.org/TR/xmlschema-2/#dateTime could be better change this to 'dateTime' with upper case letter 'T. So 'DateTime' and 'Time' are redefined from 'datetime' to 'dateTime' add the changing to the changelog
* Add instance_accessor option to class_attributeAlexey Vakhov2012-05-221-0/+7
|
* Merge pull request #6376 from jgaskins/timestamp-microsecondsJeremy Kemper2012-05-181-1/+3
|\ | | | | Increase numeric-timestamp precision to nanoseconds
| * Increase `AR#cache_key` precision to nanosecondsJamie Gaskins2012-05-191-1/+3
| |
* | Merge pull request #6183 from nashby/fix-issue-6179Jeremy Kemper2012-05-183-33/+49
|\ \ | | | | | | wrap time ranges with timezones
| * | respect nsec in TimeWithZoneVasiliy Ermolovich + Sergey Nartimov2012-05-183-35/+43
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | when we pass fractional usec to Time methods we should use Rational instead of Float because of accuracy problem Time.local(2011,6,12,23,59,59,999999.999).nsec # => 999999998 Time.local(2011,6,12,23,59,59,Rational(999999999, 1000)).nsec # => 999999999
| * | wrap time ranges with timezones, closes #6179Vasiliy Ermolovich2012-05-171-1/+9
| | |
* | | 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
| |/ |/|
* | Remove special cases for duplicable? on Class and ModuleMark McSpadden2012-05-171-2/+2
| |
* | fix safe string interpolation with SafeBuffer#%, closes #6352Vasiliy Ermolovich2012-05-161-0/+24
| |
* | remove useless tests for Range#stepVasiliy Ermolovich2012-05-131-10/+0
| |
* | Remove blockless_step leave all that up to RubySantiago Pastorino2012-05-131-1/+1
| | | | | | | | Closes #6297
* | Merge branch 'master' of github.com:lifo/docrailsVijay Dev2012-05-121-2/+2
|\ \ | | | | | | | | | | | | Conflicts: activesupport/lib/active_support/callbacks.rb
| * | Fix copypaste. [ci skip]Edward Tsech2012-05-111-2/+2
| | |
* | | Object#try can't call private methodsVasiliy Ermolovich2012-05-121-1/+13
| | |
* | | Test Hash#except can receive more than one argument.Edward Tsech2012-05-111-0/+6
|/ /
* | Merge pull request #6064 from gazay/fix_guides_for_as_core_extXavier Noria2012-05-071-0/+12
|\ \ | |/ |/| Fix guides for as core ext
| * Added tests for comparsion operator for RangeAlexey Gaziev2012-05-071-0/+12
| |
* | Keep all methods in object/deep_dupPiotr Sarnacki2012-05-061-2/+1
| |
* | Nice logic for deep_dup in railsAlexey Gaziev2012-05-062-15/+54
| |
* | Merge pull request #6169 from marcandre/respond_to_missingJosé Valim2012-05-051-0/+1
|\ \ | | | | | | Respond to missing
| * | Use respond_to_missing for TimeWithZoneMarc-Andre Lafortune2012-05-051-0/+1
| |/