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,11 +52,13 @@ class ProjectTest < Additionals::TestCase
# dashboards # dashboards
assert @ecookbook.dashboards.any? assert @ecookbook.dashboards.any?
@ecookbook.destroy assert_difference 'Dashboard.count', -2 do
# make sure that the project non longer exists @ecookbook.destroy
assert_raise(ActiveRecord::RecordNotFound) { Project.find @ecookbook.id } # make sure that the project non longer exists
# make sure related data was removed assert_raise(ActiveRecord::RecordNotFound) { Project.find @ecookbook.id }
assert_nil Dashboard.where(project_id: @ecookbook.id).first # make sure related data was removed
assert_nil Dashboard.where(project_id: @ecookbook.id).first
end
end end
def test_users_by_role def test_users_by_role