diff options
Diffstat (limited to 'spec/controllers/repositories/git_http_controller_spec.rb')
-rw-r--r-- | spec/controllers/repositories/git_http_controller_spec.rb | 33 |
1 files changed, 28 insertions, 5 deletions
diff --git a/spec/controllers/repositories/git_http_controller_spec.rb b/spec/controllers/repositories/git_http_controller_spec.rb index 34052496871..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,17 +47,40 @@ 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) end - it 'records an onboarding progress action' do - expect_next_instance_of(OnboardingProgressService) do |service| - expect(service).to receive(:execute).with(action: :git_read) + it_behaves_like 'records an onboarding progress action', :git_read 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 - send_request + it 'does not record onboarding progress' do + expect(OnboardingProgressService).not_to receive(:new) + + send_request + end end end end |