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:
authorGitLab Bot <gitlab-bot@gitlab.com>2022-08-18 21:10:07 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2022-08-18 21:10:07 +0300
commitbc7374e61208637f6fb116e2ca59c7162b07cba9 (patch)
treed34a9d8680f808bd327123ebb2c861071f1e7635 /spec/finders
parentc48bbe6650648fa034696de25983418981e695eb (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/finders')
-rw-r--r--spec/finders/database/batched_background_migrations_finder_spec.rb27
1 files changed, 27 insertions, 0 deletions
diff --git a/spec/finders/database/batched_background_migrations_finder_spec.rb b/spec/finders/database/batched_background_migrations_finder_spec.rb
new file mode 100644
index 00000000000..bd88be72fa5
--- /dev/null
+++ b/spec/finders/database/batched_background_migrations_finder_spec.rb
@@ -0,0 +1,27 @@
+# frozen_string_literal: true
+
+require 'spec_helper'
+
+RSpec.describe Database::BatchedBackgroundMigrationsFinder do
+ let!(:migration_1) { create(:batched_background_migration, created_at: Time.now - 2) }
+ let!(:migration_2) { create(:batched_background_migration, created_at: Time.now - 1) }
+ let!(:migration_3) { create(:batched_background_migration, created_at: Time.now - 3) }
+
+ let(:finder) { described_class.new(connection: connection) }
+
+ describe '#execute' do
+ let(:connection) { ApplicationRecord.connection }
+
+ subject { finder.execute }
+
+ it 'returns migrations order by created_at (DESC)' do
+ is_expected.to eq([migration_2, migration_1, migration_3])
+ end
+
+ it 'limits the number of returned migrations' do
+ stub_const('Database::BatchedBackgroundMigrationsFinder::RETURNED_MIGRATIONS', 2)
+
+ is_expected.to eq([migration_2, migration_1])
+ end
+ end
+end