summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorMarius Balteanu <marius.balteanu@zitec.com>2022-02-24 19:44:36 +0000
committerMarius Balteanu <marius.balteanu@zitec.com>2022-02-24 19:44:36 +0000
commit96d32a522652a29aaddb5c6ec727c7780004afff (patch)
tree045ba9137d1ed541531f1450dd88ac553953e638 /test
parent1db2566ff95c72c6e86e2c406b2bc7827a85dc46 (diff)
downloadredmine-96d32a522652a29aaddb5c6ec727c7780004afff.tar.gz
redmine-96d32a522652a29aaddb5c6ec727c7780004afff.zip
Destroy overridden time entry activities and rows from the habtm join table @queries_roles@ on project deletion (#36416).
Patch by Holger Just. git-svn-id: http://svn.redmine.org/redmine/trunk@21437 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'test')
-rw-r--r--test/unit/project_test.rb10
1 files changed, 10 insertions, 0 deletions
diff --git a/test/unit/project_test.rb b/test/unit/project_test.rb
index 676029a14..cf457a48c 100644
--- a/test/unit/project_test.rb
+++ b/test/unit/project_test.rb
@@ -233,6 +233,12 @@ class ProjectTest < ActiveSupport::TestCase
# some boards
assert @ecookbook.boards.any?
+ # generate some dependent objects
+ overridden_activity = TimeEntryActivity.new({:name => "Project", :project => @ecookbook})
+ assert overridden_activity.save!
+
+ query = IssueQuery.generate!(:project => @ecookbook, :visibility => Query::VISIBILITY_ROLES, :roles => Role.where(:id => [1, 3]).to_a)
+
@ecookbook.destroy
# make sure that the project non longer exists
assert_raise(ActiveRecord::RecordNotFound) {Project.find(@ecookbook.id)}
@@ -240,6 +246,10 @@ class ProjectTest < ActiveSupport::TestCase
assert_not Member.where(:project_id => @ecookbook.id).exists?
assert_not Board.where(:project_id => @ecookbook.id).exists?
assert_not Issue.where(:project_id => @ecookbook.id).exists?
+ assert_not Enumeration.where(:project_id => @ecookbook.id).exists?
+
+ assert_not Query.where(:project_id => @ecookbook.id).exists?
+ assert_nil ActiveRecord::Base.connection.select_value("SELECT 1 FROM queries_roles WHERE query_id = #{query.id}")
end
def test_destroy_should_destroy_subtasks