summaryrefslogtreecommitdiffstats
path: root/test/unit/role_test.rb
diff options
context:
space:
mode:
Diffstat (limited to 'test/unit/role_test.rb')
-rw-r--r--test/unit/role_test.rb13
1 files changed, 13 insertions, 0 deletions
diff --git a/test/unit/role_test.rb b/test/unit/role_test.rb
index 78d957821..8a1eb76d3 100644
--- a/test/unit/role_test.rb
+++ b/test/unit/role_test.rb
@@ -152,4 +152,17 @@ class RoleTest < ActiveSupport::TestCase
assert_equal Role::BUILTIN_NON_MEMBER, role.builtin
end
end
+
+ def test_destroy
+ role = Role.generate!
+
+ # generate some dependent objects
+ query = IssueQuery.generate!(:project => @ecookbook, :visibility => Query::VISIBILITY_ROLES, :roles => Role.where(:id => [1, 3, role.id]).to_a)
+
+ role.destroy
+
+ # make sure some related data was removed
+ assert_nil ActiveRecord::Base.connection.select_value("SELECT 1 FROM queries_roles WHERE role_id = #{role.id}")
+ assert [1, 3], query.roles
+ end
end