summaryrefslogtreecommitdiff
path: root/spec/lib/gitlab/database_spec.rb
diff options
context:
space:
mode:
Diffstat (limited to 'spec/lib/gitlab/database_spec.rb')
-rw-r--r--spec/lib/gitlab/database_spec.rb20
1 files changed, 20 insertions, 0 deletions
diff --git a/spec/lib/gitlab/database_spec.rb b/spec/lib/gitlab/database_spec.rb
index cd009f955af..47d2cb05240 100644
--- a/spec/lib/gitlab/database_spec.rb
+++ b/spec/lib/gitlab/database_spec.rb
@@ -129,6 +129,26 @@ RSpec.describe Gitlab::Database do
end
end
+ describe '.within_deprecation_notice_window?' do
+ using RSpec::Parameterized::TableSyntax
+
+ where(:case_name, :days, :result) do
+ 'outside window' | Gitlab::Database::DEPRECATION_WINDOW_DAYS + 1 | false
+ 'equal to window' | Gitlab::Database::DEPRECATION_WINDOW_DAYS | true
+ 'within window' | Gitlab::Database::DEPRECATION_WINDOW_DAYS - 1 | true
+ end
+
+ with_them do
+ it "returns #{params[:result]} when #{params[:case_name]}" do
+ allow(Date)
+ .to receive(:today)
+ .and_return Date.parse(Gitlab::Database::UPCOMING_POSTGRES_VERSION_DETAILS[:gl_version_date]) - days
+
+ expect(described_class.within_deprecation_notice_window?).to eq(result)
+ end
+ end
+ end
+
describe '.check_postgres_version_and_print_warning' do
subject { described_class.check_postgres_version_and_print_warning }