Fix Post.fast_count("pool:1537") == 0 (fixup 134958d1).

Fixup for a bug in 134958d1. `Post.fast_count("pool:1537")` still
returned zero because `Tag.is_simple_tag?` incorrectly parsed
"pool:1537" as a simple tag, so Post.fast_count still looked for it in
the tags table and found the empty "pool:1537" tag.
This commit is contained in:
evazion
2017-11-20 20:19:29 -06:00
parent 91147bba88
commit b3a9cd6c06
3 changed files with 50 additions and 2 deletions

View File

@@ -2405,6 +2405,13 @@ class PostTest < ActiveSupport::TestCase
assert_equal(100, Post.fast_count("score:42"))
end
should "return the correct cached count for a pool:<id> search" do
FactoryGirl.build(:tag, name: "pool:1234", post_count: -100).save(validate: false)
Post.set_count_in_cache("pool:1234", 100)
assert_equal(100, Post.fast_count("pool:1234"))
end
end
context "a multi-tag search" do