Sha256: 03848e23ee20047932d45bcef129e79326c4ca26116dfa0bbd8e8adea29e5765

Contents?: true

Size: 882 Bytes

Versions: 3

Compression:

Stored size: 882 Bytes

Contents

require 'spec_helper'
describe Upsert do
  describe "doesn't mess with timezones" do
    before do
      @old_default_tz = ActiveRecord::Base.default_timezone
    end
    after do
      ActiveRecord::Base.default_timezone = @old_default_tz
    end
  
    it "deals fine with UTC" do
      ActiveRecord::Base.default_timezone = :utc
      time = Time.now.utc
      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 "won't mess with UTC" do
      ActiveRecord::Base.default_timezone = :local
      time = Time.now
      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
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
upsert-1.0.2 spec/timezones_spec.rb
upsert-0.5.0 spec/timezones_spec.rb
upsert-0.4.0 spec/timezones_spec.rb