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

batched_job_transition_log_spec.rb « background_migration « database « gitlab « lib « spec - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: c42a0fc5e05a95fd88665b54f352ea0deb26c4b1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
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