Merge pull request #3701 from evazion/fix-3579

Fix #3579: Add post approval index
This commit is contained in:
Albert Yi
2018-05-07 17:36:41 -07:00
committed by GitHub
11 changed files with 147 additions and 31 deletions

View File

@@ -7,7 +7,7 @@ class PostApprovalTest < ActiveSupport::TestCase
CurrentUser.user = @user
CurrentUser.ip_addr = "127.0.0.1"
@post = FactoryBot.create(:post, uploader_id: @user.id, is_pending: true)
@post = FactoryBot.create(:post, uploader_id: @user.id, tag_string: "touhou", is_pending: true)
@approver = FactoryBot.create(:user)
@approver.can_approve_posts = true
@@ -58,5 +58,14 @@ class PostApprovalTest < ActiveSupport::TestCase
end
end
end
context "#search method" do
should "work" do
@approval = @post.approve!(@approver)
@approvals = PostApproval.search(user_name: @approver.name, post_tags_match: "touhou", post_id: @post.id)
assert_equal([@approval.id], @approvals.map(&:id))
end
end
end
end