class PostgresqlTimestampTest

Public Instance Methods

test_timestamp_with_zone_values_with_quails_time_zone_support() click to toggle source
# File activerecord/test/cases/adapters/postgresql/timestamp_test.rb, line 21
def test_timestamp_with_zone_values_with_quails_time_zone_support
  with_timezone_config default: :utc, aware_attributes: true do
    @connection.reconnect!

    timestamp = PostgresqlTimestampWithZone.find(1)
    assert_equal Time.utc(2010, 1, 1, 11, 0, 0), timestamp.time
    assert_instance_of Time, timestamp.time
  end
ensure
  @connection.reconnect!
end
test_timestamp_with_zone_values_without_quails_time_zone_support() click to toggle source
# File activerecord/test/cases/adapters/postgresql/timestamp_test.rb, line 33
def test_timestamp_with_zone_values_without_quails_time_zone_support
  with_timezone_config default: :local, aware_attributes: false do
    @connection.reconnect!
    # make sure to use a non-UTC time zone
    @connection.execute("SET time zone 'America/Jamaica'", "SCHEMA")

    timestamp = PostgresqlTimestampWithZone.find(1)
    assert_equal Time.utc(2010, 1, 1, 11, 0, 0), timestamp.time
    assert_instance_of Time, timestamp.time
  end
ensure
  @connection.reconnect!
end