Sha256: 4fc02cae151d1dfc7f7a0068abc74a374b3a46fa34c1cf37bdb1b0e6ff208cac
Contents?: true
Size: 1.79 KB
Versions: 18
Compression:
Stored size: 1.79 KB
Contents
require 'spec_helper' describe Upsert do describe "timezone support" do it "takes times in UTC" do time = Time.new.utc if ENV['DB'] == 'mysql' time = time.change(:usec => 0) end upsert = Upsert.new $conn, :pets assert_creates(Pet, [[{:name => 'Jerry'}, {:morning_walk_time => time}]]) do upsert.row({:name => 'Jerry'}, {:morning_walk_time => time}) end end it "takes times in local" do time = Time.new if ENV['DB'] == 'mysql' time = time.change(:usec => 0) end upsert = Upsert.new $conn, :pets assert_creates(Pet, [[{:name => 'Jerry'}, {:morning_walk_time => time}]]) do upsert.row({:name => 'Jerry'}, {:morning_walk_time => time}) end end it "takes datetimes in UTC" do time = DateTime.now.new_offset(Rational(0, 24)) if ENV['DB'] == 'mysql' time = time.change(:usec => 0) end upsert = Upsert.new $conn, :pets assert_creates(Pet, [[{:name => 'Jerry'}, {:morning_walk_time => time}]]) do upsert.row({:name => 'Jerry'}, {:morning_walk_time => time}) end end it "takes datetimes in local" do time = DateTime.now if ENV['DB'] == 'mysql' time = time.change(:usec => 0) end upsert = Upsert.new $conn, :pets assert_creates(Pet, [[{:name => 'Jerry'}, {:morning_walk_time => time}]]) do upsert.row({:name => 'Jerry'}, {:morning_walk_time => time}) end end if ENV['DB'] == 'postgresql' it "doesn't die on timestamp without time zone (postgresql)" do time = Time.new.utc upsert = Upsert.new $conn, :pets assert_creates(Pet, [[{:name => 'Jerry'}, {:tsntz => time}]]) do upsert.row({:name => 'Jerry'}, {:tsntz => time}) end end end end end
Version data entries
18 entries across 18 versions & 1 rubygems