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