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/async_indexes/postgres_async_index_spec.rb')
-rw-r--r--spec/lib/gitlab/database/async_indexes/postgres_async_index_spec.rb15
1 files changed, 15 insertions, 0 deletions
diff --git a/spec/lib/gitlab/database/async_indexes/postgres_async_index_spec.rb b/spec/lib/gitlab/database/async_indexes/postgres_async_index_spec.rb
index 9e37124ba28..7e111dbe08f 100644
--- a/spec/lib/gitlab/database/async_indexes/postgres_async_index_spec.rb
+++ b/spec/lib/gitlab/database/async_indexes/postgres_async_index_spec.rb
@@ -55,6 +55,21 @@ RSpec.describe Gitlab::Database::AsyncIndexes::PostgresAsyncIndex, type: :model,
it_behaves_like 'table_name is invalid'
end
+
+ context 'when passing a definition with beginning or trailing whitespace' do
+ let(:model) { super().tap { |m| m.definition = definition } }
+ let(:definition) do
+ <<-SQL
+ CREATE UNIQUE INDEX CONCURRENTLY foo_index ON bar_field (uuid);
+ SQL
+ end
+
+ it "strips the definition field" do
+ expect(model).to be_valid
+ model.save!
+ expect(model.definition).to eq(definition.strip)
+ end
+ end
end
describe 'scopes' do