diff options
author | George Koltsov <gkoltsov@gitlab.com> | 2019-08-06 12:56:54 +0300 |
---|---|---|
committer | George Koltsov <gkoltsov@gitlab.com> | 2019-08-12 13:16:17 +0300 |
commit | 4e64ca44774ff6d2e23dceabaf0f1117a7ff298f (patch) | |
tree | afbf87fc861941910d750cbcf8e3a5f1dc31beb4 /spec | |
parent | 13adfb3e7a6458668fd27795dcf8e74004a5860c (diff) |
Add BitbucketServerController filtering spec
Diffstat (limited to 'spec')
-rw-r--r-- | spec/controllers/import/bitbucket_server_controller_spec.rb | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/spec/controllers/import/bitbucket_server_controller_spec.rb b/spec/controllers/import/bitbucket_server_controller_spec.rb index b89d7317b9c..e1aeab46fca 100644 --- a/spec/controllers/import/bitbucket_server_controller_spec.rb +++ b/spec/controllers/import/bitbucket_server_controller_spec.rb @@ -134,6 +134,8 @@ describe Import::BitbucketServerController do describe 'GET status' do render_views + let(:repos) { instance_double(BitbucketServer::Collection) } + before do allow(controller).to receive(:bitbucket_client).and_return(client) @@ -145,7 +147,6 @@ describe Import::BitbucketServerController do it 'assigns repository categories' do created_project = create(:project, :import_finished, import_type: 'bitbucket_server', creator_id: user.id, import_source: @created_repo.browse_url) - repos = instance_double(BitbucketServer::Collection) expect(repos).to receive(:partition).and_return([[@repo, @created_repo], [@invalid_repo]]) expect(repos).to receive(:current_page).and_return(1) @@ -159,6 +160,17 @@ describe Import::BitbucketServerController do expect(assigns(:repos)).to eq([@repo]) expect(assigns(:incompatible_repos)).to eq([@invalid_repo]) end + + context 'when filtering' do + let(:filter) { 'test' } + + it 'passes filter param to bitbucket client' do + expect(repos).to receive(:partition).and_return([[@repo, @created_repo], [@invalid_repo]]) + expect(client).to receive(:repos).with(filter: filter, limit: 25, page_offset: 0).and_return(repos) + + get :status, params: { filter: filter }, as: :json + end + end end describe 'GET jobs' do |