diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2022-06-20 14:10:13 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2022-06-20 14:10:13 +0300 |
commit | 0ea3fcec397b69815975647f5e2aa5fe944a8486 (patch) | |
tree | 7979381b89d26011bcf9bdc989a40fcc2f1ed4ff /spec/views/shared/projects/_inactive_project_deletion_alert.html.haml_spec.rb | |
parent | 72123183a20411a36d607d70b12d57c484394c8e (diff) |
Add latest changes from gitlab-org/gitlab@15-1-stable-eev15.1.0-rc42
Diffstat (limited to 'spec/views/shared/projects/_inactive_project_deletion_alert.html.haml_spec.rb')
-rw-r--r-- | spec/views/shared/projects/_inactive_project_deletion_alert.html.haml_spec.rb | 54 |
1 files changed, 54 insertions, 0 deletions
diff --git a/spec/views/shared/projects/_inactive_project_deletion_alert.html.haml_spec.rb b/spec/views/shared/projects/_inactive_project_deletion_alert.html.haml_spec.rb new file mode 100644 index 00000000000..117771d5f30 --- /dev/null +++ b/spec/views/shared/projects/_inactive_project_deletion_alert.html.haml_spec.rb @@ -0,0 +1,54 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe 'shared/projects/_inactive_project_deletion_alert' do + let_it_be(:project) { create(:project) } + + let(:text) { 'Due to inactivity, this project is scheduled to be deleted on 2022-04-01. Why is this scheduled?' } + + shared_examples 'does not render' do + before do + render + end + + it { expect(rendered).not_to have_content(text) } + end + + before do + allow(view).to receive(:inactive_project_deletion_date).with(project).and_return('2022-04-01') + end + + context 'without a project' do + before do + assign(:project, nil) + end + + it_behaves_like 'does not render' + end + + context 'with a project' do + before do + assign(:project, project) + allow(view).to receive(:show_inactive_project_deletion_banner?).and_return(inactive) + end + + context 'when the project is active' do + let(:inactive) { false } + + it_behaves_like 'does not render' + end + + context 'when the project is inactive' do + let(:inactive) { true } + + before do + render + end + + it 'does render the alert' do + expect(rendered).to have_content(text) + end + end + end +end |