Add tests for noter:<any|none>, comm:<any|none> metatags.

This commit is contained in:
evazion
2017-04-25 18:01:12 -05:00
parent b0626a9124
commit 25aaef5afe
2 changed files with 33 additions and 6 deletions

View File

@@ -1788,6 +1788,24 @@ class PostTest < ActiveSupport::TestCase
assert_tag_match([posts[2]], "approver:none")
end
should "return posts for the commenter:<name> metatag" do
users = FactoryGirl.create_list(:user, 2, created_at: 2.weeks.ago)
posts = FactoryGirl.create_list(:post, 2)
comms = users.zip(posts).map { |u, p| FactoryGirl.create(:comment, creator: u, post: p) }
assert_tag_match([posts[0]], "commenter:#{users[0].name}")
assert_tag_match([posts[1]], "commenter:#{users[1].name}")
end
should "return posts for the commenter:<any|none> metatag" do
posts = FactoryGirl.create_list(:post, 2)
FactoryGirl.create(:comment, post: posts[0], is_deleted: false)
FactoryGirl.create(:comment, post: posts[1], is_deleted: true)
assert_tag_match([posts[0]], "commenter:any")
assert_tag_match([posts[1]], "commenter:none")
end
should "return posts for the noter:<name> metatag" do
users = FactoryGirl.create_list(:user, 2)
posts = FactoryGirl.create_list(:post, 2)
@@ -1797,6 +1815,15 @@ class PostTest < ActiveSupport::TestCase
assert_tag_match([posts[1]], "noter:#{users[1].name}")
end
should "return posts for the noter:<any|none> metatag" do
posts = FactoryGirl.create_list(:post, 2)
FactoryGirl.create(:note, post: posts[0], is_active: true)
FactoryGirl.create(:note, post: posts[1], is_active: false)
assert_tag_match([posts[0]], "noter:any")
assert_tag_match([posts[1]], "noter:none")
end
should "return posts for the artcomm:<name> metatag" do
users = FactoryGirl.create_list(:user, 2)
posts = FactoryGirl.create_list(:post, 2)