Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Restore test for postgres on conflict nothing
  • Loading branch information
sobstel committed Nov 20, 2018
1 parent 501dd65 commit 77f2f6c
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions test/bulk_insert/worker_test.rb
Expand Up @@ -326,6 +326,23 @@ class BulkInsertWorkerTest < ActiveSupport::TestCase
end

test "adapter dependent postgresql methods" do
pgsql_worker = BulkInsert::Worker.new(
Testing.connection,
Testing.table_name,
'id',
%w(greeting age happy created_at updated_at color),
500, # batch size
true, # ignore
false, # update duplicates
true # return primary keys
)
pgsql_worker.adapter_name = 'PostgreSQL'
pgsql_worker.add ["Yo", 15, false, nil, nil]

assert_equal pgsql_worker.compose_insert_query, "INSERT INTO \"testings\" (\"greeting\",\"age\",\"happy\",\"created_at\",\"updated_at\",\"color\") VALUES ('Yo',15,0,NULL,NULL,'chartreuse') ON CONFLICT DO NOTHING RETURNING id"
end

test "adapter dependent postgresql methods (with update_duplicates)" do
pgsql_worker = BulkInsert::Worker.new(
Testing.connection,
Testing.table_name,
Expand Down

0 comments on commit 77f2f6c

Please sign in to comment.