Don't try to load status when there is no commit
This could happen when the repository is missing. In which case cache needs to be cleared
This commit is contained in:
parent
c4956091e1
commit
21c5270a39
|
@ -37,6 +37,8 @@ module Ci
|
|||
end
|
||||
|
||||
def load_from_commit
|
||||
return unless commit
|
||||
|
||||
self.sha = commit.sha
|
||||
self.status = commit.status
|
||||
end
|
||||
|
|
|
@ -79,6 +79,14 @@ describe Ci::PipelineStatus do
|
|||
expect(pipeline_status.status).to eq('success')
|
||||
expect(pipeline_status.sha).to eq(project.commit.sha)
|
||||
end
|
||||
|
||||
it "doesn't fail for an empty project" do
|
||||
status_for_empty_commit = described_class.new(create(:empty_project))
|
||||
|
||||
status_for_empty_commit.load_status
|
||||
|
||||
expect(status_for_empty_commit).to be_loaded
|
||||
end
|
||||
end
|
||||
|
||||
describe "#store_in_cache", :redis do
|
||||
|
|
Loading…
Reference in New Issue