dmails: add title search test.

This commit is contained in:
evazion
2017-04-29 11:48:32 -05:00
parent 0652b907a9
commit e31f8acc34

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