summaryrefslogtreecommitdiff
path: root/spec/lib/gitlab/database/migration_helpers_spec.rb
diff options
context:
space:
mode:
authorKamil Trzcinski <ayufan@ayufan.eu>2016-06-10 22:27:06 +0200
committerKamil Trzcinski <ayufan@ayufan.eu>2016-06-10 22:27:06 +0200
commit95a10f4533fdb708c61ffda95099bddd94800f02 (patch)
treebf5c561472c47d34e5ff1f643c49cd2a6b206f15 /spec/lib/gitlab/database/migration_helpers_spec.rb
parent17c6bec79d876ce932edc0edc5d17622adb2f724 (diff)
parentb4e84809e8170a43126507da0bc6a3b94c33804b (diff)
downloadgitlab-ce-95a10f4533fdb708c61ffda95099bddd94800f02.tar.gz
Merge remote-tracking branch 'origin/master' into ci-lfs-fetch
Diffstat (limited to 'spec/lib/gitlab/database/migration_helpers_spec.rb')
-rw-r--r--spec/lib/gitlab/database/migration_helpers_spec.rb13
1 files changed, 10 insertions, 3 deletions
diff --git a/spec/lib/gitlab/database/migration_helpers_spec.rb b/spec/lib/gitlab/database/migration_helpers_spec.rb
index 35ade7a2be0..83ddabe6b0b 100644
--- a/spec/lib/gitlab/database/migration_helpers_spec.rb
+++ b/spec/lib/gitlab/database/migration_helpers_spec.rb
@@ -16,14 +16,21 @@ describe Gitlab::Database::MigrationHelpers, lib: true do
end
context 'using PostgreSQL' do
- it 'creates the index concurrently' do
- expect(Gitlab::Database).to receive(:postgresql?).and_return(true)
+ before { expect(Gitlab::Database).to receive(:postgresql?).and_return(true) }
+ it 'creates the index concurrently' do
expect(model).to receive(:add_index).
with(:users, :foo, algorithm: :concurrently)
model.add_concurrent_index(:users, :foo)
end
+
+ it 'creates unique index concurrently' do
+ expect(model).to receive(:add_index).
+ with(:users, :foo, { algorithm: :concurrently, unique: true })
+
+ model.add_concurrent_index(:users, :foo, unique: true)
+ end
end
context 'using MySQL' do
@@ -31,7 +38,7 @@ describe Gitlab::Database::MigrationHelpers, lib: true do
expect(Gitlab::Database).to receive(:postgresql?).and_return(false)
expect(model).to receive(:add_index).
- with(:users, :foo)
+ with(:users, :foo, {})
model.add_concurrent_index(:users, :foo)
end