aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/test/time_zone_test.rb
Commit message (Collapse)AuthorAgeFilesLines
* Remove automatic removal of Date/Time stubs after each test caseRafael Mendonça França2014-01-301-0/+3
| | | | | | This behavior is only work out-of-box with minitest and also add a downside to run after each test case, even if we don't used the travel or travel_to methods
* Add support for localized date referencesColin Bartlett2013-12-031-0/+22
| | | | | | | Ruby's Date class automatically gives us #yesterday, #today, and #tomorrow. And ActiveSupport has a handy Time.zone.today for getting a localized version. But there was no localized version of #yesterday or #tomorrow. Until now.
* Use travel_to convention in existing testColin Bartlett2013-12-031-4/+4
|
* Add regression tests for #9678Andrew White2013-03-131-0/+16
| | | | | The bug with `ActiveSupport::TimeZone.parse` described in #9678 was unwittingly fixed in 005d910 so add some tests to prevent regression.
* Only take the date parts from Time.zone.nowAndrew White2012-12-011-0/+7
| | | | | | | When there are missing components in the Hash returned by Date._parse only the date components should default to the value of Time.zone.now, the time components should all default to zero.
* Make `Time.zone.parse` to work with JavaScript date stringsAndrew White2012-12-011-14/+18
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Chrome, Safari and Firefox serialize Date objects to strings such as 'Mon May 28 2012 00:00:00 GMT-0700 (PDT)'. When these strings are parsed the zone is interpreted as 'GMT-0700' which doesn't exist in the TzInfo list of timezones. By taking advantage of the improved date/time handling in 1.9.3 we can use `Date._parse` and the `:offset` value which is parsed correctly. Three tests were amended to make them pass: 1. test_parse_with_old_date This needed changing to a different value because the original value was before EST was adopted so was being changed to a LMT (Local Mean Time) value after the change. It didn't before because `DateTime` just has offsets from UTC not timezones. 2. test_parse_should_not_black_out_system_timezone_dst_jump Changed the implementation of this test as the stubs were dependent on internal implementation details of the test. Confirmed that the modified test still failed when the implementation of `parse` was restored to pre-#5571. 3. test_parse_should_black_out_app_timezone_dst_jump Ditto. Closes #5770.
* Fix #6962. AS::TimeWithZone#strftime responds incorrectly to %:z and %::z ↵kennyj2012-09-201-0/+8
| | | | format strings.
* [#5559] Do not black out the system timezone DST jump hour if Time.zone ↵Jarkko Laine2012-03-241-0/+18
| | | | | | | | differs from that. The system timezone DST jump hour should not be blacked out by Time.zone.parse if current Time.zone does not do the jump at that time. Fixes #5559.
* remove some mocha stubsAaron Patterson2012-03-161-6/+11
|
* use AS::TestCase as the base classAaron Patterson2012-01-051-1/+1
|
* Using not effected timezone in tests.Arun Agrawal2011-06-291-4/+4
|
* Deletes trailing whitespaces (over text files only find * -type f -exec sed ↵Santiago Pastorino2010-08-141-1/+1
| | | | 's/[ \t]*$//' -i {} \;)
* Don't store incorrect values in zones_mapSantiago Pastorino2010-06-281-1/+1
| | | | | | [#4942 state:committed] Signed-off-by: José Valim <jose.valim@gmail.com>
* test that unknown zones don't store mapping keysLeigh Caplan2010-06-281-0/+5
| | | | | | | [#4942] Signed-off-by: Santiago Pastorino <santiago@wyeworks.com> Signed-off-by: José Valim <jose.valim@gmail.com>
* Final iteration of use better testing methodsNeeraj Singh2010-05-191-1/+1
| | | | | | [#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-4/+4
|
* avoid warning: ambiguous first argument; put parentheses or even spacesSantiago Pastorino2010-04-161-1/+1
|
* utc_offset returns nil for unknown zonesSantiago Pastorino2010-04-141-1/+7
| | | | Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
* Test for unknown zone with nil utc_offsetSantiago Pastorino2010-04-141-0/+5
| | | | Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
* delegate unknown timezones to TZInfoSantiago Pastorino2010-04-021-0/+8
|
* Fix bug that causes TimeZone.seconds_to_utc_offset to returns wrong offset ↵Prem Sichanugrist2010-01-191-0/+6
| | | | | | when hour < 0 and not in hundreds [#3741 status:resolved] Signed-off-by: José Valim <jose.valim@gmail.com>
* Remove 'core' fluff. Hookable ActiveSupport.load_all!Jeremy Kemper2009-05-201-1/+1
|
* Fix dependencies revealed by testing in isolationJeremy Kemper2009-04-221-0/+1
|
* Fix timezone testJeremy Kemper2009-03-261-6/+6
|
* Move Numeric#to_utc_offset_s to TimeZone.seconds_to_utc_offsetJeremy Kemper2009-03-231-0/+12
|
* 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-58/+34
| | | | ActiveSupport [#1914 state:resolved]
* Require mocha >= 0.9.0 for AS testsJeremy Kemper2008-11-221-41/+37
|
* TimeZone offset tests: use current_period, to ensure TimeZone#utc_offset is ↵gbuesing2008-11-181-1/+1
| | | | up-to-date
* TimeZone: fix base offset for Sri Jayawardenepura. Anchor tests for zone ↵gbuesing2008-11-131-1/+1
| | | | offsets to more current date
* Added support for regexp matching of priority zones in time_zone_select ↵Ernie Miller2008-06-291-0/+7
| | | | [#195 state:resolved]
* Namespace Inflector, Dependencies, OrderedOptions, and TimeZone under ↵Joshua Peek2008-06-031-68/+67
| | | | ActiveSupport [#238 state:resolved]
* TimeZone#to_s shows offset as GMT instead of UTC, because GMT will be more ↵gbuesing2008-05-251-1/+1
| | | | familiar to end users (see time zone selects used by Windows OS, google.com and yahoo.com.) Reverts [8370]
* Time.zone.parse: return nil for strings with no date informationgbuesing2008-05-081-0/+8
|
* Time.zone.parse: compatibility with far future date with time zone offset in ↵gbuesing2008-05-081-0/+9
| | | | string. Eliminate creation of additional TimeWithZone instance to determine utc offset.
* Fix Time.zone.parse from stripping time zone information and make Time aware ↵Scott Fleckenstein2008-05-081-0/+8
| | | | attribute methods use Time.zone.parse instead of to_time
* Removing unnecessary uses_tzinfo helper from tests, given that TZInfo is now ↵Geoff Buesing2008-03-301-164/+161
| | | | | | bundled git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@9150 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
* Time.zone= accepts TZInfo::Timezone instances and Olson identifiers; wraps ↵Geoff Buesing2008-03-281-0/+9
| | | | | | result in TimeZone instance git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@9107 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
* Make TimeWithZone work with tzinfo 0.2.x: use ↵Geoff Buesing2008-03-211-91/+99
| | | | | | TZInfo::Timezone#zone_identifier alias for #abbreviation, silence warnings on tests. Raise LoadError when TZInfo version is < 0.2 by sniffing for TZInfo::TimeOrDateTime constant. Move all tzinfo-dependent TimeZone tests into uses_tzinfo block git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@9071 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
* Adding TimeZone#parseGeoff Buesing2008-03-171-3/+37
| | | | git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@9045 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
* Adding TimeZone#at and DateTime#to_fGeoff Buesing2008-03-171-0/+19
| | | | git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@9042 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
* Fix Numeric time tests broken by DST change by anchoring them to fixed times ↵Geoff Buesing2008-03-111-2/+2
| | | | | | instead of Time.now. Anchor TimeZone#now DST test to time specified with Time.at instead of Time.local to work around platform differences with Time.local and DST representation git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@9009 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
* TimeZone #local and #now correctly enforce DST rulesGeoff Buesing2008-03-111-6/+64
| | | | git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@9007 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
* TimeZone#new renamed #local, so that new TimeWithZone instances can be ↵Geoff Buesing2008-02-101-2/+2
| | | | | | created via Time.zone.local() git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@8847 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
* Add Time Zone support to ActiveRecord, and config.time_zone property for ↵Rick Olson2008-02-061-0/+6
| | | | | | specifying a default Time Zone. Closes #10982 [Geoff Buesing, rick] git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@8806 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
* Support retrieving TimeZones with a Duration. TimeZone[-28800] == ↵Rick Olson2008-01-291-0/+8
| | | | | | TimeZone[-480.minutes]. [rick] git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@8746 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
* TimeZone#to_s uses UTC rather than GMT; reapplying change that was undone in ↵Geoff Buesing2008-01-251-1/+1
| | | | | | [8679]. References #1689 git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@8716 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
* TimeZone#now returns an ActiveSupport::TimeWithZoneGeoff Buesing2008-01-231-1/+4
| | | | git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@8710 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
* Adding alternate_utc_string option to TimeZone#formatted_offset. Removing ↵Geoff Buesing2008-01-231-0/+6
| | | | | | unneeded TimeZone#offset git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@8697 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
* Replace non-dst-aware TimeZone class with dst-aware class from ↵Geoff Buesing2008-01-211-61/+78
| | | | | | tzinfo_timezone plugin. TimeZone#adjust and #unadjust are no longer available; tzinfo gem must now be present in order to perform time zone calculations, via #local_to_utc and #utc_to_local methods. git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@8679 5ecf4fe2-1ee6-0310-87b1-e25e094e27de