diff options
author | Xavier Noria <fxn@hashref.com> | 2016-08-06 18:03:25 +0200 |
---|---|---|
committer | Xavier Noria <fxn@hashref.com> | 2016-08-06 18:10:53 +0200 |
commit | a731125f12c5834de7eae3455fad63ea4d348034 (patch) | |
tree | 0ada76c652c1a2a1fd68cdbecf5adc2df6beeb51 /activesupport/test/core_ext/date_time_ext_test.rb | |
parent | d66e7835bea9505f7003e5038aa19b6ea95ceea1 (diff) | |
download | rails-a731125f12c5834de7eae3455fad63ea4d348034.tar.gz rails-a731125f12c5834de7eae3455fad63ea4d348034.tar.bz2 rails-a731125f12c5834de7eae3455fad63ea4d348034.zip |
applies new string literal convention in activesupport/test
The current code base is not uniform. After some discussion,
we have chosen to go with double quotes by default.
Diffstat (limited to 'activesupport/test/core_ext/date_time_ext_test.rb')
-rw-r--r-- | activesupport/test/core_ext/date_time_ext_test.rb | 42 |
1 files changed, 21 insertions, 21 deletions
diff --git a/activesupport/test/core_ext/date_time_ext_test.rb b/activesupport/test/core_ext/date_time_ext_test.rb index 306316efcd..222a43f1b2 100644 --- a/activesupport/test/core_ext/date_time_ext_test.rb +++ b/activesupport/test/core_ext/date_time_ext_test.rb @@ -1,7 +1,7 @@ -require 'abstract_unit' -require 'active_support/time' -require 'core_ext/date_and_time_behavior' -require 'time_zone_test_helpers' +require "abstract_unit" +require "active_support/time" +require "core_ext/date_and_time_behavior" +require "time_zone_test_helpers" class DateTimeExtCalculationsTest < ActiveSupport::TestCase def date_time_init(year,month,day,hour,minute,second,*args) @@ -35,13 +35,13 @@ class DateTimeExtCalculationsTest < ActiveSupport::TestCase end def test_custom_date_format - Time::DATE_FORMATS[:custom] = '%Y%m%d%H%M%S' - assert_equal '20050221143000', DateTime.new(2005, 2, 21, 14, 30, 0).to_s(:custom) + Time::DATE_FORMATS[:custom] = "%Y%m%d%H%M%S" + assert_equal "20050221143000", DateTime.new(2005, 2, 21, 14, 30, 0).to_s(:custom) Time::DATE_FORMATS.delete(:custom) end def test_localtime - with_env_tz 'US/Eastern' do + with_env_tz "US/Eastern" do assert_instance_of Time, DateTime.new(2016, 3, 11, 15, 11, 12, 0).localtime assert_equal Time.local(2016, 3, 11, 10, 11, 12), DateTime.new(2016, 3, 11, 15, 11, 12, 0).localtime assert_equal Time.local(2016, 3, 21, 11, 11, 12), DateTime.new(2016, 3, 21, 15, 11, 12, 0).localtime @@ -50,7 +50,7 @@ class DateTimeExtCalculationsTest < ActiveSupport::TestCase end def test_getlocal - with_env_tz 'US/Eastern' do + with_env_tz "US/Eastern" do assert_instance_of Time, DateTime.new(2016, 3, 11, 15, 11, 12, 0).getlocal assert_equal Time.local(2016, 3, 11, 10, 11, 12), DateTime.new(2016, 3, 11, 15, 11, 12, 0).getlocal assert_equal Time.local(2016, 3, 21, 11, 11, 12), DateTime.new(2016, 3, 21, 15, 11, 12, 0).getlocal @@ -67,7 +67,7 @@ class DateTimeExtCalculationsTest < ActiveSupport::TestCase end def test_to_time - with_env_tz 'US/Eastern' do + with_env_tz "US/Eastern" do assert_instance_of Time, DateTime.new(2005, 2, 21, 10, 11, 12, 0).to_time if ActiveSupport.to_time_preserves_timezone @@ -282,7 +282,7 @@ class DateTimeExtCalculationsTest < ActiveSupport::TestCase end def test_current_returns_date_today_when_zone_is_not_set - with_env_tz 'US/Eastern' do + with_env_tz "US/Eastern" do Time.stub(:now, Time.local(1999, 12, 31, 23, 59, 59)) do assert_equal DateTime.new(1999, 12, 31, 23, 59, 59, Rational(-18000, 86400)), DateTime.current end @@ -290,8 +290,8 @@ class DateTimeExtCalculationsTest < ActiveSupport::TestCase end def test_current_returns_time_zone_today_when_zone_is_set - Time.zone = ActiveSupport::TimeZone['Eastern Time (US & Canada)'] - with_env_tz 'US/Eastern' do + Time.zone = ActiveSupport::TimeZone["Eastern Time (US & Canada)"] + with_env_tz "US/Eastern" do Time.stub(:now, Time.local(1999, 12, 31, 23, 59, 59)) do assert_equal DateTime.new(1999, 12, 31, 23, 59, 59, Rational(-18000, 86400)), DateTime.current end @@ -305,7 +305,7 @@ class DateTimeExtCalculationsTest < ActiveSupport::TestCase end def test_current_with_time_zone - with_env_tz 'US/Eastern' do + with_env_tz "US/Eastern" do assert_kind_of DateTime, DateTime.current end end @@ -343,15 +343,15 @@ class DateTimeExtCalculationsTest < ActiveSupport::TestCase end def test_formatted_offset_with_utc - assert_equal '+00:00', DateTime.civil(2000).formatted_offset - assert_equal '+0000', DateTime.civil(2000).formatted_offset(false) - assert_equal 'UTC', DateTime.civil(2000).formatted_offset(true, 'UTC') + assert_equal "+00:00", DateTime.civil(2000).formatted_offset + assert_equal "+0000", DateTime.civil(2000).formatted_offset(false) + assert_equal "UTC", DateTime.civil(2000).formatted_offset(true, "UTC") end def test_formatted_offset_with_local dt = DateTime.civil(2005, 2, 21, 10, 11, 12, Rational(-5, 24)) - assert_equal '-05:00', dt.formatted_offset - assert_equal '-0500', dt.formatted_offset(false) + assert_equal "-05:00", dt.formatted_offset + assert_equal "-0500", dt.formatted_offset(false) end def test_compare_with_time @@ -367,9 +367,9 @@ class DateTimeExtCalculationsTest < ActiveSupport::TestCase end def test_compare_with_time_with_zone - assert_equal 1, DateTime.civil(2000) <=> ActiveSupport::TimeWithZone.new( Time.utc(1999, 12, 31, 23, 59, 59), ActiveSupport::TimeZone['UTC'] ) - assert_equal 0, DateTime.civil(2000) <=> ActiveSupport::TimeWithZone.new( Time.utc(2000, 1, 1, 0, 0, 0), ActiveSupport::TimeZone['UTC'] ) - assert_equal(-1, DateTime.civil(2000) <=> ActiveSupport::TimeWithZone.new( Time.utc(2000, 1, 1, 0, 0, 1), ActiveSupport::TimeZone['UTC'] )) + assert_equal 1, DateTime.civil(2000) <=> ActiveSupport::TimeWithZone.new( Time.utc(1999, 12, 31, 23, 59, 59), ActiveSupport::TimeZone["UTC"] ) + assert_equal 0, DateTime.civil(2000) <=> ActiveSupport::TimeWithZone.new( Time.utc(2000, 1, 1, 0, 0, 0), ActiveSupport::TimeZone["UTC"] ) + assert_equal(-1, DateTime.civil(2000) <=> ActiveSupport::TimeWithZone.new( Time.utc(2000, 1, 1, 0, 0, 1), ActiveSupport::TimeZone["UTC"] )) end def test_compare_with_string |