diff options
author | Kamil Trzciński <ayufan@ayufan.eu> | 2015-07-10 13:32:32 +0000 |
---|---|---|
committer | Kamil Trzciński <ayufan@ayufan.eu> | 2015-07-10 13:32:32 +0000 |
commit | d841ed56d39db1b33947b9b9c0291beaa7dcdd43 (patch) | |
tree | 9afc7861f8bd55bb8a7804982b1c37468a1d00ec /spec/models/commit_spec.rb | |
parent | 9b6e7a17d9a1a7275689b5b237940582cf1ee792 (diff) | |
parent | 39cfebdcf4225a9384ddb59578adeaec4b11d06d (diff) | |
download | gitlab-ci-d841ed56d39db1b33947b9b9c0291beaa7dcdd43.tar.gz |
Merge branch 'coverage-calc' into 'master'
Use builds_without_retry to calculate average coverage
/cc @vsizov
See merge request !197
Diffstat (limited to 'spec/models/commit_spec.rb')
-rw-r--r-- | spec/models/commit_spec.rb | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/spec/models/commit_spec.rb b/spec/models/commit_spec.rb index 14d6d99..0038e36 100644 --- a/spec/models/commit_spec.rb +++ b/spec/models/commit_spec.rb @@ -167,18 +167,25 @@ describe Commit do let(:commit) { FactoryGirl.create :commit, project: project } it "calculates average when there are two builds with coverage" do - FactoryGirl.create :build, coverage: 30, commit: commit - FactoryGirl.create :build, coverage: 40, commit: commit + FactoryGirl.create :build, name: "rspec", coverage: 30, commit: commit + FactoryGirl.create :build, name: "rubocop", coverage: 40, commit: commit commit.coverage.should == "35.00" end it "calculates average when there are two builds with coverage and one with nil" do - FactoryGirl.create :build, coverage: 30, commit: commit - FactoryGirl.create :build, coverage: 40, commit: commit + FactoryGirl.create :build, name: "rspec", coverage: 30, commit: commit + FactoryGirl.create :build, name: "rubocop", coverage: 40, commit: commit FactoryGirl.create :build, commit: commit commit.coverage.should == "35.00" end + it "calculates average when there are two builds with coverage and one is retried" do + FactoryGirl.create :build, name: "rspec", coverage: 30, commit: commit + FactoryGirl.create :build, name: "rubocop", coverage: 30, commit: commit + FactoryGirl.create :build, name: "rubocop", coverage: 40, commit: commit + commit.coverage.should == "35.00" + end + it "calculates average when there is one build without coverage" do FactoryGirl.create :build, commit: commit commit.coverage.should be_nil |