summaryrefslogtreecommitdiffstats
path: root/test/unit
diff options
context:
space:
mode:
authorJean-Philippe Lang <jp_lang@yahoo.fr>2012-01-29 22:39:06 +0000
committerJean-Philippe Lang <jp_lang@yahoo.fr>2012-01-29 22:39:06 +0000
commit24138187eb130b15d5b2b9f7bd6f701b2be6c00a (patch)
tree472ca1d96d538420fc537b743c5ac3b925723044 /test/unit
parent992aebf6dfe9ca92d43e1022102f5c888631a6f4 (diff)
downloadredmine-24138187eb130b15d5b2b9f7bd6f701b2be6c00a.tar.gz
redmine-24138187eb130b15d5b2b9f7bd6f701b2be6c00a.zip
Allows attachments on news (#1972).
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@8728 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'test/unit')
-rw-r--r--test/unit/news_test.rb15
1 files changed, 15 insertions, 0 deletions
diff --git a/test/unit/news_test.rb b/test/unit/news_test.rb
index 31298225c..fd0063efb 100644
--- a/test/unit/news_test.rb
+++ b/test/unit/news_test.rb
@@ -71,4 +71,19 @@ class NewsTest < ActiveSupport::TestCase
10.times { projects(:projects_001).news.create(valid_news) }
assert_equal 5, News.latest(users(:users_004)).size
end
+
+ def test_attachments_should_be_visible
+ assert News.find(1).attachments_visible?(User.anonymous)
+ end
+
+ def test_attachments_should_be_deletable_with_manage_news_permission
+ manager = User.find(2)
+ assert News.find(1).attachments_deletable?(manager)
+ end
+
+ def test_attachments_should_not_be_deletable_without_manage_news_permission
+ manager = User.find(2)
+ Role.find_by_name('Manager').remove_permission!(:manage_news)
+ assert !News.find(1).attachments_deletable?(manager)
+ end
end