Commit 9ef5898e authored by Dmitriy Zaporozhets's avatar Dmitriy Zaporozhets

Fix search tests

Signed-off-by: default avatarDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
parent 85333f09
require 'spec_helper' require 'spec_helper'
describe 'Search::GlobalService' do describe 'Search::GlobalService' do
let(:user) { create(:user, namespace: found_namespace) } let(:user) { create(:user) }
let(:public_user) { create(:user, namespace: public_namespace) } let(:public_user) { create(:user) }
let(:internal_user) { create(:user, namespace: internal_namespace) } let(:internal_user) { create(:user) }
let(:found_namespace) { create(:namespace, name: 'searchable namespace', path:'another_thing') } let!(:found_project) { create(:empty_project, :private, name: 'searchable_project') }
let(:unfound_namespace) { create(:namespace, name: 'unfound namespace', path: 'yet_something_else') } let!(:unfound_project) { create(:empty_project, :private, name: 'unfound_project') }
let(:internal_namespace) { create(:namespace, name: 'searchable internal namespace', path: 'something_internal') } let!(:internal_project) { create(:empty_project, :internal, name: 'searchable_internal_project') }
let(:public_namespace) { create(:namespace, name: 'searchable public namespace', path: 'something_public') } let!(:public_project) { create(:empty_project, :public, name: 'searchable_public_project') }
let!(:found_project) { create(:project, :private, name: 'searchable_project', creator_id: user.id, namespace: found_namespace) } before do
let!(:unfound_project) { create(:project, :private, name: 'unfound_project', creator_id: user.id, namespace: unfound_namespace) } found_project.team << [user, :master]
let!(:internal_project) { create(:project, :internal, name: 'searchable_internal_project', creator_id: internal_user.id, namespace: internal_namespace) } end
let!(:public_project) { create(:project, :public, name: 'searchable_public_project', creator_id: public_user.id, namespace: public_namespace) }
describe '#execute' do describe '#execute' do
context 'unauthenticated' do context 'unauthenticated' do
...@@ -38,7 +37,7 @@ describe 'Search::GlobalService' do ...@@ -38,7 +37,7 @@ describe 'Search::GlobalService' do
end end
it 'namespace name should be searchable' do it 'namespace name should be searchable' do
context = Search::GlobalService.new(user, search: "searchable namespace") context = Search::GlobalService.new(user, search: found_project.namespace.path)
results = context.execute results = context.execute
results[:projects].should match_array [found_project] results[:projects].should match_array [found_project]
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