aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/test/core_ext
Commit message (Collapse)AuthorAgeFilesLines
* Small stylistic tweaks for `Delegator#try` patchGodfrey Chan2015-05-191-15/+15
| | | | | | * Rename `ActiveSupport::Try` => `ActiveSupport::Tryable` * Include the modules inline * `private` indentation
* Patch `Delegator` to work with `#try`Nate Smith2015-05-191-0/+64
| | | | | | | | | | | | `Delegator` inherits from `BasicObject`, which means that it will not have `Object#try` defined. It will then delegate the call to the underlying object, which will not (necessarily) respond to the method defined in the enclosing `Delegator`. This patches `Delegator` with the `#try` method to work around the surprising behaviour. Fixes #5790
* Only define #positive? and #negative? on Ruby 2.2Rafael Mendonça França2015-05-191-6/+78
| | | | | | | The feature was accepted and added to Ruby 2.3+ so we don't need to define it again. See https://bugs.ruby-lang.org/issues/11151
* Merge pull request #20143 from vngrs/move_integer_positive_negative_to_numericRafael Mendonça França2015-05-192-12/+12
|\ | | | | | | Move Integer#positive? and Integer#negative? query methods to Numeric
| * Move Integer#positive? and Integer#negative? query methods to Numeric classMehmet Emin İNAÇ2015-05-132-12/+12
| | | | | | | | By this way Integer, Rational, Float, Fixnum, Bignum classes have the same behaviour
* | remove warning from integer ext testyuuji.yaginuma2015-05-141-2/+2
|/ | | | | | | | | this removes the following warning: ``` test/core_ext/integer_ext_test.rb:34: warning: ambiguous first argument; put parentheses or a space even after `-' operator test/core_ext/integer_ext_test.rb:38: warning: ambiguous first argument; put parentheses or a space even after `-' operator ```
* Add Integer#positive? and Integer#negative? query methods in the vein of ↵David Heinemeier Hansson2015-05-131-0/+12
| | | | Fixnum#zero?
* Put the assertion arguments in the right orderMatthew Draper2015-05-051-1/+1
|
* deep_dup method, remove old key from duplicated hash to avoid unnecessary pairsMehmet Emin İNAÇ2015-05-041-0/+6
|
* Improve ActiveSupport::TimeWithZone conversion to YAMLAndrew White2015-04-221-2/+45
| | | | | | | | | | | Previously when converting AS::TimeWithZone to YAML it would be output as a UTC timestamp. Whilst this preserves the time information accurately it loses the timezone information. This commit changes that so that it is saved along with the time information. It also provides nicer encoding of AS::TimeZone instances themselves which previously embedded all of the data from the TZInfo records. Fixes #9183.
* Make sure Array#to_sentence always returns a StringDavid Cornu2015-03-231-0/+6
|
* Deprecate alias_method_chain in favour of Module#prependKir Shatrov2015-03-221-95/+125
| | | …as discussed #19413
* Merge pull request #19413 from kirs/replace-alias_method_chainRafael Mendonça França2015-03-201-2/+2
|\ | | | | Replace occurences of alias_method_chain with their Module#prepend counterpart
| * Use Module#prepend instead of alias_method_chainKir Shatrov2015-03-201-2/+2
| | | | | | | | | | | | | | Thanks @fbernier for suggestion! <3 At this moment we can use Module#prepend in all all cases except of Range because of the bug [1] in MRI 2.2 [1] https://bugs.ruby-lang.org/issues/10847
* | Test files should be named *_test.rb to be executed via rake taskAkira Matsuda2015-03-201-0/+0
|/
* Revert "Take DST into account when locating TimeZone from Numeric."Andrew White2015-03-091-7/+0
| | | | | | | | | | | | | | | | Reverting this as it's not the implementation that we would like it to be. This is being used inside of ActiveSUpport::TimeZone[] and it's unaware of the context in which to find the timezone period so the timezone found changes depending on whether DST is in effect for the current period. This means that `'2001-01-01'.in_time_zone(-9)` changes from winter/summer even though it's the same date that we're trying to convert. Since finding timezones by numeric offsets is a bit hit and miss we should introduce a new API for finding them which supplies the date context in which we want to search and we should probably also deprecate the finding of timezones via the [] method, though this needs further discussion. This reverts commit 2cc2fa3633edd96773023c6b09d07c7b9d9b841d.
* Take DST into account when locating TimeZone from Numeric.Yasyf Mohamedali2015-03-031-0/+7
| | | | | | When given a specific offset, use the first result found where the total current offset (including any periodic deviations such as DST) from UTC is equal.
* Merge pull request #19173 from robin850/rbx-buildRafael Mendonça França2015-03-021-0/+3
|\ | | | | Improve the Rubinius build
| * Skip the failing tests on Rubinius for nowRobin Dupret2015-03-021-0/+3
| |
* | Move Array#without from Grouping to Access concern and add dedicated test ↵David Heinemeier Hansson2015-03-021-0/+4
|/ | | | (relates to #19157)
* Use include? instead of in? for Enumerable#without.Juanito Fatas2015-03-021-1/+0
| | | | [egilburg]
* Include object inclusion for enumerable test.Juanito Fatas2015-03-021-0/+1
|
* Add Enumerable#withoutTodd Bealmear2015-03-011-0/+7
|
* Merge pull request #19076 from nygrenh/truncate-words-fixRafael Mendonça França2015-02-251-0/+9
|\ | | | | | | Fix a backtracking problem in String#truncate_words
| * Fix a backtracking problem in String#truncate_wordsHenrik Nygren2015-02-251-0/+9
|/ | | | Fixes #19070.
* Revert 88d08f2ec9f89ba431cba8d0c06ac9ebc204bbbbRafael Mendonça França2015-02-111-1/+1
| | | | | | | This caused a performance regression since we were decided to do the nil check in run time not in the load time. See https://github.com/rails/rails/pull/15187#issuecomment-71760058
* Removed magic comments # encoding: utf-8 , since its default from ruby 2.0 ↵Vipul A M2015-02-033-3/+0
| | | | onwards.
* Return value of yielded block in File.atomic_writeIan Ker-Seymer2015-01-281-0/+10
| | | | | | Staying true to Ruby convention, we now return the value of the yielded block from `File.atomic_write {...}`. This mimics the behavior of MRI's `File.open {...}`.
* - Moved hwia frozen value assignment test to hash_ext_test similar to other ↵Vipul A M2015-01-171-0/+8
| | | | | | | tests - Fixed the wrong use of with_indifferent_access on hash in the test which failed for isolated tests - Renamed to appropriately specify what the test does
* Removing :en in favor of I18n.default_locale in duration#inspectDominik Masur2015-01-121-0/+9
| | | | | | | | | | | | | | | | | Hi there, i have an app without english as available locale. So i got an error when we try to inspect something like 1.day. This is done automatically when we use the dalli cache. I would like to change the :en to ::I18n.default_locale to be sure that this is always constant and is an available locale. Tests are all green with this change. Calculating ------------------------------------- :locale => :en 2.024k i/100ms :locale => ::I18n.default_locale 2.236k i/100ms ------------------------------------------------- :locale => :en 25.758k (±26.3%) i/s - 117.392k :locale => ::I18n.default_locale 26.311k (±18.1%) i/s - 127.452k
* Add SecureRandom.base58Guillermo Iguaran2015-01-091-0/+20
|
* Add #prev_day and #next_day as counterparts to #yesterday and #tomorrow for ↵George Claghorn2015-01-061-0/+10
| | | | Date, Time, and DateTime
* Add same_time option to #prev_week and #next_week for Date, Time, and DateTimeGeorge Claghorn2015-01-061-0/+15
|
* Add #on_weekend?, #next_weekday, and #prev_weekday methods to Date, Time, ↵George Claghorn2015-01-061-0/+45
| | | | | | | | | | | | | and DateTime `#on_weekend?` returns true if the receiving date/time falls on a Saturday or Sunday. `#next_weekday` returns a new date/time representing the next day that does not fall on a Saturday or Sunday. `#prev_weekday` returns a new date/time representing the previous day that does not fall on a Saturday or Sunday.
* Remove Struct#to_h backportRafael Mendonça França2015-01-041-10/+0
|
* Remove debugger supportRafael Mendonça França2015-01-041-24/+0
| | | | | bebugger doesn't work with Ruby 2.2 so we don't need to support it anymore
* Remove hack to support BigDecimal in Ruby 1.9claudiob2015-01-041-10/+1
| | | | | Now that Rails requires Ruby >= 2.0, there is no need to check whether `BigDecimal` exists or not.
* Remove deprecated `ActiveSupport::SafeBuffer#prepend`Rafael Mendonça França2015-01-041-10/+0
|
* Remove deprecated methods at `Kernel`.Rafael Mendonça França2015-01-041-47/+0
| | | | `silence_stderr`, `silence_stream`, `capture` and `quietly`.
* Remove deprecated core_ext/big_decimal/yaml_conversions fileRafael Mendonça França2015-01-041-11/+0
|
* Deprecate `MissingSourceFile` in favor of `LoadError`.Rafael Mendonça França2015-01-021-0/+9
| | | | | `MissingSourceFile` was just an alias to `LoadError` and was not being raised inside the framework.
* Merge pull request #8740 from amatsuda/missing_source_fileRafael Mendonça França2015-01-021-24/+0
|\ | | | | | | | | | | | | replace use of MissingSourceFile with LoadError Conflicts: activesupport/test/core_ext/load_error_test.rb
| * replace use of MissingSourceFile with LoadErrorAkira Matsuda2013-01-041-16/+1
| |
* | Remove thread variables backportRafael Mendonça França2015-01-021-75/+0
| | | | | | | | They are already present on Ruby 2.2
* | Merge pull request #16749 from robin850/rbx-name-errorRafael Mendonça França2015-01-021-0/+2
|\ \ | | | | | | Rely on NameError#name instead of its error message
| * | Skip an error message related assertion on RubiniusRobin Dupret2014-10-281-0/+2
| | | | | | | | | | | | | | | | | | Rubinius' error messages don't call `#inspect` on the concerned object while the assertion is here to address a wrong inspection on MRI with time zones so let's keep this test for now on Rubinius.
* | | Removed Object#itself as it's implemented in ruby 2.2Cristian Bica2014-12-291-9/+0
| | |
* | | Pass symbol as an argument instead of a blockErik Michaels-Ober2014-11-294-11/+7
| | |
* | | Merge pull request #17493 from petewest/duration-comparableAaron Patterson2014-11-071-0/+12
|\ \ \ | | | | | | | | Delegate comparison operator to value
| * | | Delegate comparison operator to valuePeter West2014-11-031-0/+12
| | | |