refactored post search
This commit is contained in:
@@ -830,6 +830,20 @@ class PostTest < ActiveSupport::TestCase
|
||||
relation = Post.tag_match("order:landscape")
|
||||
assert_equal(post3.id, relation.first.id)
|
||||
end
|
||||
|
||||
should "fail for exclusive tag searches with no other tag" do
|
||||
post1 = Factory.create(:post, :rating => "s", :tag_string => "aaa")
|
||||
assert_raise(::Post::SearchError) do
|
||||
relation = Post.tag_match("-aaa")
|
||||
end
|
||||
end
|
||||
|
||||
should "succeed for exclusive tag searches combined with a metatag" do
|
||||
post1 = Factory.create(:post, :rating => "s", :tag_string => "aaa")
|
||||
assert_nothing_raised do
|
||||
relation = Post.tag_match("-aaa id:>0")
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
context "Voting:" do
|
||||
|
||||
@@ -31,6 +31,8 @@ class TagAliasTest < ActiveSupport::TestCase
|
||||
tag1 = Factory.create(:tag, :name => "aaa")
|
||||
tag2 = Factory.create(:tag, :name => "bbb")
|
||||
ta = FactoryGirl.create(:tag_alias, :antecedent_name => "aaa", :consequent_name => "bbb")
|
||||
assert_nil(MEMCACHE.get("ta:aaa"))
|
||||
ta.update_cache
|
||||
assert_equal("bbb", MEMCACHE.get("ta:aaa"))
|
||||
ta.destroy
|
||||
assert_nil(MEMCACHE.get("ta:aaa"))
|
||||
|
||||
Reference in New Issue
Block a user