dmails: add title search test.
This commit is contained in:
@@ -74,9 +74,14 @@ class DmailTest < ActiveSupport::TestCase
|
|||||||
context "search" do
|
context "search" do
|
||||||
should "return results based on title contents" do
|
should "return results based on title contents" do
|
||||||
dmail = FactoryGirl.create(:dmail, :title => "xxx", :owner => @user)
|
dmail = FactoryGirl.create(:dmail, :title => "xxx", :owner => @user)
|
||||||
matches = Dmail.search_message("xxx")
|
|
||||||
assert(matches.any?)
|
matches = Dmail.search(title_matches: "x")
|
||||||
matches = Dmail.search_message("aaa")
|
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?)
|
assert(matches.empty?)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user