diff options
author | Pratik Naik <pratiknaik@gmail.com> | 2010-01-24 01:33:18 +0530 |
---|---|---|
committer | Pratik Naik <pratiknaik@gmail.com> | 2010-01-24 01:33:18 +0530 |
commit | efd0bd3b7390ebb8526b981169025f2860f6a113 (patch) | |
tree | 1cb3bcd8f9534f64e8a764af1010ce65303b42b0 /activerecord/test/cases/types/time_with_zone_test.rb | |
parent | f4571e3617ccd9cc9e5ee9f7431066bd80395e22 (diff) | |
parent | 8ff2fb6f3aa6140f5a8bd018d5919a8a1e707cda (diff) | |
download | rails-efd0bd3b7390ebb8526b981169025f2860f6a113.tar.gz rails-efd0bd3b7390ebb8526b981169025f2860f6a113.tar.bz2 rails-efd0bd3b7390ebb8526b981169025f2860f6a113.zip |
Merge remote branch 'mainstream/master'
Diffstat (limited to 'activerecord/test/cases/types/time_with_zone_test.rb')
-rw-r--r-- | activerecord/test/cases/types/time_with_zone_test.rb | 42 |
1 files changed, 0 insertions, 42 deletions
diff --git a/activerecord/test/cases/types/time_with_zone_test.rb b/activerecord/test/cases/types/time_with_zone_test.rb deleted file mode 100644 index b3de79a6c8..0000000000 --- a/activerecord/test/cases/types/time_with_zone_test.rb +++ /dev/null @@ -1,42 +0,0 @@ -require "cases/helper" - -class TimeWithZoneTest < ActiveRecord::TestCase - - def setup - @column = ActiveRecord::ConnectionAdapters::Column.new('created_at', 0, 'datetime') - @time_with_zone = ActiveRecord::Type::TimeWithZone.new(@column) - end - - test "typecast" do - Time.use_zone("Pacific Time (US & Canada)") do - time_string = "2009-10-07 21:29:10" - time = Time.zone.parse(time_string) - - # assert_equal time, @time_with_zone.cast(time_string) - assert_equal nil, @time_with_zone.cast('') - assert_equal nil, @time_with_zone.cast(nil) - - assert_equal time, @time_with_zone.precast(time) - assert_equal time, @time_with_zone.precast(time_string) - assert_equal time, @time_with_zone.precast(time.to_time) - # assert_equal "#{time.to_date.to_s} 00:00:00 -0700", @time_with_zone.precast(time.to_date).to_s - end - end - - test "cast as boolean" do - Time.use_zone('Central Time (US & Canada)') do - time = Time.zone.now - - assert_equal true, @time_with_zone.boolean(time) - assert_equal true, @time_with_zone.boolean(time.to_date) - assert_equal true, @time_with_zone.boolean(time.to_time) - - assert_equal true, @time_with_zone.boolean(time.to_s) - assert_equal true, @time_with_zone.boolean(time.to_date.to_s) - assert_equal true, @time_with_zone.boolean(time.to_time.to_s) - - assert_equal false, @time_with_zone.boolean('') - end - end - -end |