Sha256: 81dd5f0745540c0b887642076b8b91c3778653e5d296c3fa258617e4e9781789

Contents?: true

Size: 809 Bytes

Versions: 10

Compression:

Stored size: 809 Bytes

Contents

shared_examples_for "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 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

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
upsert-0.3.4 test/shared/timezones.rb
upsert-0.3.3 test/shared/timezones.rb
upsert-0.3.2 test/shared/timezones.rb
upsert-0.3.1 test/shared/timezones.rb
upsert-0.3.0 test/shared/timezones.rb
upsert-0.2.2 test/shared/timezones.rb
upsert-0.2.1 test/shared/timezones.rb
upsert-0.2.0 test/shared/timezones.rb
upsert-0.1.2 test/shared/timezones.rb
upsert-0.1.1 test/shared/timezones.rb