summaryrefslogtreecommitdiff
path: root/spec/support
diff options
context:
space:
mode:
authorMayra Cabrera <mcabrera@gitlab.com>2019-06-03 15:06:03 +0000
committerDouglas Barbosa Alexandre <dbalexandre@gmail.com>2019-06-03 15:06:03 +0000
commit4bf3f54607d412509e7f9415a78fcf6279836c05 (patch)
treeb07c73d79fcb99f7c4cfebef0b91dcca1cb3d272 /spec/support
parent07630b3bdf7b386b820b2b7c82ba756c46a52be6 (diff)
downloadgitlab-ce-4bf3f54607d412509e7f9415a78fcf6279836c05.tar.gz
Cleans up UpdateProjectStatistics concern
- Renames attributes from stat to project_statistiscs_name and attribute to statistic_attribute - Reordes methods on UpdateProjectStatistics concern - Removes unused module from Ci::Build
Diffstat (limited to 'spec/support')
-rw-r--r--spec/support/shared_examples/models/update_project_statistics_shared_examples.rb13
1 files changed, 7 insertions, 6 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 7a04e940ee5..1b09c3dd636 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
@@ -3,16 +3,16 @@
require 'spec_helper'
shared_examples_for 'UpdateProjectStatistics' do
- let(:project) { subject.project }
- let(:stat) { described_class.statistic_name }
- let(:attribute) { described_class.statistic_attribute }
+ let(:project) { subject.project }
+ let(:project_statistics_name) { described_class.project_statistics_name }
+ let(:statistic_attribute) { described_class.statistic_attribute }
def reload_stat
- project.statistics.reload.send(stat).to_i
+ project.statistics.reload.send(project_statistics_name).to_i
end
def read_attribute
- subject.read_attribute(attribute).to_i
+ subject.read_attribute(statistic_attribute).to_i
end
it { is_expected.to be_new_record }
@@ -39,7 +39,8 @@ shared_examples_for 'UpdateProjectStatistics' do
.to receive(:increment_statistic)
.and_call_original
- subject.write_attribute(attribute, read_attribute + delta)
+ subject.write_attribute(statistic_attribute, read_attribute + delta)
+
expect { subject.save! }
.to change { reload_stat }
.by(delta)