Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'spec/lib/gitlab/database_spec.rb')
-rw-r--r--spec/lib/gitlab/database_spec.rb30
1 files changed, 6 insertions, 24 deletions
diff --git a/spec/lib/gitlab/database_spec.rb b/spec/lib/gitlab/database_spec.rb
index 17ec2bbfdb1..a6af0da66e3 100644
--- a/spec/lib/gitlab/database_spec.rb
+++ b/spec/lib/gitlab/database_spec.rb
@@ -283,7 +283,6 @@ RSpec.describe Gitlab::Database do
describe '.bulk_insert' do
before do
allow(described_class).to receive(:connection).and_return(connection)
- allow(described_class).to receive(:version).and_return(version)
allow(connection).to receive(:quote_column_name, &:itself)
allow(connection).to receive(:quote, &:itself)
allow(connection).to receive(:execute)
@@ -298,8 +297,6 @@ RSpec.describe Gitlab::Database do
]
end
- let_it_be(:version) { 9.6 }
-
it 'does nothing with empty rows' do
expect(connection).not_to receive(:execute)
@@ -366,28 +363,13 @@ RSpec.describe Gitlab::Database do
expect(ids).to eq([10])
end
- context 'with version >= 9.5' do
- it 'allows setting the upsert to do nothing' do
- expect(connection)
- .to receive(:execute)
- .with(/ON CONFLICT DO NOTHING/)
-
- described_class
- .bulk_insert('test', [{ number: 10 }], on_conflict: :do_nothing)
- end
- end
-
- context 'with version < 9.5' do
- let(:version) { 9.4 }
-
- it 'refuses setting the upsert' do
- expect(connection)
- .not_to receive(:execute)
- .with(/ON CONFLICT/)
+ it 'allows setting the upsert to do nothing' do
+ expect(connection)
+ .to receive(:execute)
+ .with(/ON CONFLICT DO NOTHING/)
- described_class
- .bulk_insert('test', [{ number: 10 }], on_conflict: :do_nothing)
- end
+ described_class
+ .bulk_insert('test', [{ number: 10 }], on_conflict: :do_nothing)
end
end
end