Merge pull request #3009 from evazion/fix-dmails-search

Fix #1868: Dmail search improvements: subject, searchbox
This commit is contained in:
Albert Yi
2017-05-01 14:05:22 -07:00
committed by GitHub
7 changed files with 27 additions and 26 deletions

View File

@@ -74,9 +74,14 @@ class DmailTest < ActiveSupport::TestCase
context "search" do
should "return results based on title contents" do
dmail = FactoryGirl.create(:dmail, :title => "xxx", :owner => @user)
matches = Dmail.search_message("xxx")
assert(matches.any?)
matches = Dmail.search_message("aaa")
matches = Dmail.search(title_matches: "x")
assert_equal([dmail.id], matches.map(&:id))
matches = Dmail.search(message_matches: "xxx")
assert_equal([dmail.id], matches.map(&:id))
matches = Dmail.search(message_matches: "aaa")
assert(matches.empty?)
end