From 7a05f8ed66918e13315e647ecea620a716c4cbeb Mon Sep 17 00:00:00 2001 From: Jean-Philippe Lang Date: Tue, 11 Nov 2008 15:07:55 +0000 Subject: Adds permissions to let users edit and/or delete their messages (#854, patch by Markus Knittig with slight changes). git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@2019 e93f8b46-1217-0410-a6f0-8f06a7374b81 --- test/unit/message_test.rb | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) (limited to 'test/unit/message_test.rb') diff --git a/test/unit/message_test.rb b/test/unit/message_test.rb index 6e8e8fb26..b907cfef3 100644 --- a/test/unit/message_test.rb +++ b/test/unit/message_test.rb @@ -1,7 +1,7 @@ require File.dirname(__FILE__) + '/../test_helper' class MessageTest < Test::Unit::TestCase - fixtures :projects, :boards, :messages, :users, :watchers + fixtures :projects, :roles, :members, :boards, :messages, :users, :watchers def setup @board = Board.find(1) @@ -76,4 +76,22 @@ class MessageTest < Test::Unit::TestCase assert_equal topics_count, board.topics_count assert_equal messages_count - 1, board.messages_count end + + def test_editable_by + message = Message.find(6) + author = message.author + assert message.editable_by?(author) + + author.role_for_project(message.project).remove_permission!(:edit_own_messages) + assert !message.reload.editable_by?(author.reload) + end + + def test_destroyable_by + message = Message.find(6) + author = message.author + assert message.destroyable_by?(author) + + author.role_for_project(message.project).remove_permission!(:delete_own_messages) + assert !message.reload.destroyable_by?(author.reload) + end end -- cgit v1.2.3