additional checks on forum topic visibility

This commit is contained in:
Albert Yi
2016-11-04 16:24:54 -07:00
parent a22a7c3302
commit eb6746a8a8
9 changed files with 35 additions and 11 deletions

View File

@@ -18,7 +18,9 @@ class ForumTopicsControllerTest < ActionController::TestCase
context "for a level restricted topic" do
setup do
@forum_topic.update_attribute(:min_level, 50)
CurrentUser.user = @mod
@forum_topic.update_attribute(:min_level, User::Levels::MODERATOR)
CurrentUser.user = @user
end
should "not allow users to see the topic" do
@@ -42,7 +44,9 @@ class ForumTopicsControllerTest < ActionController::TestCase
assert_equal(false, @gold_user.reload.has_forum_been_updated?)
# Then adding an unread private topic should not bump.
FactoryGirl.create(:forum_post, :topic_id => @forum_topic.id)
CurrentUser.scoped(@mod) do
FactoryGirl.create(:forum_post, :topic_id => @forum_topic.id)
end
assert_equal(false, @gold_user.reload.has_forum_been_updated?)
end
end