diff options
author | Lin Jen-Shin <godfat@godfat.org> | 2016-07-07 21:03:21 +0800 |
---|---|---|
committer | Lin Jen-Shin <godfat@godfat.org> | 2016-07-07 21:03:21 +0800 |
commit | 20037e61122a688366060f9427506962048e77ed (patch) | |
tree | 70d9a4fb4e060341624db895577518fe108da21e /spec/models | |
parent | 3c89a788c795fba2b050a0af0d8261e302d8cded (diff) | |
download | gitlab-ce-20037e61122a688366060f9427506962048e77ed.tar.gz |
Introduce Project#builds_for(build_name, ref = 'HEAD'):
So that we could find the particular builds according to
build_name and ref. It would be used to find the latest
build artifacts from a particular branch or tag.
Diffstat (limited to 'spec/models')
-rw-r--r-- | spec/models/build_spec.rb | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/spec/models/build_spec.rb b/spec/models/build_spec.rb index e8171788872..8e3c9672fd5 100644 --- a/spec/models/build_spec.rb +++ b/spec/models/build_spec.rb @@ -673,7 +673,7 @@ describe Ci::Build, models: true do context 'when build is running' do before { build.run! } - it 'should return false' do + it 'returns false' do expect(build.retryable?).to be false end end @@ -681,9 +681,17 @@ describe Ci::Build, models: true do context 'when build is finished' do before { build.success! } - it 'should return true' do + it 'returns true' do expect(build.retryable?).to be true end end end + + describe 'Project#builds_for' do + it 'returns builds from ref and build name' do + latest_build = project.builds_for(build.name, 'HEAD').latest.first + + expect(latest_build.id).to eq(build.id) + end + end end |