Skip to content
Snippets Groups Projects
Commit 6597c213 authored by Lin Jen-Shin's avatar Lin Jen-Shin
Browse files

Prefer empty relation rather than arrays

parent a1eac5e4
No related branches found
No related tags found
1 merge request!5142Add a download buttons for Build Artifacts
Pipeline #
Loading
Loading
@@ -431,7 +431,7 @@ class Project < ActiveRecord::Base
 
def builds_for(build_name, ref = 'HEAD')
ct = commit(ref)
return [] unless ct
return builds.none unless ct
 
sha = commit(ref).sha
 
Loading
Loading
Loading
Loading
@@ -697,5 +697,11 @@ describe Ci::Build, models: true do
 
expect(build_ids).to eq([build.id])
end
it 'returns empty relation if the build cannot be found' do
builds = project.builds_for(build.name, 'TAIL').all
expect(builds).to be_empty
end
end
end
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment