Commit b1f6d7bd authored by Max Woolf's avatar Max Woolf

Merge branch 'huzaifaiftikhar1-fix-delete-project-container-text' into 'master'

Fix issue with delete project container text

See merge request gitlab-org/gitlab!82941
parents e9edcbee 7a2fe82f
......@@ -15,7 +15,7 @@
- else
%p= permanent_delete_message(project)
- if project.feature_available?(:adjourned_deletion_for_projects_and_groups)
- if adjourned_deletion && project.feature_available?(:adjourned_deletion_for_projects_and_groups)
#js-project-adjourned-delete-button{ data: { restore_help_path: restore_help_path, adjourned_removal_date: adjourned_date, form_path: project_path(project), confirm_phrase: delete_confirm_phrase(project), is_fork: project.forked?.to_s, issues_count: number_with_delimiter(issues_count), merge_requests_count: number_with_delimiter(merge_requests_count), forks_count: number_with_delimiter(forks_count), stars_count: number_with_delimiter(project.star_count) } }
- else
#js-project-delete-button{ data: { form_path: project_path(project), confirm_phrase: delete_confirm_phrase(project), is_fork: project.forked?.to_s, issues_count: number_with_delimiter(issues_count), merge_requests_count: number_with_delimiter(merge_requests_count), forks_count: number_with_delimiter(forks_count), stars_count: number_with_delimiter(project.star_count) } }
......
......@@ -27,4 +27,52 @@ RSpec.describe 'Project', :js do
click_button confirm_button_text
end
end
describe 'delete project container text' do
using RSpec::Parameterized::TableSyntax
let(:group_settings) { create(:namespace_settings, delayed_project_removal: delayed_project_removal) }
let(:group) { create(:group, :public, namespace_settings: group_settings) }
let(:project) { create(:project, group: group) }
let(:user) { create(:user) }
where(:feature_available_on_instance, :delayed_project_removal, :shows_adjourned_delete) do
true | nil | false
true | true | true
false | true | false
false | nil | false
end
before do
stub_application_setting(deletion_adjourned_period: 7)
stub_licensed_features(adjourned_deletion_for_projects_and_groups: feature_available_on_instance)
group.add_user(user, Gitlab::Access::OWNER)
sign_in user
visit edit_project_path(project)
end
with_them do
if params[:shows_adjourned_delete]
it 'renders the marked for removal message' do
freeze_time do
deletion_date = (Time.now.utc + ::Gitlab::CurrentSettings.deletion_adjourned_period.days).strftime('%F')
expect(page).to have_content("This action deletes #{project.path_with_namespace} on #{deletion_date} and everything this project contains.")
click_button "Delete project"
expect(page).to have_content("This project can be restored until #{deletion_date}.")
end
end
else
it 'renders the permanently delete message' do
expect(page).to have_content("This action deletes #{project.path_with_namespace} and everything this project contains. There is no going back.")
click_button "Delete project"
expect(page).not_to have_content(/This project can be restored/)
end
end
end
end
end
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment