diff options
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.rb | 17 |
1 files changed, 17 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 new file mode 100644 index 00000000000..434cba4edde --- /dev/null +++ b/spec/lib/gitlab/database/async_indexes/postgres_async_index_spec.rb @@ -0,0 +1,17 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe Gitlab::Database::AsyncIndexes::PostgresAsyncIndex, type: :model do + describe 'validations' do + let(:identifier_limit) { described_class::MAX_IDENTIFIER_LENGTH } + let(:definition_limit) { described_class::MAX_DEFINITION_LENGTH } + + it { is_expected.to validate_presence_of(:name) } + it { is_expected.to validate_length_of(:name).is_at_most(identifier_limit) } + it { is_expected.to validate_presence_of(:table_name) } + it { is_expected.to validate_length_of(:table_name).is_at_most(identifier_limit) } + it { is_expected.to validate_presence_of(:definition) } + it { is_expected.to validate_length_of(:definition).is_at_most(definition_limit) } + end +end |