summaryrefslogtreecommitdiff
path: root/spec/models/concerns/bulk_insertable_associations_spec.rb
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2020-03-10 18:08:17 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2020-03-10 18:08:17 +0000
commit219eead23f9feb5da9ec378c451d773aea2dfe61 (patch)
treeeec14421a05ca8eb79f3cc782abe99532bb6070c /spec/models/concerns/bulk_insertable_associations_spec.rb
parent7c38405be9e79099f399aa429503ea7b463bbf5a (diff)
downloadgitlab-ce-219eead23f9feb5da9ec378c451d773aea2dfe61.tar.gz
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/models/concerns/bulk_insertable_associations_spec.rb')
-rw-r--r--spec/models/concerns/bulk_insertable_associations_spec.rb8
1 files changed, 2 insertions, 6 deletions
diff --git a/spec/models/concerns/bulk_insertable_associations_spec.rb b/spec/models/concerns/bulk_insertable_associations_spec.rb
index 9e584417697..6359b2c57ef 100644
--- a/spec/models/concerns/bulk_insertable_associations_spec.rb
+++ b/spec/models/concerns/bulk_insertable_associations_spec.rb
@@ -57,16 +57,12 @@ describe BulkInsertableAssociations do
end
end
- before do
- ActiveRecord::Base.connection.execute('TRUNCATE bulk_foos RESTART IDENTITY')
- end
-
context 'saving bulk insertable associations' do
let(:parent) { BulkParent.new(name: 'parent') }
context 'when items already have IDs' do
it 'stores nothing and raises an error' do
- build_items(parent: parent) { |n, item| item.id = 100 + n }
+ build_items(parent: parent) { |n, item| item.id = n }
expect { save_with_bulk_inserts(parent) }.to raise_error(BulkInsertSafe::PrimaryKeySetError)
expect(BulkFoo.count).to eq(0)
@@ -79,7 +75,7 @@ describe BulkInsertableAssociations do
expect(BulkFoo).to receive(:bulk_insert!).once.and_call_original
expect { save_with_bulk_inserts(parent) }.to change { BulkFoo.count }.from(0).to(items.size)
- expect(parent.bulk_foos.pluck(:id)).to contain_exactly(*(1..10))
+ expect(parent.bulk_foos.pluck(:id)).to all(be_a Integer)
end
end