Commit c5c906fe authored by Dmitriy Zaporozhets's avatar Dmitriy Zaporozhets
parent 7f4b9937
...@@ -8,7 +8,7 @@ module Gitlab ...@@ -8,7 +8,7 @@ module Gitlab
@query = Shellwords.shellescape(query) if query.present? @query = Shellwords.shellescape(query) if query.present?
end end
def objects(scope, page) def objects(scope, page = nil)
case scope case scope
when 'notes' when 'notes'
notes.page(page).per(per_page) notes.page(page).per(per_page)
......
...@@ -11,7 +11,7 @@ module Gitlab ...@@ -11,7 +11,7 @@ module Gitlab
@query = Shellwords.shellescape(query) if query.present? @query = Shellwords.shellescape(query) if query.present?
end end
def objects(scope, page) def objects(scope, page = nil)
case scope case scope
when 'projects' when 'projects'
projects.page(page).per(per_page) projects.page(page).per(per_page)
......
...@@ -19,7 +19,7 @@ describe 'Search::GlobalService' do ...@@ -19,7 +19,7 @@ describe 'Search::GlobalService' do
it 'should return public projects only' do it 'should return public projects only' do
context = Search::GlobalService.new(nil, search: "searchable") context = Search::GlobalService.new(nil, search: "searchable")
results = context.execute results = context.execute
results[:projects].should match_array [public_project] results.objects('projects').should match_array [public_project]
end end
end end
...@@ -27,19 +27,19 @@ describe 'Search::GlobalService' do ...@@ -27,19 +27,19 @@ describe 'Search::GlobalService' do
it 'should return public, internal and private projects' do it 'should return public, internal and private projects' do
context = Search::GlobalService.new(user, search: "searchable") context = Search::GlobalService.new(user, search: "searchable")
results = context.execute results = context.execute
results[:projects].should match_array [public_project, found_project, internal_project] results.objects('projects').should match_array [public_project, found_project, internal_project]
end end
it 'should return only public & internal projects' do it 'should return only public & internal projects' do
context = Search::GlobalService.new(internal_user, search: "searchable") context = Search::GlobalService.new(internal_user, search: "searchable")
results = context.execute results = context.execute
results[:projects].should match_array [internal_project, public_project] results.objects('projects').should match_array [internal_project, public_project]
end end
it 'namespace name should be searchable' do it 'namespace name should be searchable' do
context = Search::GlobalService.new(user, search: found_project.namespace.path) context = Search::GlobalService.new(user, search: found_project.namespace.path)
results = context.execute results = context.execute
results[:projects].should match_array [found_project] results.objects('projects').should match_array [found_project]
end end
end end
end end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment