improved test for destroy project

This commit is contained in:
Alexander Meindl 2022-01-10 18:02:26 +01:00
parent 7f9b26eb53
commit 53b21ee310

View File

@ -52,12 +52,14 @@ class ProjectTest < Additionals::TestCase
# dashboards # dashboards
assert @ecookbook.dashboards.any? assert @ecookbook.dashboards.any?
assert_difference 'Dashboard.count', -2 do
@ecookbook.destroy @ecookbook.destroy
# make sure that the project non longer exists # make sure that the project non longer exists
assert_raise(ActiveRecord::RecordNotFound) { Project.find @ecookbook.id } assert_raise(ActiveRecord::RecordNotFound) { Project.find @ecookbook.id }
# make sure related data was removed # make sure related data was removed
assert_nil Dashboard.where(project_id: @ecookbook.id).first assert_nil Dashboard.where(project_id: @ecookbook.id).first
end end
end
def test_users_by_role def test_users_by_role
users_by_role = if Redmine::VERSION.to_s >= '4.2' users_by_role = if Redmine::VERSION.to_s >= '4.2'