diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2021-02-16 18:09:24 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2021-02-16 18:09:24 +0000 |
commit | 1eec6b22b26d09ce6927adf66f98d755a6339815 (patch) | |
tree | b1bb8bbdc0d49136bfd176a1e64d3bd9f2969396 /spec/controllers | |
parent | b4e854a900ba9bcbfc3476f88317c59ea048daaf (diff) | |
download | gitlab-ce-1eec6b22b26d09ce6927adf66f98d755a6339815.tar.gz |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/controllers')
-rw-r--r-- | spec/controllers/import/bulk_imports_controller_spec.rb | 4 | ||||
-rw-r--r-- | spec/controllers/repositories/git_http_controller_spec.rb | 27 |
2 files changed, 29 insertions, 2 deletions
diff --git a/spec/controllers/import/bulk_imports_controller_spec.rb b/spec/controllers/import/bulk_imports_controller_spec.rb index 9927ef0903a..08a54f112bb 100644 --- a/spec/controllers/import/bulk_imports_controller_spec.rb +++ b/spec/controllers/import/bulk_imports_controller_spec.rb @@ -185,6 +185,7 @@ RSpec.describe Import::BulkImportsController do describe 'POST create' do let(:instance_url) { "http://fake-intance" } + let(:bulk_import) { create(:bulk_import) } let(:pat) { "fake-pat" } before do @@ -201,12 +202,13 @@ RSpec.describe Import::BulkImportsController do expect_next_instance_of( BulkImportService, user, bulk_import_params, { url: instance_url, access_token: pat }) do |service| - expect(service).to receive(:execute) + allow(service).to receive(:execute).and_return(bulk_import) end post :create, params: { bulk_import: bulk_import_params } expect(response).to have_gitlab_http_status(:ok) + expect(response.body).to eq({ id: bulk_import.id }.to_json) end end end diff --git a/spec/controllers/repositories/git_http_controller_spec.rb b/spec/controllers/repositories/git_http_controller_spec.rb index bd5d07fda71..d21f602f90c 100644 --- a/spec/controllers/repositories/git_http_controller_spec.rb +++ b/spec/controllers/repositories/git_http_controller_spec.rb @@ -36,7 +36,7 @@ RSpec.describe Repositories::GitHttpController do context 'when project_statistics_sync feature flag is disabled' do before do - stub_feature_flags(project_statistics_sync: false) + stub_feature_flags(project_statistics_sync: false, disable_git_http_fetch_writes: false) end it 'updates project statistics async for projects' do @@ -47,6 +47,8 @@ RSpec.describe Repositories::GitHttpController do end it 'updates project statistics sync for projects' do + stub_feature_flags(disable_git_http_fetch_writes: false) + expect { send_request }.to change { Projects::DailyStatisticsFinder.new(container).total_fetch_count }.from(0).to(1) @@ -56,6 +58,29 @@ RSpec.describe Repositories::GitHttpController do let(:namespace) { project.namespace } subject { send_request } + + before do + stub_feature_flags(disable_git_http_fetch_writes: false) + end + end + + context 'when disable_git_http_fetch_writes is enabled' do + before do + stub_feature_flags(disable_git_http_fetch_writes: true) + end + + it 'does not increment statistics' do + expect(Projects::FetchStatisticsIncrementService).not_to receive(:new) + expect(ProjectDailyStatisticsWorker).not_to receive(:perform_async) + + send_request + end + + it 'does not record onboarding progress' do + expect(OnboardingProgressService).not_to receive(:new) + + send_request + end end end end |