summaryrefslogtreecommitdiff
path: root/spec/support/shared_examples/models/update_project_statistics_shared_examples.rb
diff options
context:
space:
mode:
Diffstat (limited to 'spec/support/shared_examples/models/update_project_statistics_shared_examples.rb')
-rw-r--r--spec/support/shared_examples/models/update_project_statistics_shared_examples.rb10
1 files changed, 5 insertions, 5 deletions
diff --git a/spec/support/shared_examples/models/update_project_statistics_shared_examples.rb b/spec/support/shared_examples/models/update_project_statistics_shared_examples.rb
index eb742921d35..5aaa93aecef 100644
--- a/spec/support/shared_examples/models/update_project_statistics_shared_examples.rb
+++ b/spec/support/shared_examples/models/update_project_statistics_shared_examples.rb
@@ -60,8 +60,11 @@ RSpec.shared_examples 'UpdateProjectStatistics' do |with_counter_attribute|
end
it 'stores pending increments for async update' do
+ expected_increment = have_attributes(amount: delta, ref: subject.id)
+
expect(ProjectStatistics)
.to receive(:increment_statistic)
+ .with(project, project_statistics_name, expected_increment)
.and_call_original
subject.write_attribute(statistic_attribute, read_attribute + delta)
@@ -108,11 +111,8 @@ RSpec.shared_examples 'UpdateProjectStatistics' do |with_counter_attribute|
end
context 'when it is destroyed from the project level' do
- it 'does not update the project statistics' do
- expect(ProjectStatistics)
- .not_to receive(:increment_statistic)
-
- expect(Projects::DestroyService.new(project, project.first_owner).execute).to eq(true)
+ it 'does not store pending increments for async update' do
+ expect { Projects::DestroyService.new(project, project.first_owner).execute }.not_to change { read_pending_increment }
end
it 'does not schedule a namespace statistics worker' do