flags: disallow flagging pending posts.

This commit is contained in:
evazion
2017-05-19 14:37:38 -05:00
parent a4220854a3
commit 2259506bc2
3 changed files with 22 additions and 0 deletions

View File

@@ -86,6 +86,20 @@ class PostTest < ActiveSupport::TestCase
end
end
context "that is pending" do
setup do
@post = FactoryGirl.create(:post, is_pending: true)
end
should "succeed" do
@post.delete!("test")
assert_equal(true, @post.is_deleted)
assert_equal(1, @post.flags.size)
assert_match(/test/, @post.flags.last.reason)
end
end
context "with the banned_artist tag" do
should "also ban the post" do
post = FactoryGirl.create(:post, :tag_string => "banned_artist")