diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2023-12-19 14:01:45 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2023-12-19 14:01:45 +0300 |
commit | 9297025d0b7ddf095eb618dfaaab2ff8f2018d8b (patch) | |
tree | 865198c01d1824a9b098127baa3ab980c9cd2c06 /spec/models/bulk_import_spec.rb | |
parent | 6372471f43ee03c05a7c1f8b0c6ac6b8a7431dbe (diff) |
Add latest changes from gitlab-org/gitlab@16-7-stable-eev16.7.0-rc42
Diffstat (limited to 'spec/models/bulk_import_spec.rb')
-rw-r--r-- | spec/models/bulk_import_spec.rb | 33 |
1 files changed, 25 insertions, 8 deletions
diff --git a/spec/models/bulk_import_spec.rb b/spec/models/bulk_import_spec.rb index ff24f57f7c4..57c6df39167 100644 --- a/spec/models/bulk_import_spec.rb +++ b/spec/models/bulk_import_spec.rb @@ -3,12 +3,12 @@ require 'spec_helper' RSpec.describe BulkImport, type: :model, feature_category: :importers do - let_it_be(:created_bulk_import) { create(:bulk_import, :created) } - let_it_be(:started_bulk_import) { create(:bulk_import, :started) } - let_it_be(:finished_bulk_import) { create(:bulk_import, :finished) } + let_it_be(:created_bulk_import) { create(:bulk_import, :created, updated_at: 2.hours.ago) } + let_it_be(:started_bulk_import) { create(:bulk_import, :started, updated_at: 3.hours.ago) } + let_it_be(:finished_bulk_import) { create(:bulk_import, :finished, updated_at: 1.hour.ago) } let_it_be(:failed_bulk_import) { create(:bulk_import, :failed) } - let_it_be(:stale_created_bulk_import) { create(:bulk_import, :created, created_at: 3.days.ago) } - let_it_be(:stale_started_bulk_import) { create(:bulk_import, :started, created_at: 3.days.ago) } + let_it_be(:stale_created_bulk_import) { create(:bulk_import, :created, updated_at: 3.days.ago) } + let_it_be(:stale_started_bulk_import) { create(:bulk_import, :started, updated_at: 2.days.ago) } describe 'associations' do it { is_expected.to belong_to(:user).required } @@ -23,10 +23,27 @@ RSpec.describe BulkImport, type: :model, feature_category: :importers do it { is_expected.to define_enum_for(:source_type).with_values(%i[gitlab]) } end - describe '.stale scope' do - subject { described_class.stale } + describe 'scopes' do + describe '.stale' do + subject { described_class.stale } - it { is_expected.to contain_exactly(stale_created_bulk_import, stale_started_bulk_import) } + it { is_expected.to contain_exactly(stale_created_bulk_import, stale_started_bulk_import) } + end + + describe '.order_by_updated_at_and_id' do + subject { described_class.order_by_updated_at_and_id(:desc) } + + it 'sorts by given direction' do + is_expected.to eq([ + failed_bulk_import, + finished_bulk_import, + created_bulk_import, + started_bulk_import, + stale_started_bulk_import, + stale_created_bulk_import + ]) + end + end end describe '.all_human_statuses' do |