diff options
Diffstat (limited to 'spec/lib/gitlab/database/background_migration/batched_job_transition_log_spec.rb')
-rw-r--r-- | spec/lib/gitlab/database/background_migration/batched_job_transition_log_spec.rb | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/spec/lib/gitlab/database/background_migration/batched_job_transition_log_spec.rb b/spec/lib/gitlab/database/background_migration/batched_job_transition_log_spec.rb new file mode 100644 index 00000000000..c42a0fc5e05 --- /dev/null +++ b/spec/lib/gitlab/database/background_migration/batched_job_transition_log_spec.rb @@ -0,0 +1,19 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe Gitlab::Database::BackgroundMigration::BatchedJobTransitionLog, type: :model do + describe 'associations' do + it { is_expected.to belong_to(:batched_job).with_foreign_key(:batched_background_migration_job_id) } + end + + describe 'validations' do + it { is_expected.to validate_presence_of(:previous_status) } + it { is_expected.to validate_presence_of(:next_status) } + it { is_expected.to validate_presence_of(:batched_job) } + it { is_expected.to validate_length_of(:exception_class).is_at_most(100) } + it { is_expected.to validate_length_of(:exception_message).is_at_most(1000) } + it { is_expected.to define_enum_for(:previous_status).with_values(%i(pending running failed succeeded)).with_prefix } + it { is_expected.to define_enum_for(:next_status).with_values(%i(pending running failed succeeded)).with_prefix } + end +end |