diff options
author | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2008-11-11 15:07:55 +0000 |
---|---|---|
committer | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2008-11-11 15:07:55 +0000 |
commit | 7a05f8ed66918e13315e647ecea620a716c4cbeb (patch) | |
tree | cb5098c39034e87ee3a22df22da2da087a29c6c8 /test/unit/message_test.rb | |
parent | cbacc71dff75f6abd6bfc5c4c4200b6c08528e0a (diff) | |
download | redmine-7a05f8ed66918e13315e647ecea620a716c4cbeb.tar.gz redmine-7a05f8ed66918e13315e647ecea620a716c4cbeb.zip |
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
Diffstat (limited to 'test/unit/message_test.rb')
-rw-r--r-- | test/unit/message_test.rb | 20 |
1 files changed, 19 insertions, 1 deletions
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 |