From c01c64e9783dc361d98ca8dc37d2b3a661ae1945 Mon Sep 17 00:00:00 2001 From: Jean-Philippe Lang Date: Fri, 29 Feb 2008 22:54:07 +0000 Subject: [PATCH] Let the user choose when deleting issues with reported hours (closes #734, #71): * to delete the hours * to assign the hours to the project * to reassign the hours to another issue git-svn-id: http://redmine.rubyforge.org/svn/trunk@1182 e93f8b46-1217-0410-a6f0-8f06a7374b81 --- app/controllers/issues_controller.rb | 20 +++++++++++ app/models/issue.rb | 2 +- app/views/issue_categories/destroy.rhtml | 4 +-- app/views/issues/destroy.rhtml | 15 ++++++++ lang/bg.yml | 5 +++ lang/cs.yml | 5 +++ lang/de.yml | 5 +++ lang/en.yml | 5 +++ lang/es.yml | 5 +++ lang/fi.yml | 5 +++ lang/fr.yml | 7 +++- lang/he.yml | 5 +++ lang/it.yml | 5 +++ lang/ja.yml | 5 +++ lang/ko.yml | 5 +++ lang/lt.yml | 5 +++ lang/nl.yml | 5 +++ lang/pl.yml | 5 +++ lang/pt-br.yml | 5 +++ lang/pt.yml | 5 +++ lang/ro.yml | 5 +++ lang/ru.yml | 5 +++ lang/sr.yml | 5 +++ lang/sv.yml | 5 +++ lang/uk.yml | 5 +++ lang/zh-tw.yml | 5 +++ lang/zh.yml | 5 +++ test/functional/issues_controller_test.rb | 44 ++++++++++++++++++++--- test/unit/issue_test.rb | 6 ++++ 29 files changed, 200 insertions(+), 8 deletions(-) create mode 100644 app/views/issues/destroy.rhtml diff --git a/app/controllers/issues_controller.rb b/app/controllers/issues_controller.rb index e03afb252..53627db92 100644 --- a/app/controllers/issues_controller.rb +++ b/app/controllers/issues_controller.rb @@ -263,6 +263,26 @@ class IssuesController < ApplicationController end def destroy + @hours = TimeEntry.sum(:hours, :conditions => ['issue_id IN (?)', @issues]).to_f + if @hours > 0 + case params[:todo] + when 'destroy' + # nothing to do + when 'nullify' + TimeEntry.update_all('issue_id = NULL', ['issue_id IN (?)', @issues]) + when 'reassign' + reassign_to = @project.issues.find_by_id(params[:reassign_to_id]) + if reassign_to.nil? + flash.now[:error] = l(:error_issue_not_found_in_project) + return + else + TimeEntry.update_all("issue_id = #{reassign_to.id}", ['issue_id IN (?)', @issues]) + end + else + # display the destroy form + return + end + end @issues.each(&:destroy) redirect_to :action => 'index', :project_id => @project end diff --git a/app/models/issue.rb b/app/models/issue.rb index 9d7f6eaaf..1d25a4604 100644 --- a/app/models/issue.rb +++ b/app/models/issue.rb @@ -27,7 +27,7 @@ class Issue < ActiveRecord::Base has_many :journals, :as => :journalized, :dependent => :destroy has_many :attachments, :as => :container, :dependent => :destroy - has_many :time_entries, :dependent => :nullify + has_many :time_entries, :dependent => :delete_all has_many :custom_values, :dependent => :delete_all, :as => :customized has_many :custom_fields, :through => :custom_values has_and_belongs_to_many :changesets, :order => "revision ASC" diff --git a/app/views/issue_categories/destroy.rhtml b/app/views/issue_categories/destroy.rhtml index a563736e2..2b61810e7 100644 --- a/app/views/issue_categories/destroy.rhtml +++ b/app/views/issue_categories/destroy.rhtml @@ -3,9 +3,9 @@ <% form_tag({}) do %>

<%= l(:text_issue_category_destroy_question, @issue_count) %>

-

<%= radio_button_tag 'todo', 'nullify', true %> <%= l(:text_issue_category_destroy_assignments) %>
+


<% if @categories.size > 0 %> -<%= radio_button_tag 'todo', 'reassign', false %> <%= l(:text_issue_category_reassign_to) %>: +: <%= select_tag 'reassign_to_id', options_from_collection_for_select(@categories, 'id', 'name') %>

<% end %>
diff --git a/app/views/issues/destroy.rhtml b/app/views/issues/destroy.rhtml new file mode 100644 index 000000000..2f3c036b6 --- /dev/null +++ b/app/views/issues/destroy.rhtml @@ -0,0 +1,15 @@ +

<%= l(:confirmation) %>

+ +<% form_tag do %> +<%= @issues.collect {|i| hidden_field_tag 'ids[]', i.id } %> +
+

<%= l(:text_destroy_time_entries_question, @hours) %>

+

+
+
+ +<%= text_field_tag 'reassign_to_id', params[:reassign_to_id], :size => 6, :onfocus => '$("todo_reassign").checked=true;' %> +

+
+<%= submit_tag l(:button_apply) %> +<% end %> diff --git a/lang/bg.yml b/lang/bg.yml index 64fff5ae9..12d5dfa5f 100644 --- a/lang/bg.yml +++ b/lang/bg.yml @@ -602,3 +602,8 @@ label_yesterday: yesterday label_last_month: last month label_add_another_file: Add another file label_optional_description: Optional description +text_destroy_time_entries_question: %.02f hours were reported on the issues you are about to delete. What do you want to do ? +error_issue_not_found_in_project: 'The issue was not found or does not belong to this project' +text_assign_time_entries_to_project: Assign reported hours to the project +text_destroy_time_entries: Delete reported hours +text_reassign_time_entries: 'Reassign reported hours to this issue:' diff --git a/lang/cs.yml b/lang/cs.yml index 6de5ee01b..56b77d87b 100644 --- a/lang/cs.yml +++ b/lang/cs.yml @@ -602,3 +602,8 @@ label_yesterday: yesterday label_last_month: last month label_add_another_file: Add another file label_optional_description: Optional description +text_destroy_time_entries_question: %.02f hours were reported on the issues you are about to delete. What do you want to do ? +error_issue_not_found_in_project: 'The issue was not found or does not belong to this project' +text_assign_time_entries_to_project: Assign reported hours to the project +text_destroy_time_entries: Delete reported hours +text_reassign_time_entries: 'Reassign reported hours to this issue:' diff --git a/lang/de.yml b/lang/de.yml index f2b1c2023..9397cf892 100644 --- a/lang/de.yml +++ b/lang/de.yml @@ -602,3 +602,8 @@ label_yesterday: yesterday label_last_month: last month label_add_another_file: Add another file label_optional_description: Optional description +text_destroy_time_entries_question: %.02f hours were reported on the issues you are about to delete. What do you want to do ? +error_issue_not_found_in_project: 'The issue was not found or does not belong to this project' +text_assign_time_entries_to_project: Assign reported hours to the project +text_destroy_time_entries: Delete reported hours +text_reassign_time_entries: 'Reassign reported hours to this issue:' diff --git a/lang/en.yml b/lang/en.yml index b06977035..7ed2c8775 100644 --- a/lang/en.yml +++ b/lang/en.yml @@ -80,6 +80,7 @@ notice_default_data_loaded: Default configuration successfully loaded. error_can_t_load_default_data: "Default configuration could not be loaded: %s" error_scm_not_found: "Entry and/or revision doesn't exist in the repository." error_scm_command_failed: "An error occurred when trying to access the repository: %s" +error_issue_not_found_in_project: 'The issue was not found or does not belong to this project' mail_subject_lost_password: Your Redmine password mail_body_lost_password: 'To change your Redmine password, click on the following link:' @@ -577,6 +578,10 @@ text_select_project_modules: 'Select modules to enable for this project:' text_default_administrator_account_changed: Default administrator account changed text_file_repository_writable: File repository writable text_rmagick_available: RMagick available (optional) +text_destroy_time_entries_question: %.02f hours were reported on the issues you are about to delete. What do you want to do ? +text_destroy_time_entries: Delete reported hours +text_assign_time_entries_to_project: Assign reported hours to the project +text_reassign_time_entries: 'Reassign reported hours to this issue:' default_role_manager: Manager default_role_developper: Developer diff --git a/lang/es.yml b/lang/es.yml index 9c72af18d..9032d3599 100644 --- a/lang/es.yml +++ b/lang/es.yml @@ -605,3 +605,8 @@ label_yesterday: yesterday label_last_month: last month label_add_another_file: Add another file label_optional_description: Optional description +text_destroy_time_entries_question: %.02f hours were reported on the issues you are about to delete. What do you want to do ? +error_issue_not_found_in_project: 'The issue was not found or does not belong to this project' +text_assign_time_entries_to_project: Assign reported hours to the project +text_destroy_time_entries: Delete reported hours +text_reassign_time_entries: 'Reassign reported hours to this issue:' diff --git a/lang/fi.yml b/lang/fi.yml index 350e5ba44..dbcc3763c 100644 --- a/lang/fi.yml +++ b/lang/fi.yml @@ -606,3 +606,8 @@ label_yesterday: yesterday label_last_month: last month label_add_another_file: Add another file label_optional_description: Optional description +text_destroy_time_entries_question: %.02f hours were reported on the issues you are about to delete. What do you want to do ? +error_issue_not_found_in_project: 'The issue was not found or does not belong to this project' +text_assign_time_entries_to_project: Assign reported hours to the project +text_destroy_time_entries: Delete reported hours +text_reassign_time_entries: 'Reassign reported hours to this issue:' diff --git a/lang/fr.yml b/lang/fr.yml index c2baa3b7e..accd5c1bf 100644 --- a/lang/fr.yml +++ b/lang/fr.yml @@ -80,6 +80,7 @@ notice_default_data_loaded: Paramétrage par défaut chargé avec succès. error_can_t_load_default_data: "Une erreur s'est produite lors du chargement du paramétrage: %s" error_scm_not_found: "L'entrée et/ou la révision demandée n'existe pas dans le dépôt." error_scm_command_failed: "Une erreur s'est produite lors de l'accès au dépôt: %s" +error_issue_not_found_in_project: "La demande n'existe pas ou n'appartient pas à ce projet" mail_subject_lost_password: Votre mot de passe redMine mail_body_lost_password: 'Pour changer votre mot de passe Redmine, cliquez sur le lien suivant:' @@ -565,7 +566,7 @@ text_issues_ref_in_commit_messages: Référencement et résolution des demandes text_issue_added: La demande %s a été soumise par %s. text_issue_updated: La demande %s a été mise à jour par %s. text_wiki_destroy_confirmation: Etes-vous sûr de vouloir supprimer ce wiki et tout son contenu ? -text_issue_category_destroy_question: Des demandes (%d) sont affectées à cette catégories. Que voulez-vous faire ? +text_issue_category_destroy_question: %d demandes sont affectées à cette catégories. Que voulez-vous faire ? text_issue_category_destroy_assignments: N'affecter les demandes à aucune autre catégorie text_issue_category_reassign_to: Réaffecter les demandes à cette catégorie text_user_mail_option: "Pour les projets non sélectionnés, vous recevrez seulement des notifications pour ce que vous surveillez ou à quoi vous participez (exemple: demandes dont vous êtes l'auteur ou la personne assignée)." @@ -577,6 +578,10 @@ text_select_project_modules: 'Selectionner les modules à activer pour ce projec text_default_administrator_account_changed: Compte administrateur par défaut changé text_file_repository_writable: Répertoire de stockage des fichiers accessible en écriture text_rmagick_available: Bibliothèque RMagick présente (optionnelle) +text_destroy_time_entries_question: %.02f heures ont été enregistrées sur les demandes à supprimer. Que voulez-vous faire ? +text_destroy_time_entries: Supprimer les heures +text_assign_time_entries_to_project: Reporter les heures sur le projet +text_reassign_time_entries: 'Reporter les heures sur cette demande:' default_role_manager: Manager default_role_developper: Développeur diff --git a/lang/he.yml b/lang/he.yml index 680364714..a43f1c022 100644 --- a/lang/he.yml +++ b/lang/he.yml @@ -602,3 +602,8 @@ label_yesterday: yesterday label_last_month: last month label_add_another_file: Add another file label_optional_description: Optional description +text_destroy_time_entries_question: %.02f hours were reported on the issues you are about to delete. What do you want to do ? +error_issue_not_found_in_project: 'The issue was not found or does not belong to this project' +text_assign_time_entries_to_project: Assign reported hours to the project +text_destroy_time_entries: Delete reported hours +text_reassign_time_entries: 'Reassign reported hours to this issue:' diff --git a/lang/it.yml b/lang/it.yml index b2eb1c9c6..80ffc5f6c 100644 --- a/lang/it.yml +++ b/lang/it.yml @@ -602,3 +602,8 @@ label_yesterday: yesterday label_last_month: last month label_add_another_file: Add another file label_optional_description: Optional description +text_destroy_time_entries_question: %.02f hours were reported on the issues you are about to delete. What do you want to do ? +error_issue_not_found_in_project: 'The issue was not found or does not belong to this project' +text_assign_time_entries_to_project: Assign reported hours to the project +text_destroy_time_entries: Delete reported hours +text_reassign_time_entries: 'Reassign reported hours to this issue:' diff --git a/lang/ja.yml b/lang/ja.yml index 2a742072d..d652f4b19 100644 --- a/lang/ja.yml +++ b/lang/ja.yml @@ -603,3 +603,8 @@ label_yesterday: yesterday label_last_month: last month label_add_another_file: Add another file label_optional_description: Optional description +text_destroy_time_entries_question: %.02f hours were reported on the issues you are about to delete. What do you want to do ? +error_issue_not_found_in_project: 'The issue was not found or does not belong to this project' +text_assign_time_entries_to_project: Assign reported hours to the project +text_destroy_time_entries: Delete reported hours +text_reassign_time_entries: 'Reassign reported hours to this issue:' diff --git a/lang/ko.yml b/lang/ko.yml index cce1480d8..12fa4b8fb 100644 --- a/lang/ko.yml +++ b/lang/ko.yml @@ -602,3 +602,8 @@ label_yesterday: yesterday label_last_month: last month label_add_another_file: Add another file label_optional_description: Optional description +text_destroy_time_entries_question: %.02f hours were reported on the issues you are about to delete. What do you want to do ? +error_issue_not_found_in_project: 'The issue was not found or does not belong to this project' +text_assign_time_entries_to_project: Assign reported hours to the project +text_destroy_time_entries: Delete reported hours +text_reassign_time_entries: 'Reassign reported hours to this issue:' diff --git a/lang/lt.yml b/lang/lt.yml index 7701280a0..5d26c7ea9 100644 --- a/lang/lt.yml +++ b/lang/lt.yml @@ -603,3 +603,8 @@ label_yesterday: yesterday label_last_month: last month label_add_another_file: Add another file label_optional_description: Optional description +text_destroy_time_entries_question: %.02f hours were reported on the issues you are about to delete. What do you want to do ? +error_issue_not_found_in_project: 'The issue was not found or does not belong to this project' +text_assign_time_entries_to_project: Assign reported hours to the project +text_destroy_time_entries: Delete reported hours +text_reassign_time_entries: 'Reassign reported hours to this issue:' diff --git a/lang/nl.yml b/lang/nl.yml index a0a5305e4..12563f2e4 100644 --- a/lang/nl.yml +++ b/lang/nl.yml @@ -603,3 +603,8 @@ label_yesterday: yesterday label_last_month: last month label_add_another_file: Add another file label_optional_description: Optional description +text_destroy_time_entries_question: %.02f hours were reported on the issues you are about to delete. What do you want to do ? +error_issue_not_found_in_project: 'The issue was not found or does not belong to this project' +text_assign_time_entries_to_project: Assign reported hours to the project +text_destroy_time_entries: Delete reported hours +text_reassign_time_entries: 'Reassign reported hours to this issue:' diff --git a/lang/pl.yml b/lang/pl.yml index 6de13aea4..575c8262a 100644 --- a/lang/pl.yml +++ b/lang/pl.yml @@ -602,3 +602,8 @@ label_yesterday: yesterday label_last_month: last month label_add_another_file: Add another file label_optional_description: Optional description +text_destroy_time_entries_question: %.02f hours were reported on the issues you are about to delete. What do you want to do ? +error_issue_not_found_in_project: 'The issue was not found or does not belong to this project' +text_assign_time_entries_to_project: Assign reported hours to the project +text_destroy_time_entries: Delete reported hours +text_reassign_time_entries: 'Reassign reported hours to this issue:' diff --git a/lang/pt-br.yml b/lang/pt-br.yml index 83b640a43..d128617da 100644 --- a/lang/pt-br.yml +++ b/lang/pt-br.yml @@ -602,3 +602,8 @@ label_yesterday: yesterday label_last_month: last month label_add_another_file: Add another file label_optional_description: Optional description +text_destroy_time_entries_question: %.02f hours were reported on the issues you are about to delete. What do you want to do ? +error_issue_not_found_in_project: 'The issue was not found or does not belong to this project' +text_assign_time_entries_to_project: Assign reported hours to the project +text_destroy_time_entries: Delete reported hours +text_reassign_time_entries: 'Reassign reported hours to this issue:' diff --git a/lang/pt.yml b/lang/pt.yml index e100d153e..33b76892b 100644 --- a/lang/pt.yml +++ b/lang/pt.yml @@ -602,3 +602,8 @@ label_yesterday: yesterday label_last_month: last month label_add_another_file: Add another file label_optional_description: Optional description +text_destroy_time_entries_question: %.02f hours were reported on the issues you are about to delete. What do you want to do ? +error_issue_not_found_in_project: 'The issue was not found or does not belong to this project' +text_assign_time_entries_to_project: Assign reported hours to the project +text_destroy_time_entries: Delete reported hours +text_reassign_time_entries: 'Reassign reported hours to this issue:' diff --git a/lang/ro.yml b/lang/ro.yml index 142a2a84f..b8b737e42 100644 --- a/lang/ro.yml +++ b/lang/ro.yml @@ -602,3 +602,8 @@ label_yesterday: yesterday label_last_month: last month label_add_another_file: Add another file label_optional_description: Optional description +text_destroy_time_entries_question: %.02f hours were reported on the issues you are about to delete. What do you want to do ? +error_issue_not_found_in_project: 'The issue was not found or does not belong to this project' +text_assign_time_entries_to_project: Assign reported hours to the project +text_destroy_time_entries: Delete reported hours +text_reassign_time_entries: 'Reassign reported hours to this issue:' diff --git a/lang/ru.yml b/lang/ru.yml index 83e63115f..93fbd3b74 100644 --- a/lang/ru.yml +++ b/lang/ru.yml @@ -606,3 +606,8 @@ label_yesterday: yesterday label_last_month: last month label_add_another_file: Add another file label_optional_description: Optional description +text_destroy_time_entries_question: %.02f hours were reported on the issues you are about to delete. What do you want to do ? +error_issue_not_found_in_project: 'The issue was not found or does not belong to this project' +text_assign_time_entries_to_project: Assign reported hours to the project +text_destroy_time_entries: Delete reported hours +text_reassign_time_entries: 'Reassign reported hours to this issue:' diff --git a/lang/sr.yml b/lang/sr.yml index 2cd92607f..16e870b76 100644 --- a/lang/sr.yml +++ b/lang/sr.yml @@ -603,3 +603,8 @@ label_yesterday: yesterday label_last_month: last month label_add_another_file: Add another file label_optional_description: Optional description +text_destroy_time_entries_question: %.02f hours were reported on the issues you are about to delete. What do you want to do ? +error_issue_not_found_in_project: 'The issue was not found or does not belong to this project' +text_assign_time_entries_to_project: Assign reported hours to the project +text_destroy_time_entries: Delete reported hours +text_reassign_time_entries: 'Reassign reported hours to this issue:' diff --git a/lang/sv.yml b/lang/sv.yml index a9b30ae2f..3375a6850 100644 --- a/lang/sv.yml +++ b/lang/sv.yml @@ -603,3 +603,8 @@ label_yesterday: yesterday label_last_month: last month label_add_another_file: Add another file label_optional_description: Optional description +text_destroy_time_entries_question: %.02f hours were reported on the issues you are about to delete. What do you want to do ? +error_issue_not_found_in_project: 'The issue was not found or does not belong to this project' +text_assign_time_entries_to_project: Assign reported hours to the project +text_destroy_time_entries: Delete reported hours +text_reassign_time_entries: 'Reassign reported hours to this issue:' diff --git a/lang/uk.yml b/lang/uk.yml index 0be41cf04..2fd3589f5 100644 --- a/lang/uk.yml +++ b/lang/uk.yml @@ -604,3 +604,8 @@ label_yesterday: yesterday label_last_month: last month label_add_another_file: Add another file label_optional_description: Optional description +text_destroy_time_entries_question: %.02f hours were reported on the issues you are about to delete. What do you want to do ? +error_issue_not_found_in_project: 'The issue was not found or does not belong to this project' +text_assign_time_entries_to_project: Assign reported hours to the project +text_destroy_time_entries: Delete reported hours +text_reassign_time_entries: 'Reassign reported hours to this issue:' diff --git a/lang/zh-tw.yml b/lang/zh-tw.yml index c63e6c3bf..070aa290c 100644 --- a/lang/zh-tw.yml +++ b/lang/zh-tw.yml @@ -602,3 +602,8 @@ label_yesterday: yesterday label_last_month: last month label_add_another_file: Add another file label_optional_description: Optional description +text_destroy_time_entries_question: %.02f hours were reported on the issues you are about to delete. What do you want to do ? +error_issue_not_found_in_project: 'The issue was not found or does not belong to this project' +text_assign_time_entries_to_project: Assign reported hours to the project +text_destroy_time_entries: Delete reported hours +text_reassign_time_entries: 'Reassign reported hours to this issue:' diff --git a/lang/zh.yml b/lang/zh.yml index a50d8be48..6b2e64abd 100644 --- a/lang/zh.yml +++ b/lang/zh.yml @@ -605,3 +605,8 @@ label_yesterday: yesterday label_last_month: last month label_add_another_file: Add another file label_optional_description: Optional description +text_destroy_time_entries_question: %.02f hours were reported on the issues you are about to delete. What do you want to do ? +error_issue_not_found_in_project: 'The issue was not found or does not belong to this project' +text_assign_time_entries_to_project: Assign reported hours to the project +text_destroy_time_entries: Delete reported hours +text_reassign_time_entries: 'Reassign reported hours to this issue:' diff --git a/test/functional/issues_controller_test.rb b/test/functional/issues_controller_test.rb index 34b030d98..da8118668 100644 --- a/test/functional/issues_controller_test.rb +++ b/test/functional/issues_controller_test.rb @@ -37,7 +37,8 @@ class IssuesControllerTest < Test::Unit::TestCase :workflows, :custom_fields, :custom_values, - :custom_fields_trackers + :custom_fields_trackers, + :time_entries def setup @controller = IssuesController.new @@ -428,13 +429,48 @@ class IssuesControllerTest < Test::Unit::TestCase :class => 'icon-del disabled' } end - def test_destroy + def test_destroy_issue_with_no_time_entries @request.session[:user_id] = 2 - post :destroy, :id => 1 + post :destroy, :id => 3 assert_redirected_to 'projects/ecookbook/issues' - assert_nil Issue.find_by_id(1) + assert_nil Issue.find_by_id(3) end + def test_destroy_issues_with_time_entries + @request.session[:user_id] = 2 + post :destroy, :ids => [1, 3] + assert_response :success + assert_template 'destroy' + assert_not_nil assigns(:hours) + assert Issue.find_by_id(1) && Issue.find_by_id(3) + end + + def test_destroy_issues_and_destroy_time_entries + @request.session[:user_id] = 2 + post :destroy, :ids => [1, 3], :todo => 'destroy' + assert_redirected_to 'projects/ecookbook/issues' + assert !(Issue.find_by_id(1) || Issue.find_by_id(3)) + assert_nil TimeEntry.find_by_id([1, 2]) + end + + def test_destroy_issues_and_assign_time_entries_to_project + @request.session[:user_id] = 2 + post :destroy, :ids => [1, 3], :todo => 'nullify' + assert_redirected_to 'projects/ecookbook/issues' + assert !(Issue.find_by_id(1) || Issue.find_by_id(3)) + assert_nil TimeEntry.find(1).issue_id + assert_nil TimeEntry.find(2).issue_id + end + + def test_destroy_issues_and_reassign_time_entries_to_another_issue + @request.session[:user_id] = 2 + post :destroy, :ids => [1, 3], :todo => 'reassign', :reassign_to_id => 2 + assert_redirected_to 'projects/ecookbook/issues' + assert !(Issue.find_by_id(1) || Issue.find_by_id(3)) + assert_equal 2, TimeEntry.find(1).issue_id + assert_equal 2, TimeEntry.find(2).issue_id + end + def test_destroy_attachment issue = Issue.find(3) a = issue.attachments.size diff --git a/test/unit/issue_test.rb b/test/unit/issue_test.rb index da91dd02c..7712b764e 100644 --- a/test/unit/issue_test.rb +++ b/test/unit/issue_test.rb @@ -70,4 +70,10 @@ class IssueTest < Test::Unit::TestCase # Make sure time entries were move to the target project assert_equal 2, issue.time_entries.first.project_id end + + def test_issue_destroy + Issue.find(1).destroy + assert_nil Issue.find_by_id(1) + assert_nil TimeEntry.find_by_issue_id(1) + end end -- 2.39.5