Commit c5c906fe authored by Dmitriy Zaporozhets's avatar Dmitriy Zaporozhets
parent 7f4b9937
No related merge requests found
......@@ -8,7 +8,7 @@ module Gitlab
@query = Shellwords.shellescape(query) if query.present?
end
def objects(scope, page)
def objects(scope, page = nil)
case scope
when 'notes'
notes.page(page).per(per_page)
......
......@@ -11,7 +11,7 @@ module Gitlab
@query = Shellwords.shellescape(query) if query.present?
end
def objects(scope, page)
def objects(scope, page = nil)
case scope
when 'projects'
projects.page(page).per(per_page)
......
......@@ -19,7 +19,7 @@ describe 'Search::GlobalService' do
it 'should return public projects only' do
context = Search::GlobalService.new(nil, search: "searchable")
results = context.execute
results[:projects].should match_array [public_project]
results.objects('projects').should match_array [public_project]
end
end
......@@ -27,19 +27,19 @@ describe 'Search::GlobalService' do
it 'should return public, internal and private projects' do
context = Search::GlobalService.new(user, search: "searchable")
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
it 'should return only public & internal projects' do
context = Search::GlobalService.new(internal_user, search: "searchable")
results = context.execute
results[:projects].should match_array [internal_project, public_project]
results.objects('projects').should match_array [internal_project, public_project]
end
it 'namespace name should be searchable' do
context = Search::GlobalService.new(user, search: found_project.namespace.path)
results = context.execute
results[:projects].should match_array [found_project]
results.objects('projects').should match_array [found_project]
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