diff options
author | Zeger-Jan van de Weg <git@zjvandeweg.nl> | 2017-11-27 13:09:35 +0300 |
---|---|---|
committer | Kamil Trzcinski <ayufan@ayufan.eu> | 2017-12-03 14:04:49 +0300 |
commit | bf6126b1ecd63825070e391ebde86da9cd9dfd5e (patch) | |
tree | 25e6e17bdf4a44f108c9771b87bd089e1528f3d6 /spec/models/project_statistics_spec.rb | |
parent | e35f16074d065cc60f6cd99b4b46c09e437f129c (diff) |
Add coverage on legacy artifacts for Ci::Build
Diffstat (limited to 'spec/models/project_statistics_spec.rb')
-rw-r--r-- | spec/models/project_statistics_spec.rb | 26 |
1 files changed, 19 insertions, 7 deletions
diff --git a/spec/models/project_statistics_spec.rb b/spec/models/project_statistics_spec.rb index 4496f91fc5e..e78ed1df821 100644 --- a/spec/models/project_statistics_spec.rb +++ b/spec/models/project_statistics_spec.rb @@ -133,17 +133,29 @@ describe ProjectStatistics do describe '#update_build_artifacts_size' do let!(:pipeline) { create(:ci_pipeline, project: project) } - let!(:ci_build) { create(:ci_build, pipeline: pipeline, artifacts_size: 45.megabytes) } - before do - create(:ci_build, pipeline: pipeline, artifacts_size: 56.megabytes) - create(:ci_job_artifact, :archive, project: pipeline.project, job: ci_build) + context 'when new job artifacts are calculated' do + let(:ci_build) { create(:ci_build, pipeline: pipeline) } + + before do + create(:ci_job_artifact, :archive, project: pipeline.project, job: ci_build) + end + + it "stores the size of related build artifacts" do + statistics.update_build_artifacts_size - statistics.update_build_artifacts_size + expect(statistics.build_artifacts_size).to be(106365) + end end - it "stores the size of related build artifacts" do - expect(statistics.build_artifacts_size).to eq(106012541) + context 'when legacy artifacts are used' do + let!(:ci_build) { create(:ci_build, pipeline: pipeline, artifacts_size: 10.megabytes) } + + it "stores the size of related build artifacts" do + statistics.update_build_artifacts_size + + expect(statistics.build_artifacts_size).to eq(10.megabytes) + end end end |