wiki pages: add wildcard support to "other names" search.

This commit is contained in:
evazion
2017-05-23 20:59:48 -05:00
parent f93cd11fb5
commit 1a52f9db2b
4 changed files with 20 additions and 7 deletions

View File

@@ -47,7 +47,7 @@ class WikiPageTest < ActiveSupport::TestCase
setup do
@user = FactoryGirl.create(:user)
CurrentUser.user = @user
@wiki_page = FactoryGirl.create(:wiki_page, :title => "HOT POTATO")
@wiki_page = FactoryGirl.create(:wiki_page, :title => "HOT POTATO", :other_names => "foo*bar baz")
end
should "not allow the is_locked attribute to be updated" do
@@ -67,6 +67,11 @@ class WikiPageTest < ActiveSupport::TestCase
assert_equal("hot_potato", matches.first.title)
end
should "search other names with wildcards" do
matches = WikiPage.search(other_names_match: "fo*")
assert_equal([@wiki_page.id], matches.map(&:id))
end
should "create versions" do
assert_difference("WikiPageVersion.count") do
@wiki_page = FactoryGirl.create(:wiki_page, :title => "xxx")