Sha256: 5d72ff5b5fd42e4309681e7c35275842cd5d33f70c870c326813434c52845d37

Contents?: true

Size: 884 Bytes

Versions: 1

Compression:

Stored size: 884 Bytes

Contents

shared_examples_for "doesn't mess with timezones" do
  describe :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 connection, :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 connection, :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

1 entries across 1 versions & 1 rubygems

Version Path
upsert-0.1.0 test/shared/timezones.rb