Sha256: d5f98d9bc6b4299e6d5d0e128df6a74363b20c50c40eaf546e45b7d6d408a1f8

Contents?: true

Size: 603 Bytes

Versions: 2

Compression:

Stored size: 603 Bytes

Contents

require 'spec_helper'
describe Upsert do
  version = Pet.connection.select_value("SHOW server_version")[0..2].split('.').join('').to_i

  let(:upsert) do
    Upsert.new($conn, :pets)
  end

  it "uses the native method if available (#{(UNIQUE_CONSTRAINT && version >= 95).inspect})" do
    p = Pet.create(:name => 'Jerry', :tag_number => 5)
    upsert.row({ :name => 'Jerry'}, :tag_number => 6 )
    expect(upsert.instance_variable_get(:@merge_function_cache).values.first.use_pg_native?).to(
      UNIQUE_CONSTRAINT && version >= 95 ? be_truthy : be_falsey
    )
  end
end if ENV['DB'] == 'postgresql'

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
upsert-2.2.1 spec/postgresql_spec.rb
upsert-2.2.0 spec/postgresql_spec.rb