add additional mod actions

This commit is contained in:
Albert Yi
2017-01-03 16:02:36 -08:00
parent 4d698bf98b
commit b9a1e115fb
7 changed files with 54 additions and 3 deletions

View File

@@ -38,6 +38,12 @@ FactoryGirl.define do
bit_prefs User.flag_value_for("can_upload_free")
end
factory(:contrib_user) do
level 32
bit_prefs User.flag_value_for("can_upload_free")
end
factory(:janitor_user) do
level 35
can_approve_posts true
@@ -48,6 +54,11 @@ FactoryGirl.define do
can_approve_posts true
end
factory(:mod_user) do
level 40
can_approve_posts true
end
factory(:admin_user) do
level 50
can_approve_posts true

View File

@@ -14,7 +14,6 @@ class CommentTest < ActiveSupport::TestCase
CurrentUser.ip_addr = nil
end
context "that mentions a user" do
setup do
@post = FactoryGirl.create(:post)
@@ -206,6 +205,21 @@ class CommentTest < ActiveSupport::TestCase
assert_equal(c1.id, matches.all[1].id)
end
context "that is edited by a moderator" do
setup do
@post = FactoryGirl.create(:post)
@comment = FactoryGirl.create(:comment, :post_id => @post.id)
@mod = FactoryGirl.create(:moderator_user)
CurrentUser.user = @mod
end
should "create a mod action" do
assert_difference("ModAction.count") do
@comment.update_attributes({:body => "nope"}, :as => :moderator)
end
end
end
context "that is below the score threshold" do
should "be hidden if not stickied" do
user = FactoryGirl.create(:user, :comment_threshold => 0)