Skip to content
Snippets Groups Projects
Commit b7f9b822 authored by Robert Speicher's avatar Robert Speicher
Browse files

Fix `search` class method for IssueCommonality

Also adds specs to the two affected classes that would have caught my
dumb mistake.
parent f36f0dac
No related branches found
No related tags found
No related merge requests found
Loading
@@ -36,8 +36,10 @@ module IssueCommonality
Loading
@@ -36,8 +36,10 @@ module IssueCommonality
attr_accessor :author_id_of_changes attr_accessor :author_id_of_changes
end end
   
def self.search query module ClassMethods
where("title like :query", :query => "%#{query}%") def search(query)
where("title like :query", :query => "%#{query}%")
end
end end
   
def today? def today?
Loading
Loading
Loading
@@ -106,6 +106,14 @@ describe Issue do
Loading
@@ -106,6 +106,14 @@ describe Issue do
end end
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 end
# == Schema Information # == Schema Information
# #
Loading
Loading
Loading
@@ -56,6 +56,15 @@ describe MergeRequest do
Loading
@@ -56,6 +56,15 @@ describe MergeRequest do
subject.upvotes.should == 2 subject.upvotes.should == 2
end end
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 end
# == Schema Information # == Schema Information
# #
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment