diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-04-20 18:38:24 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-04-20 18:38:24 +0000 |
commit | 983a0bba5d2a042c4a3bbb22432ec192c7501d82 (patch) | |
tree | b153cd387c14ba23bd5a07514c7c01fddf6a78a0 /spec/controllers/repositories/git_http_controller_spec.rb | |
parent | a2bddee2cdb38673df0e004d5b32d9f77797de64 (diff) | |
download | gitlab-ce-983a0bba5d2a042c4a3bbb22432ec192c7501d82.tar.gz |
Add latest changes from gitlab-org/gitlab@12-10-stable-ee
Diffstat (limited to 'spec/controllers/repositories/git_http_controller_spec.rb')
-rw-r--r-- | spec/controllers/repositories/git_http_controller_spec.rb | 38 |
1 files changed, 34 insertions, 4 deletions
diff --git a/spec/controllers/repositories/git_http_controller_spec.rb b/spec/controllers/repositories/git_http_controller_spec.rb index e565c757f95..59455d90c25 100644 --- a/spec/controllers/repositories/git_http_controller_spec.rb +++ b/spec/controllers/repositories/git_http_controller_spec.rb @@ -95,7 +95,7 @@ describe Repositories::GitHttpController do allow(controller).to receive(:access_check).and_return(nil) end - after do + def send_request post :git_upload_pack, params: params end @@ -106,16 +106,46 @@ describe Repositories::GitHttpController do it 'does not update project statistics' do expect(ProjectDailyStatisticsWorker).not_to receive(:perform_async) + + send_request end end if expected - it 'updates project statistics' do - expect(ProjectDailyStatisticsWorker).to receive(:perform_async) + context 'when project_statistics_sync feature flag is disabled' do + before do + stub_feature_flags(project_statistics_sync: false) + end + + it 'updates project statistics async' do + expect(ProjectDailyStatisticsWorker).to receive(:perform_async) + + send_request + end + end + + it 'updates project statistics sync' do + expect { send_request }.to change { + Projects::DailyStatisticsFinder.new(project).total_fetch_count + }.from(0).to(1) end else + context 'when project_statistics_sync feature flag is disabled' do + before do + stub_feature_flags(project_statistics_sync: false) + end + + it 'does not update project statistics' do + expect(ProjectDailyStatisticsWorker).not_to receive(:perform_async) + + send_request + end + end + it 'does not update project statistics' do - expect(ProjectDailyStatisticsWorker).not_to receive(:perform_async) + expect { send_request }.not_to change { + Projects::DailyStatisticsFinder.new(project).total_fetch_count + }.from(0) end end end |