aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/test/time_zone_test.rb
Commit message (Collapse)AuthorAgeFilesLines
* make zones_map privateTony Miller2015-02-061-2/+1
| | | | | Conflicts: activesupport/lib/active_support/values/time_zone.rb
* Use directly TZInfo::Timezone without proxybrainopia2015-01-041-9/+4
| | | | | Since real timezone is loaded anyway in `#utc_offset` which is called during `#create`
* Use Hash#each_key instead of Hash#keys.eachErik Michaels-Ober2014-09-291-1/+1
| | | | | | Hash#keys.each allocates an array of keys; Hash#each_key iterates through the keys without allocating a new array. This is the reason why Hash#each_key exists.
* Extract out with_env_tz helper method.Zuhao Wan2014-06-181-8/+3
| | | | | It’s used at so many places that extracting it out into a helper file is worth doing.
* Tidy up implementation of #15010Andrew White2014-05-111-4/+6
|
* Make TimeZone#parse behave more like Time#parse.Ulysse Carion2014-05-111-0/+7
| | | | | Namely, if the mday is omitted but any other upper components are, then instead of supplying the mday from the current time, it defaults to 1.
* travel_to travels back and re-raises if the block raisesXavier Noria2014-02-181-0/+12
|
* adds a missing travel backXavier Noria2014-02-181-4/+4
|
* time helpers honor the application time zone when passed a dateXavier Noria2014-02-181-0/+14
| | | | | | | | | | | | | | | | | Rails applications are expected to be always aware of the application time zone. To be consistent with that contract, we have to assume that a bare date passed to time helpers is a date in the application time zone, not in the system time zone. The system time zone is irrelevant, we should totally ignore it. For example, travel_to user.birth_date + 40.years should make that user be 40th years old regardless of the system time zone. Without this patch that may not be true.
* 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