summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'test/unit/comment_test.rb')
-rw-r--r--test/unit/comment_test.rb54
1 files changed, 0 insertions, 54 deletions
diff --git a/test/unit/comment_test.rb b/test/unit/comment_test.rb
deleted file mode 100644
index 6e0de8b..0000000
--- a/test/unit/comment_test.rb
+++ /dev/null
@@ -1,54 +0,0 @@
-require 'test_helper'
-
-class CommentTest < ActiveSupport::TestCase
- fixtures :all
-
- test "padawans should not be able to make approvals" do
- c = Comment.new
- c.glsa_id = 1
- c.user = users(:test_padawan)
- c.text = "test"
- c.rating = "approval"
- c.save
-
- assert c.errors.any?
- assert_includes c.errors[:rating], "You may not approve or reject drafts"
- end
-
- test "padawans should not be able to make rejections" do
- c = Comment.new
- c.glsa_id = 1
- c.user = users(:test_padawan)
- c.text = "test"
- c.rating = "rejection"
- c.save
-
- assert c.errors.any?
- assert_includes c.errors[:rating], "You may not approve or reject drafts"
- end
-
- test "advisory owners should not be able to approve their own drafts" do
- c = Comment.new
- c.user_id = 1
- c.text = "test"
- c.rating = "approval"
- c.glsa_id = 2
- c.save
-
- assert c.errors.any?
- assert_equal ["The owner of a draft cannot make approvals or rejections"], c.errors[:rating]
- end
-
- test "users should not be able to approve a draft twice" do
- # second comment loaded from fixtures
- c = Comment.new
- c.user_id = 7
- c.text = "test"
- c.rating = "approval"
- c.glsa_id = 2
- c.save
-
- assert c.errors.any?
- assert_equal ["You have already approved or rejected this draft"], c.errors[:rating]
- end
-end