Fix search
class method for IssueCommonality
Also adds specs to the two affected classes that would have caught my dumb mistake.
This commit is contained in:
parent
f36f0dac9d
commit
b7f9b8223e
3 changed files with 21 additions and 2 deletions
|
@ -36,8 +36,10 @@ module IssueCommonality
|
|||
attr_accessor :author_id_of_changes
|
||||
end
|
||||
|
||||
def self.search query
|
||||
where("title like :query", :query => "%#{query}%")
|
||||
module ClassMethods
|
||||
def search(query)
|
||||
where("title like :query", :query => "%#{query}%")
|
||||
end
|
||||
end
|
||||
|
||||
def today?
|
||||
|
|
|
@ -106,6 +106,14 @@ describe Issue do
|
|||
end
|
||||
end
|
||||
|
||||
describe ".search" do
|
||||
let!(:issue) { Factory.create(:issue, :title => "Searchable issue",
|
||||
:project => Factory.create(:project)) }
|
||||
|
||||
it "matches by title" do
|
||||
Issue.search('able').all.should == [issue]
|
||||
end
|
||||
end
|
||||
end
|
||||
# == Schema Information
|
||||
#
|
||||
|
|
|
@ -56,6 +56,15 @@ describe MergeRequest do
|
|||
subject.upvotes.should == 2
|
||||
end
|
||||
end
|
||||
|
||||
describe ".search" do
|
||||
let!(:issue) { Factory.create(:issue, :title => "Searchable issue",
|
||||
:project => Factory.create(:project)) }
|
||||
|
||||
it "matches by title" do
|
||||
Issue.search('able').all.should == [issue]
|
||||
end
|
||||
end
|
||||
end
|
||||
# == Schema Information
|
||||
#
|
||||
|
|
Loading…
Reference in a new issue