add test cases

This commit is contained in:
albert
2013-03-06 19:24:58 -05:00
parent ea754b78eb
commit d38c423065
3 changed files with 32 additions and 2 deletions

View File

@@ -149,9 +149,9 @@ class PostQueryBuilder
relation = relation.where("(posts.source = '' OR posts.source IS NULL)")
elsif q[:source] =~ /^(pixiv\/|%\.?pixiv(\.net(\/img)?)?(%\/|(?=%$)))(.+)$/
if $5 == "%"
relation = relation.where("substring(posts.source, 'pixiv.net/img.*/([^/]*/[^/]*)$') IS NOT NULL")
relation = relation.where("substring(posts.source, 'pixiv.net/img.*/([^/]*/[^/]*)$') IS NOT NULL")
else
relation = relation.where("substring(posts.source, 'pixiv.net/img.*/([^/]*/[^/]*)$') LIKE ? ESCAPE E'\\\\'", $5)
relation = relation.where("substring(posts.source, 'pixiv.net/img.*/([^/]*/[^/]*)$') LIKE ? ESCAPE E'\\\\'", $5)
end
has_constraints!
else