diff options
Diffstat (limited to 'spec/services/projects/unlink_fork_service_spec.rb')
-rw-r--r-- | spec/services/projects/unlink_fork_service_spec.rb | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/spec/services/projects/unlink_fork_service_spec.rb b/spec/services/projects/unlink_fork_service_spec.rb index 872e38aba1d..2e1a6c03c90 100644 --- a/spec/services/projects/unlink_fork_service_spec.rb +++ b/spec/services/projects/unlink_fork_service_spec.rb @@ -58,6 +58,26 @@ RSpec.describe Projects::UnlinkForkService, :use_clean_rails_memory_store_cachin expect(source.forks_count).to be_zero end + it 'refreshes the project statistics of the forked project' do + expect(ProjectCacheWorker).to receive(:perform_async).with(forked_project.id, [], [:repository_size]) + + subject.execute + end + + it 'does not refresh project statistics when refresh_statistics is false' do + expect(ProjectCacheWorker).not_to receive(:perform_async) + + subject.execute(refresh_statistics: false) + end + + it 'does not refresh project statistics when the feature flag is disabled' do + stub_feature_flags(refresh_statistics_on_unlink_fork: false) + + expect(ProjectCacheWorker).not_to receive(:perform_async) + + subject.execute + end + context 'when the original project was deleted' do it 'does not fail when the original project is deleted' do source = forked_project.forked_from_project |