aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/test/core_ext/time_with_zone_test.rb
Commit message (Collapse)AuthorAgeFilesLines
...
* Refactor Date, Time, DateTime timezone methodsGilad Zohari2013-08-011-0/+8
| | | | | | Similar implementations of #in_time_zone exists for Date, Time and DateTime so method is extracted into its own module. Also some logic is extracted into private method.
* Add failing test for #9562Andrew White2013-07-101-0/+5
| | | | | | | | Rails 4.0.0 fails when trying to encode an ActiveSupport::TimeWithZone that wraps a DateTime instance. This is fixed on master so add a test to prevent regression. (cherry picked from commit ad01b8da354268cebfae1519c28d19d75576ccb1)
* Add missing nsec test for 17f5d8eAndrew White2013-06-131-0/+5
|
* Keep sub-second resolution when wrapping a DateTime valueAndrew White2013-06-131-0/+5
| | | | | | | Add `DateTime#usec` and `DateTime#nsec` so that `ActiveSupport::TimeWithZone` keeps sub-second resolution when wrapping a `DateTime` value. Fixes #10855
* Squashed commit of the following:Aaron Patterson2013-05-031-10/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | commit 2683de5da85135e8d9fe48593ff6167db9d64b18 Author: Aaron Patterson <aaron.patterson@gmail.com> Date: Fri May 3 11:29:20 2013 -0700 cannot support infinite ranges right now commit cebb6acef2c3957f975f6db4afd849e535126253 Author: Aaron Patterson <aaron.patterson@gmail.com> Date: Fri May 3 11:26:12 2013 -0700 reverting infinity comparison commit 385f7e6b4efd1bf9b89e8d607fcb13e5b03737ea Author: Aaron Patterson <aaron.patterson@gmail.com> Date: Fri May 3 11:23:28 2013 -0700 Revert "Added ability to compare date/time with infinity" This reverts commit 38f28dca3aa16efd6cc3af6453f2e6b9e9655ec1. Conflicts: activesupport/CHANGELOG.md activesupport/lib/active_support/core_ext/numeric/infinite_comparable.rb activesupport/test/core_ext/date_ext_test.rb activesupport/test/core_ext/date_time_ext_test.rb activesupport/test/core_ext/numeric_ext_test.rb activesupport/test/core_ext/time_ext_test.rb activesupport/test/core_ext/time_with_zone_test.rb commit 0d799a188dc12b18267fc8421675729917610047 Author: Aaron Patterson <aaron.patterson@gmail.com> Date: Fri May 3 11:18:53 2013 -0700 Revert "Refactor infinite comparable definition a bit" This reverts commit dd3360e05e4909f2f0c74a624cccc2def688f828. commit 42dec90e49745bbfae546f0560b8783f6b48b074 Author: Aaron Patterson <aaron.patterson@gmail.com> Date: Fri May 3 11:18:47 2013 -0700 Revert "Require 'active_support/core_ext/module/aliasing' in the infinite_comparable module" This reverts commit 7003e71c13c53ec3d34250560fbf80b8381df693.
* `TimeWithZone` raises `NoMethodError` in proper context.Yves Senn2013-03-181-0/+8
| | | | | | | | | Closes #9772. `TimeWithZone` delegates everything to the wrapped `Time` object using `method_missing`. The result is that `NoMethodError` error will be raised in the context of `Time` which leads to a misleading debug output.
* Added `ActiveSupport::TimeWithZone#to_r` for `Time#at` compatibility.stopdropandrew2013-02-241-0/+11
|
* Added beginning_of_minute support to core_ext calculations for Time and DateTimeGagan Awhad2013-02-211-0/+14
|
* Modify TimeWithZone#as_json to return 3DP of sub-second accuracy by default, ↵James Harton2013-01-311-1/+1
| | | | since it's allowed by the spec and is very useful.
* Standardise the return value of `to_time`Andrew White2013-01-211-1/+5
| | | | | | | | | | | | | | | | | | | | | | This commit standardises the return value of `to_time` to an instance of `Time` in the local system timezone, matching the Ruby core and standard library behavior. The default form for `String#to_time` has been changed from :utc to :local but research seems to suggest the latter is the more common form. Also fix an edge condition with `String#to_time` where the string has a timezone offset in it and the mode is :local. e.g: # Before: >> "2000-01-01 00:00:00 -0500".to_time(:local) => 2000-01-01 05:00:00 -0500 # After: >> "2000-01-01 00:00:00 -0500".to_time(:local) => 2000-01-01 00:00:00 -0500 Closes #2453
* Remove assert_nothing_raisedRafael Mendonça França2013-01-031-4/+2
|
* Added ability to compare date/time with infinitybUg2013-01-041-0/+12
| | | | | | | | | | | | | | | | | Date, DateTime, Time and TimeWithZone can now be compared to infinity, so it's now possible to create ranges with one infinite bound and date/time object as another bound. Ex.: @range = Range.new(Date.today, Float::INFINITY) Also it's possible to check inclusion of date/time in range with conversion. Ex.: @range.include?(Time.now + 1.year) # => true @range.include?(DateTime.now + 1.year) # => true Ability to create date/time ranges with infinite bound is required for handling postgresql range types.
* Beef up tests for String#in_time_zone and Date#in_time_zoneAndrew White2012-12-111-0/+128
|
* respect nsec in TimeWithZoneVasiliy Ermolovich + Sergey Nartimov2012-05-181-0/+8
| | | | | | | | | | | 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
* 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
| |
* | Merge pull request #6156 from mjtko/feature-beginning_of_hourJeremy Kemper2012-05-041-0/+14
|\ \ | | | | | | Beginning and end of hour support for Time and DateTime
| * | added beginning_of_hour support to core_ext calculations for Time and DateTimeMark J. Titorenko2012-05-041-0/+14
| |/
* / enable tests for beginning_of_* and end_of_* within time zone tests; enable ↵Mark J. Titorenko2012-05-041-8/+8
|/ | | | test for future_with_time_current_as_time_with_zone; fix beginning_of_month test.
* use AS::TestCase as the base classAaron Patterson2012-01-051-2/+2
|
* Initial pass at removing dead 1.8.x code from Active Support.José Valim2011-12-201-2/+1
| | | | | | There are a bunch of other implicit branches that adds 1.8.x specific code that still needs to be removed. Pull requests for those cases are welcome.
* Fix inconsistencies with Time{WithZone}#{hash,eql?}Marc-Andre Lafortune2011-11-221-2/+9
|
* Fix xmlschema output with fraction_digits >0shtirlic2011-07-111-0/+7
| | | | | Current implementation produce incorrect output when Time#usec returns integer < 100000, because to_s doesn't add leading zeros.
* added find_zone and find_zone! to AS timezones and changed the AS Railtie to ↵Josh Kalderimis2011-04-051-0/+18
| | | | | | use find_zone! as well as adding Railtie tests Signed-off-by: Santiago Pastorino <santiago@wyeworks.com>
* Raise on invalid timezoneMarc-Andre Lafortune2011-04-051-5/+26
| | | | Signed-off-by: Santiago Pastorino <santiago@wyeworks.com>
* updated Time, Date and DateTime current methods in AS to use Time.zone and ↵Josh Kalderimis2011-02-281-7/+8
| | | | | | not Time.zone_default. [#6410 state:committed]
* prefering psych as the yaml parser if possible, fixing assertions for YAML ↵Aaron Patterson2011-01-211-2/+2
| | | | 1.1 compatibility
* make our yaml output consistentAaron Patterson2011-01-041-1/+1
|
* Fix ActiveSupport::TimeWithZone#localtime method with DateTimeAlvaro Bautista2010-11-111-0/+11
| | | | | | [#5344 state:committed] Signed-off-by: Santiago Pastorino <santiago@wyeworks.com>
* Deletes trailing whitespaces (over text files only find * -type f -exec sed ↵Santiago Pastorino2010-08-141-3/+3
| | | | 's/[ \t]*$//' -i {} \;)
* Don't store incorrect values in zones_mapSantiago Pastorino2010-06-281-3/+1
| | | | | | [#4942 state:committed] Signed-off-by: José Valim <jose.valim@gmail.com>
* when the timezone is nil, a TimeWithZone object should not be constructed. ↵Aaron Patterson2010-06-171-0/+7
| | | | | | [#4881 state:resolved] Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
* Fix test incorrectly using a bare assert to use assert_kind_ofSantiago Pastorino2010-05-241-1/+1
| | | | Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
* Final iteration of use better testing methodsNeeraj Singh2010-05-191-6/+6
| | | | | | [#4652 state:resolved] Signed-off-by: José Valim <jose.valim@gmail.com>
* Switch to TimezoneProxy for later support of deferred TZ loadingJeremy Kemper2010-04-201-2/+5
|
* Ensure test sets json time format flagJeremy Kemper2010-01-281-1/+4
|
* Add test for TimeWithZone#to_i with wrapped DateTimeGeoff Buesing2009-12-151-0/+6
|
* Pull in time extensions alsoJeremy Kemper2009-06-051-1/+1
|
* Work around Float faux precisionJeremy Kemper2009-04-301-1/+1
|
* * Add pluggable JSON backends with support for the JSON gem. [rick]rick2009-04-231-2/+2
| | | | | | | | | | | | | | Example: ActiveSupport::JSON.backend = "JSONGem" All internal Rails JSON encoding is now handled by ActiveSupport::JSON.encode(). Use of #to_json is not recommended, as it may clash with other libraries that overwrite it. However, you can recover Rails specific functionality if you really want to use #to_json. gem 'json' ActiveSupport::JSON.backend = "JSONGem" class ActiveRecord::Base alias to_json rails_to_json end
* Fix dependencies revealed by testing in isolationJeremy Kemper2009-04-221-0/+1
|
* Merge branch 'master' into cherryJeremy Kemper2009-04-201-0/+4
|\ | | | | | | | | | | | | | | | | | | | | Conflicts: activesupport/CHANGELOG activesupport/lib/active_support/core_ext/class/delegating_attributes.rb activesupport/lib/active_support/core_ext/hash/conversions.rb activesupport/lib/active_support/core_ext/module/attribute_accessors.rb activesupport/lib/active_support/core_ext/string/multibyte.rb activesupport/lib/active_support/core_ext/time/calculations.rb activesupport/lib/active_support/deprecation.rb
| * TimeWithZone.name returns 'Time', to further thwart type checkingGeoff Buesing2009-04-051-0/+4
| |
* | Explicit test dependenciesJeremy Kemper2009-03-281-0/+1
|/
* Ruby 1.9 compat: rename deprecated assert_raises to assert_raise.Jeremy Kemper2009-03-081-1/+1
| | | | [#1617 state:resolved]
* Remove obsolete silence_warnings wrappers from TZInfo-dependent tests in ↵Levin Alexander2009-02-141-254/+162
| | | | ActiveSupport [#1914 state:resolved]
* Make TimeWithZone#to_formatted_s an alias to TimeWithZone#to_s [#1796 ↵Levin Alexander2009-02-081-0/+6
| | | | state:resolved]
* TimeWithZone#xmlschema accepts optional fraction_digits argument [#1725 ↵Nicholas Dainty2009-01-111-0/+9
| | | | state:resolved]
* TimeWithZone#- gives correct result with wrapped DateTime, and with DateTime ↵gbuesing2009-01-041-0/+9
| | | | argument
* Require mocha >= 0.9.0 for AS testsJeremy Kemper2008-11-221-72/+66
|